Ok, so you have a new mongo server setup and you want to add it to an existing replica set. Lets just make this easy, we will talk authentication another time. Assume this time you have your mongo server installed, you have the firewall setup to allow remote connections.
- edit the mongod.conf file – usually in /etc/mongod.conf
make sure it is configured to listen on all interfaces, or the one you want…
Make sure you add the same replica set name so that it can join the group. - Login to your current primary mongo server
- execute this command to add it
rs.add({“_id” : 3, “host” : “servername:27017”, “tags” : {“dc”: “dcname”}})
you can also add priority and such, but just keeping things simple here. - Now the new server will sync the data and then it will be ready to go!