I’m using a replicaset with 3 nodes. Node primary with name n1 and port 27018, secondaries n2 port 27019 and n3 por 27020.
I would like to switch to any secondady node from primary. I’ve tried with mongo -host n2 -port 27019 but not work for me returns:
"uncaught exception: SyntaxError: unexpected token: identifier :
@(shell):1:12"
There is another way to do it? I looked in the documentation but I didn’t found nothing
Thanks
2
Answers
or
Please run the same command from the CLI instead of the Mongo Shell. Also consider to use the double dash when specify the full name options, like above:
In this way you will be able to accesso in read-only mode the data. In order to navigate dbs you will need to run the following command first:
Instead, if your needings are to switch the primary node to the "n2" node, you will need to run the following queries in your primary:
In this way you will set the election priority and running the step down command will force the n2 node to become primary