Hi @Hamza_El_Aouane I’m glad you’re able to at least get it working from the mongo
shell. That means that the machines are set up to properly work in a replica set.
The only only thing that I can think of is to make sure you’re running the shell script that calls the rs.initiate(...)
from one of the machines that are part of the replica set. I would put all three nodes as members in the command instead of doing an rs.initiate()
followed by two rs.add()
commands, although it should work either way in theory.
Being able to do this manually is the first step in being able to automate it. I would recommend looking at the logs from the manual process to see what is expected to happen as you initiate the replica set and add members. Remember that errors might not show up in the log, if the server never processed the command. You might have errors coming back from the mongo
shell.
Best of luck in getting the automation process finished up and sorry that I was not able to help get you to the end on this one.