sc-mongodb icon indicating copy to clipboard operation
sc-mongodb copied to clipboard

Cannot config replica sets because connection test fails

Open mehagar opened this issue 3 years ago • 0 comments

:ghost: Brief Description

When running the sc-mongodb::replicaset recipe on the last member of the replica set, the connection test fails before the recipe can even initialize the replica set. I need to manually go to the server and run rs.initiate() in the mongo shell in order for the connection test to succeed on subsequent chef runs. Before I run rs.initiate(), when trying to run the command db.adminCommand( { listDatabases: 1 } ) (which is what configure_replicaset does before initializing the replica set), I get a NotMasterOrSecondary error since the replica set has not been initialized.

It seems like the connection test before initializing the replica set should not be making a command that itself requires the replica set to already be initialized.

:pancakes: Cookbook version

3.0.0

:woman_cook: Chef-Infra Version

14.15.6

:tophat: Platform details

Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1038-aws x86_64) running on AWS EC2

Steps To Reproduce

Steps to reproduce the behavior:

  1. Configure 3 servers, run the sc-mongodb::replicaset recipe on 2 of them with auto_configure set to false. Then run sc-mongondb::replicaset on the last one.

:police_car: Expected behavior

The recipe automatically configures the replica set without any needed intervention.

mehagar avatar Mar 20 '21 17:03 mehagar