Sample Header Ad - 728x90

adding and removing a node from a mongo replica set

3 votes
1 answer
2480 views
I have a new backup server I want to add to our mongo replica sets. As far as I can tell its as easy as logging on to the replica sets primary and adding the following command: rs.add( { host: "mongobackup:10003", priority: 0, votes: 0, hidden: true } ) My understanding is that after doing so the primary should sync all its configuration and data with the new node. Additionally I have an old backup server I want to remove from the replica set which I looks like all i have to do is type this command into the replica sets primary: rs.remove( "oldmongobackup:10003" ) Is there anything else I am missing?
rs2:PRIMARY> rs.conf()
{
	"_id" : "rs2",
	"version" : 26,
	"members" : [
		{
			"_id" : 7,
			"host" : "mongo03:10001",
			"arbiterOnly" : false,
			"buildIndexes" : true,
			"hidden" : false,
			"priority" : 20,
			"tags" : {
				"dc" : "maid"
			},
			"slaveDelay" : 0,
			"votes" : 1
		},
		{
			"_id" : 8,
			"host" : "mongo01:10002",
			"arbiterOnly" : false,
			"buildIndexes" : true,
			"hidden" : false,
			"priority" : 10,
			"tags" : {
				"dc" : "maid"
			},
			"slaveDelay" : 0,
			"votes" : 1
		},
		{
			"_id" : 9,
			"host" : "mongo02:10003",
			"arbiterOnly" : true,
			"buildIndexes" : true,
			"hidden" : false,
			"priority" : 1,
			"tags" : {

			},
			"slaveDelay" : 0,
			"votes" : 1
		},
		{
			"_id" : 10,
			"host" : "oldmongobackup:10003",
			"arbiterOnly" : false,
			"buildIndexes" : true,
			"hidden" : true,
			"priority" : 0,
			"tags" : {

			},
			"slaveDelay" : 0,
			"votes" : 1
		}
	],
	"settings" : {
		"chainingAllowed" : true,
		"heartbeatTimeoutSecs" : 10,
		"getLastErrorModes" : {

		},
		"getLastErrorDefaults" : {
			"w" : 1,
			"wtimeout" : 0
		}
	}
}
Asked by CrazyHorse019 (33 rep)
Jan 29, 2020, 01:26 PM
Last activity: Jan 30, 2020, 05:22 PM