Kill , shutDownServer, rs.remove

In the lecture the example used rs.remove - which I did and all went fine. I see in the pinned post ‘Remove Member…’ they use Kill or shutDownServer and do not mention at all the rs.remove method.

Are all 3 equivalent ways to do the same thing? or am I misunderstanding a difference between them?

Hi @James_58604,

In this pinned post, we have recommended to first shutdown the node before removing it from the replica set.

You can do it either ways :

  1. kill <pid>

  2. Connect to the node which you want to remove from your replica set and run this command.


And then finally authenticate yourself against the admin db if you have not done it already and then run the rs.remove("...") command.

It’s mentioned here.

The answer is no. rs.remove() removes a node from the replica set and the other two commands just shut down the mongod instances.

Hope it helps!

If you have any other query then please feel free to get back to us.

Happy Learning :slight_smile:

Shubham Ranjan
Curriculum Support Engineer