{"id":36753078,"url":"https://github.com/checkr/go-sync-mongo","last_synced_at":"2026-01-12T12:46:55.081Z","repository":{"id":82379218,"uuid":"66902061","full_name":"checkr/go-sync-mongo","owner":"checkr","description":null,"archived":false,"fork":false,"pushed_at":"2019-04-10T18:19:21.000Z","size":6641,"stargazers_count":84,"open_issues_count":5,"forks_count":25,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-08-14T14:55:01.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/checkr.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-30T03:12:57.000Z","updated_at":"2025-05-30T22:05:32.000Z","dependencies_parsed_at":"2023-03-02T08:15:47.535Z","dependency_job_id":null,"html_url":"https://github.com/checkr/go-sync-mongo","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/checkr/go-sync-mongo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkr%2Fgo-sync-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkr%2Fgo-sync-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkr%2Fgo-sync-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkr%2Fgo-sync-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/checkr","download_url":"https://codeload.github.com/checkr/go-sync-mongo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkr%2Fgo-sync-mongo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2026-01-12T12:46:54.897Z","updated_at":"2026-01-12T12:46:55.063Z","avatar_url":"https://github.com/checkr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go-Sync-Mongo\n\nSimple tool that polls operations from the replication oplog of a remote server, and applies them to the local/remote server. This capability supports certain classes of real-time migrations that require that the source server remain online and in operation throughout the migration process.\n\nTo see list of commands available use:\n```\n$ go run main.go --help\n```\n\nTypically this command will take the following form:\n```\n$ go run main.go sync --src \"mongodb://localhost:27018\" --src-username mongooplog --src-password some-password --src-ssl=false --dst \"mongodb://localhost:27019\" --dst-username mongooplog --dst-password some-password --dst-ssl=false\n```\n\nThis command copies oplog entries from the mongod instance running on the host mongodb0.example.net and duplicates operations to the host mongodb1.example.net. If you do not need to keep the --src host running during the migration, consider using mongodump and mongorestore or another backup operation, which may be better suited to your operation.\n\n### Running and testing with docker\n\nstart two mongo services:\n```\n$ docker run --name mongo1 -p 27018:27017 -d mongo mongod --logpath ./tmp/1.log --port 27017 --replSet rs\n$ docker run --name mongo2 -p 27019:27017 -d mongo mongod --logpath ./tmp/1.log --port 27017 --replSet rs\n```\n\nset up replication, user and permissions for **mongo1** server\n```\n$ docker exec -it mongo1 mongo admin\n\u003e rs.initiate({_id: 'rs', members: [ {_id: 1, host:'localhost:27017'}]})\n\u003e db.createUser({ user: 'mongooplog', pwd: 'some-password', roles: [ { role: \"userAdminAnyDatabase\", db: \"admin\" } ] });\n\u003e db.createRole( \n{ \n    role: \"anyAction\", \n    privileges: [ { \n        resource: { anyResource: true }, \n        actions: [ \"anyAction\" ] } ], \n    roles: []\n})\n\u003e db.grantRolesToUser(\"mongooplog\",[\"anyAction\"])\n```\n\nset up replication, user and permissions for **mongo2** server\n```\n$ docker exec -it mongo2 mongo admin\n\u003e rs.initiate({_id: 'rs', members: [ {_id: 1, host:'localhost:27017'}]})\n\u003e db.createUser({ user: 'mongooplog', pwd: 'some-password', roles: [ { role: \"userAdminAnyDatabase\", db: \"admin\" } ] });\n\u003e db.createRole( \n{ \n    role: \"anyAction\", \n    privileges: [ { \n        resource: { anyResource: true }, \n        actions: [ \"anyAction\" ] } ], \n    roles: []\n})\n\u003e db.grantRolesToUser(\"mongooplog\",[\"anyAction\"])\n```\n\nstart mongo oplog sync:\n```\n$ go run main.go sync --src \"mongodb://localhost:27018\" --src-username mongooplog --src-password some-password --src-ssl=false --dst \"mongodb://localhost:27019\" --dst-username mongooplog --dst-password some-password --dst-ssl=false\n```\n\nTry adding, deleting and modify some records in **mongo1** server and check if they persist in **mongo2** server. You can also use the `status` command to check the record count in each cluster.\n```\n$ go run main.go status --src \"mongodb://localhost:27018\" --src-username mongooplog --src-password some-password --src-ssl=false --dst \"mongodb://localhost:27019\" --dst-username mongooplog --dst-password some-password --dst-ssl=false\n+--------+--------+-------------+------+\n|   DB   | SOURCE | DESTINATION | DIFF |\n+--------+--------+-------------+------+\n| checkr |      1 |           1 |    0 |\n+--------+--------+-------------+------+\n```\n\n### Releases\nYou can download binary releases for linux, macos and windows [here](https://github.com/checkr/go-sync-mongo/releases)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckr%2Fgo-sync-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheckr%2Fgo-sync-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckr%2Fgo-sync-mongo/lists"}