{"id":42536945,"url":"https://github.com/toni-moreno/syncflux","last_synced_at":"2026-01-28T17:16:45.946Z","repository":{"id":46027516,"uuid":"179116295","full_name":"toni-moreno/syncflux","owner":"toni-moreno","description":"SyncFlux is an Open Source InfluxDB  Data synchronization and replication tool  for migration purposes or HA clusters","archived":false,"fork":false,"pushed_at":"2023-12-18T23:02:23.000Z","size":2054,"stargazers_count":155,"open_issues_count":16,"forks_count":35,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-08-14T21:54:29.743Z","etag":null,"topics":["backup-database","backup-tool","clustering","data-replication","high-availability","influxdb","influxdb-cluster","influxdb-relay","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toni-moreno.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-04-02T16:21:12.000Z","updated_at":"2024-12-12T09:22:23.000Z","dependencies_parsed_at":"2022-07-26T05:32:37.320Z","dependency_job_id":"b67f1f99-2648-48a0-8ac1-76f36d0d5192","html_url":"https://github.com/toni-moreno/syncflux","commit_stats":{"total_commits":79,"total_committers":8,"mean_commits":9.875,"dds":0.4177215189873418,"last_synced_commit":"3e28b582cd447873fd05cbccb460392f8d1fa350"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/toni-moreno/syncflux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Fsyncflux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Fsyncflux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Fsyncflux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Fsyncflux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toni-moreno","download_url":"https://codeload.github.com/toni-moreno/syncflux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toni-moreno%2Fsyncflux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28847255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup-database","backup-tool","clustering","data-replication","high-availability","influxdb","influxdb-cluster","influxdb-relay","rest-api"],"created_at":"2026-01-28T17:16:45.309Z","updated_at":"2026-01-28T17:16:45.939Z","avatar_url":"https://github.com/toni-moreno.png","language":"Go","readme":"# SyncFlux \n\nSyncFlux is an Open Source InfluxDB  Data syncronization and replication tool with HTTP API Interface which has as main goal recover lost data from any  handmade HA influxDB 1.X cluster ( made as any simple relay  https://github.com/influxdata/influxdb-relay or our Smart Relay http://github.com/toni-moreno/influxdb-srelay )  \n\n\n## Intall from precompiled packages\n\nDebian | RedHat |Docker\n-------|--------|------\n[deb](http://syncflux-rel.s3.amazonaws.com/builds/syncflux_latest_amd64.deb) - [signature](http://syncflux-rel.s3.amazonaws.com/builds/syncflux_latest_amd64.deb.sha1)|[rpm](http://syncflux-rel.s3.amazonaws.com/builds/syncflux-latest-1.x86_64.rpm) - [signature](http://syncflux-rel.s3.amazonaws.com/builds/syncflux-latest-1.x86_64.rpm.sha1)| `docker run -d --name=syncflux_instance00 -p 4090:4090 -v /mylocal/conf:/opt/syncflux/conf -v /mylocal/log:/opt/syncflux/log  tonimoreno/syncflux`\n\nAll releases here.\n\n[releases](https://github.com/toni-moreno/syncflux/releases)\n\n## Run from master\n\nIf you want to build a package yourself, or contribute. Here is a guide for how to do that.\n\n### Dependencies\n\n- Go 1.11 \n\n### Get Code\n\n```bash\ngo get -d github.com/toni-moreno/syncflux/...\n```\n\n### Building the backend\n\n\n```bash\ncd $GOPATH/src/github.com/toni-moreno/syncflux\ngo run build.go build           \n```\n\n### Creating minimal package tar.gz\n\nAfter building frontend and backend you will do\n\n```bash\ngo run build.go pkg-min-tar\n```\n\n### Creating rpm and deb packages\n\nyou  will need previously installed the fpm/rpm and deb packaging tools.\nAfter building frontend and backend  you will do.\n\n```bash\ngo run build.go latest\n```\n\n### Running first time\nTo execute without any configuration you need a minimal config.toml file on the conf directory.\n\n```bash\ncp conf/sample.syncflux.toml conf/syncflux.toml\n./bin/syncflux [options]\n```\n\n### Creating  and running docker image\n\n\n```bash\nmake -f Makefile.docker\ndocker run tonimoreno/syncflux:latest -version\ndocker run  tonimoreno/syncflux:latest -h\ndocker run  -p 4090:4090 -v /mylocal/conf:/opt/syncflux/conf -v /mylocal/log:/opt/syncflux/log tonimoreno/syncflux:latest [options]\n```\n\n\n### Recompile backend on source change (only for developers)\n\nTo rebuild on source change (requires that you executed godep restore)\n```bash\ngo get github.com/Unknwon/bra\nbra run  \n```\nwill init a change autodetect webserver with angular-cli (ng serve) and also a autodetect and recompile process with bra for the backend\n\n## Basic Usage\n\n### Execution parameters\n\n```\nUsage of ./bin/syncflux:\n   -action: hamonitor(default),copy,fullcopy,replicaschema\n    -chunk: set RW chuck periods as in the data-chuck-duration config param\n   -config: config file\n-copyorder: backward (most to least recent, default), forward (least to most recent)\n       -db: set the db where to play\n      -end: set the endtime do action (no valid in hamonitor) default now\n     -full: copy full database or now()- max-retention-interval if greater retention policy\n  -logmode: log mode [console/file] default console\n     -logs: log directory (only apply if action=hamonitor and logmode=file)\n   -master: choose master ID from all those in the config file where to get data (override the master-db parameter in the config file)\n     -meas: set the meas where to play\n    -newdb: set the db to work on\n    -newrp: set the rp to work on\n  -pidfile: path to pid file\n       -rp: set the rp where to play\n    -slave: choose master ID from all those in the config file where to write data (override the slave-db parameter in the config file)\n    -start: set the starttime to do action (no valid in hamonitor) default now-24h\n        -v: set log level to Info\n  -version: display the version\n       -vv: set log level to Debug\n      -vvv: set log level to Trace\n```\n\n### Set config file\n\n\n````toml\n# -*- toml -*-\n\n# -------GENERAL SECTION ---------\n# syncflux could work in several ways, \n# not all General config parameters works on all modes.\n#  modes\n#  \"hamonitor\" =\u003e enables syncflux as a daemon to sync \n#                2 Influx 1.X OSS db and sync data between them\n#                when needed (does active monitoring )\n#  \"copy\" =\u003e executes syncflux as a new process to copy data \n#            between master and slave databases\n#  \"replicashema\" =\u003e executes syncflux as a new process to create \n#             the database/s and all its related retention policies \n#  \"fullcopy\" =\u003e does database/rp replication and after does a data copy\n\n[General]\n # ------------------------\n # logdir ( only valid on hamonitor action) \n #  the directory where to place logs \n #  will place the main log \"\n #  \n\n logdir = \"./log\"\n\n # ------------------------\n # loglevel ( valid for all actions ) \n #  set the log level , valid values are:\n #  fatal,error,warn,info,debug,trace\n\n loglevel = \"debug\"\n\n # -----------------------------\n # sync-mode (only valid on hamonitor action)\n #  NOTE: rigth now only  \"onlyslave\" (one way sync ) is valied\n #  (planned sync in two ways in the future)\n\n sync-mode = \"onlyslave\"\n\n # ---------------------------\n # master-db choose one of the configured InfluxDB as a SlaveDB\n # this parameter will be override by the command line -master parameter\n \n master-db = \"influxdb01\"\n\n # ---------------------------\n # slave-db choose one of the configured InfluxDB as a SlaveDB\n # this parameter will be override by the command line -slave parameter\n \n slave-db = \"influxdb02\"\n\n # ------------------------------\n # check-interval\n # the inteval for health cheking for both master and slave databases\n \n check-interval = \"10s\"\n\n # ------------------------------\n # min-sync-interval\n # the inteval in which HA monitor will check both are ok and change\n # the state of the cluster if not, making all needed recovery actions\n\n min-sync-interval = \"20s\"\n \n # ---------------------------------------------\n # initial-replication\n # tells syncflux if needed some type of replication \n # on slave database from master database on initialize \n # (only valid on hamonitor action)\n #\n # none:  no replication\n # schema: database and retention policies will be recreated on the slave database\n # data: data for all retention policies will be replicated \n #      be carefull: this full data copy could take hours,days.\n # both:  will replicate first the schema and them the full data \n\n initial-replication = \"none\"\n\n # \n # monitor-retry-durtion \n #\n # syncflux only can begin work when master and slave database are both up, \n # if some of them is down syncflux will retry infinitely each monitor-retry-duration to work.\n monitor-retry-interval = \"1m\"\n\n # \n # data-chuck-duration\n #\n # duration for each small, read  from master -\u003e write to slave, chuck of data\n # smaller chunks of data will use less memory on the syncflux process\n # and also less resources on both master and slave databases\n # greater chunks of data will improve sync speed \n\n data-chuck-duration = \"60m\"\n\n # \n #  max-retention-interval\n #\n # for infinite ( or bigger ) retention policies full replication should begin somewhere in the time\n # this parameter set the max retention.\n \n max-retention-interval = \"8760h\" # 1 year\n \n\n# ---- HTTP API SECTION (Only valid on hamonitor action)\n# Enables an HTTP API endpoint to check the cluster health\n\n[http]\n name = \"example-http-influxdb\"\n bind-addr = \"127.0.0.1:4090\"\n admin-user = \"admin\"\n admin-passwd = \"admin\"\n cookie-id = \"mysupercokie\"\n\n# ---- INFLUXDB  SECTION\n# Sets a list of available DB's that can be used \n\n````\n\n### Run as a Database replication Tool\n\nAvailable actions:\n\n- Replicate Schema\n- Copy data\n- Full copy (replicate schema + copy data)\n\n\n#### Replicate schema\n\nAllows the user to copy DB schemas from DB1 to DB2. DB schema are DBs and RPs.\n\n\n___Syntax___\n \n```\n./bin/syncflux -action replicaschema [-master \u003cmaster_id\u003e] [-slave \u003cslave_id\u003e] [-db \u003cdb_regex_selector\u003e] [-newdb \u003cnewdb_name\u003e] [-rp \u003crp_regex_selector\u003e] [-newrp \u003cnewrp_name\u003e] [-meas \u003cmeas_regex_selector\u003e]\n```\n\n___Description of syntax___\n\nIf no `master` or `slave` are provided it takes the default from config file. The db selector allows to filter with regex expression on all dbs.\nIf the `slave` schema must be different than the `master`, the new schema can be set using `newdb` and `newrp` flags\n\n\n___Limitations___\n\n- Only the default RP can be renamed\n\n___Important Notes___\n\nWhen copying big databases, there is a few things you shoult take care, to ensure data is corretly copied.\n\nSyncflux tool copy data by doing \"select * from XXXXX where time \u003e [INIT_CHUNK] AND time \u003e [END_CHUNK]\" for each one of the existing measurements in the choosen database, It does [num queries concurrently](https://github.com/toni-moreno/syncflux/blob/master/conf/sample.syncflux.toml#L125) Depending on the measurement cardinality these queries could take long time  (be carefull with timeouts)  and also need for resources (memory mainly ) in both databases , but also in for the syncflux process itself.\n\nWe recomends increase/disable all query timeouts:\n\n* [InfluxDB query-timeout=0](https://docs.influxdata.com/influxdb/v1.7/troubleshooting/query_management/#query-timeout)\n* [Syncflux  InfluxDB Section timeouts](https://github.com/toni-moreno/syncflux/blob/master/conf/sample.syncflux.toml#L152)\n* Smallest chunk sizes (1h, 30m, 10m)  will spend less memory but will spend more time to finish the complete copy\n* Run syncflux tool process ouside the influxdb servers.\n\n\n\n___Examples___\n\n*Example 1*: Copy schema from Influx01 to Influx02\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"replicaschema\" -master \"influx01\" -slave \"influx02\"\n```\n\nThe result will be that the schema of Influx01 will be replicated on Influx02\n\n```bash\nInflux02 schema\n----------------\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n*Example 2*: Copy schema from Influx01-DB1 to Influx02\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"replicaschema\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\"\n```\n\nThe result will be that the schema of Influx01 will be replicated on Influx02\n\n```bash\nInflux02 schema\n----------------\n  |-- db1\n    |-- rp1*\n    |-- rp2\n```\n\n\n*Example 3*: Copy schema from Influx01-DB1 to Influx02-DB3 (new db called DB3) and only from rp1\n\n```\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"replicaschema\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\" -rp \"^rp1$\"\n```\n\nThe result will be that the schema of Influx01 will be replicated on Influx02\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp1*\n```\n\n*Example 4*: Copy schema from Influx01-DB1 to Influx02-DB3 (new db called DB3) and set the defaultrp to rp3\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"replicaschema\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\" -newrp \"rp3\"\n```\n\nThe result will be that the schema of Influx01 will be replicated on Influx02\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp3*\n    |-- rp2\n```\n\n*Example 5*: Copy data and schema from Influx01-DB1 to Influx02-DB3 (new db called DB3) and only from meas \"cpu.*\"\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n      |-- cpu\n      |-- mem\n      |-- swap\n      |-- ...\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n#### Copy data\n\nAllows the user to copy DB data from master to slave. DB schema are DBs and RPs.\n\n\n___Syntax___\n \n```\n./bin/syncflux -action copy [-master \u003cmaster_id\u003e] [-slave \u003cslave_id\u003e] [-db \u003cdb_regex_selector\u003e] [-newdb \u003cnewdb_name\u003e] [-rp \u003crp_regex_selector\u003e] [-newrp \u003cnewrp_name\u003e] [-meas \u003cmeas_regex_selector\u003e] { [-start \u003cstart_time\u003e] [-endtime \u003cend_time\u003e] , [-full] }\n```\n\n___Description of syntax___\n\nIf no `master` or `slave` are provided it takes the default from config file. The db selector allows to filter with regex expression on all dbs.\nIf the `slave` schema must be different than the `master`, the new schema can be set using `newdb` and `newrp` flags\nThe `start` end `end` allow to define a time window to copy data. If `full` is passed, the data will be copied from now to `max-retention-interval`\n\n\u003e Remember that with this action schema is not replicated so if the DB or RP on slave doesn't exists it will be skipped\n\n___Limitations___\n\n- ...\n\n___Examples___\n\n*Example 1*: Copy all data from Influx01 to Influx02\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"coy\" -master \"influx01\" -slave \"influx02\"\n```\n\nThe command above will copy data from all dbs from Influxdb01 into Influx02\n\n```bash\nInflux02 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n\n*Example 2*: Copy data from Influx01-DB1 to Influx02 on a time window and only from rp1\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -rp \"^rp1$\" -start -10h end -5h\n```\n\nThe command above will repicate all data from Influx01 to InfluxDB but only from db1.rp1 and with a time window from -10h to -5h\n\n```bash\nInflux02 schema\n----------------\n  |-- db1\n    |-- rp1*\n    |-- rp2\n```\n\n*Example 3*: Copy data from Influx01-DB1 to Influx02-DB3 (existing db called DB3)\n\n```\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\"\n```\n\nThe command above will replicate all data from  Influx01-db1 to InfluxDB on a new DB called 'db3'\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp1*\n    |-- rp2\n```\n\n*Example 4*: Copy data from Influx01-DB1 to Influx02-DB3 (existing db called DB3) and set the defaultrp to existing rp3\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\"\n```\n\n\nThe command above will replicate all data from Influx01-db1 to InfluxDB on a new DB called 'db3' and a new defaultrp called rp3\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp3*\n    |-- rp2\n```\n\n*Example 5*: Copy data from Influx01-DB1 to Influx02-DB3 (new db called DB3) and only from meas \"cpu.*\"\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n      |-- cpu\n      |-- mem\n      |-- swap\n      |-- ...\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\" -mes \"cpu.*\"\n```\n\nThe command above will replicate all data from Influx01-db1 to InfluxDB on a new DB called 'db3' and a new defaultrp called rp3\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp3*\n      |-- cpu\n    |-- rp2\n```\n\n#### Copy data + schema\n\nAllows the user to copy DB data from master to slave. DB schema are DBs and RPs.\n\n\n___Syntax___\n \n```\n./bin/syncflux -action fullcopy [-master \u003cmaster_id\u003e] [-slave \u003cslave_id\u003e] [-db \u003cdb_regex_selector\u003e] [-newdb \u003cnewdb_name\u003e] [-rp \u003crp_regex_selector\u003e] [-newrp \u003cnewrp_name\u003e] [-meas \u003cmeas_regex_selector\u003e] { [-start \u003cstart_time\u003e] [-endtime \u003cend_time\u003e] , [-full] }\n```\n\n___Description of syntax___\n\nIf no `master` or `slave` are provided it takes the default from config file. The db selector allows to filter with regex expression on all dbs.\nIf the `slave` schema must be different than the `master`, the new schema can be set using `newdb` and `newrp` flags\nThe `start` end `end` allow to define a time window to copy data. If `full` is passed, the data will be copied from now to `max-retention-interval`\n\n\u003e Remember that with this action schema is not replicated so if the DB or RP on slave doesn't exists it will be skipped\n\n___Limitations___\n\n- Only the default RP can be renamed\n\n\n___Examples___\n\n*Example 1*: Copy all data and schema from Influx01 to Influx02\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"coy\" -master \"influx01\" -slave \"influx02\"\n```\n\nThe command above will create the schema and will copy data from all dbs from Influxdb01 into Influx02\n\n```bash\nInflux02 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n\n*Example 2*: Copy data and schema from Influx01-DB1 to Influx02 on a time window\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -start -10h end -5h\n```\n\nThe command above will create the schema and will repicate all data from Influx01 to InfluxDB but only from db1 and with a time window from -10h to -5h\n\n```bash\nInflux02 schema\n----------------\n  |-- db1\n    |-- rp1*\n    |-- rp2\n```\n\n*Example 3*: Copy data from Influx01-DB1 to Influx02-DB3 (new db called DB3)\n\n```\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\"\n```\n\nThe command above will create the schema and will replicate all data from  Influx01-db1 to InfluxDB on a new DB called 'db3'\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp1*\n    |-- rp2\n```\n\n*Example 4*: Copy data and schema from Influx01-DB1 to Influx02-DB3 (new db called DB3) and set the defaultrp to rp3\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\"\n```\n\n\nThe command above will create the schema and will replicate all data from Influx01-db1 to InfluxDB on a new DB called 'db3' and a new defaultrp called rp3\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp3*\n    |-- rp2\n```\n\n*Example 5*: Copy data and schema from Influx01-DB1 to Influx02-DB3 (new db called DB3) and only from meas \"cpu.*\"\n\n```bash\nInflux01 schema\n----------------\n\n  |-- db1\n    |-- rp1*\n      |-- cpu\n      |-- mem\n      |-- swap\n      |-- ...\n    |-- rp2\n  |-- db2\n    |-- rp1*\n    |-- rp2\n```\n\n\n```bash\n./bin/syncflux -action \"copy\" -master \"influx01\" -slave \"influx02\" -db \"^db1$\" -newdb \"db3\" -mes \"cpu.*\"\n```\n\nThe command above will create the schema and will replicate all data from Influx01-db1 to InfluxDB on a new DB called 'db3' and a new defaultrp called rp3\n\n```bash\nInflux02 schema\n----------------\n  |-- db3\n    |-- rp3*\n      |-- cpu\n    |-- rp2\n```\n\n### Run as a HA Cluster monitor\n\n```bash\n./bin/syncflux -config ./conf/syncflux.conf -action hamonitor \n```\n syncflux by default search a file syncflux.conf in the `CWD/conf/` and syncflux has hamonitor action by default so this last is equivalent to this one\n\n```bash\n./bin/syncflux  \n```\n\nyou can check the cluster state with any HTTP client, posibles values are:\n\n* OK: both nodes are ok\n* CHECK_SLAVE_DOWN: current slave is down\n* RECOVERING: both databases are working but slave leaks some data and syncflux is recovering them\n\n````bash\n % curl http://localhost:4090/api/health\n{\n  \"ClusterState\": \"CHECK_SLAVE_DOWN\",\n  \"ClusterNumRecovers\": 0,\n  \"ClusterLastRecoverDuration\": 0,\n  \"MasterState\": true,\n  \"MasterLastOK\": \"2019-04-06T09:45:05.461897766+02:00\",\n  \"SlaveState\": false,\n  \"SlaveLastOK\": \"2019-04-06T09:44:55.465393243+02:00\"\n}\n\n% curl http://localhost:4090/api/health\n{\n  \"ClusterState\": \"RECOVERING\",\n  \"ClusterNumRecovers\": 0,\n  \"ClusterLastRecoverDuration\": 0,\n  \"MasterState\": true,\n  \"MasterLastOK\": \"2019-04-06T10:28:25.459701432+02:00\",\n  \"SlaveState\": true,\n  \"SlaveLastOK\": \"2019-04-06T10:28:25.55500823+02:00\"\n}\n\n\n% curl http://localhost:4090/api/health\n{\n  \"ClusterState\": \"OK\",\n  \"ClusterNumRecovers\": 1,\n  \"ClusterLastRecoverDuration\": 2473620691,\n  \"MasterState\": true,\n  \"MasterLastOK\": \"2019-04-06T10:28:25.459701432+02:00\",\n  \"SlaveState\": true,\n  \"SlaveLastOK\": \"2019-04-06T10:28:25.55500823+02:00\"\n}\n````\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoni-moreno%2Fsyncflux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoni-moreno%2Fsyncflux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoni-moreno%2Fsyncflux/lists"}