Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run rs.initiate() to start replication on clean mongo boot #6317

Merged
merged 2 commits into from
Jan 26, 2021

Conversation

Akarshit
Copy link
Contributor

Resolves reactioncommerce/reaction-development-platform#165
Impact: major
Type: bugfix

Issue

On the initial load of the mongod if started in replica, rs.initiate() has to be run on one of the instance to start the replication. This was missing from our configuration files.

Solution

Using healthcheck option of the docker-compose to hack docker running the rs.initiate() command. Used this for reference: https://zgadzaj.com/development/docker/docker-compose/turning-standalone-mongodb-server-into-a-replica-set-with-docker-compose

Breaking changes

None expected.

Testing

  1. make clean
  2. make init-dev

Would love to have a couple of eyes on this one and discuss if there could be a better solution on this one. Most of the resources day that rs.initiate() should be run manually based on need, but in our use case, we are using replication more for oplog than for actual replication.

@nnnnat nnnnat requested review from focusaurus and removed request for ticean January 22, 2021 13:44
focusaurus
focusaurus previously approved these changes Jan 25, 2021
Signed-off-by: Erik Kieckhafer <[email protected]>
@kieckhafer kieckhafer merged commit 9512900 into trunk Jan 26, 2021
@jrw421 jrw421 mentioned this pull request Feb 3, 2021
@Akarshit Akarshit deleted the bugfix-akarshit-mongo-replication branch June 23, 2021 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reaction backend fails to connect to MongoDB with timeout, replica error; localhost:3000 is unavailable
4 participants