Sample Header Ad - 728x90

How to rename hostname in a Mongodb replica set

0 votes
2 answers
311 views
I need to know how I can rename my hosts belonging to my replica environment in mongodb, I currently have the following configuration: rs.conf() { "_id" : "myreplicaset01", "version" : 3, "term" : 22, "protocolVersion" : NumberLong(1), "writeConcernMajorityJournalDefault" : true, "members" : [ { "_id" : 0, "host" : "mongodb01.lab.lo:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : NumberLong(0), "votes" : 1 }, { "_id" : 1, "host" : "mongodb02.lab.lo:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : NumberLong(0), "votes" : 1 }, { "_id" : 2, "host" : "mongodb03.lab.lo:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : { }, "slaveDelay" : NumberLong(0), "votes" : 1 } ], "settings" : { "chainingAllowed" : true, "heartbeatIntervalMillis" : 2000, "heartbeatTimeoutSecs" : 10, "electionTimeoutMillis" : 10000, "catchUpTimeoutMillis" : -1, "catchUpTakeoverDelayMillis" : 30000, "getLastErrorModes" : { }, "getLastErrorDefaults" : { "w" : 1, "wtimeout" : 0 }, "replicaSetId" : ObjectId("64dc2d0cd950391d47b7972e") } } I would need to change the hosts for example: - "host" : "mongo1:27017" - "host" : "mongo2:27017" - "host" : "mongo3:27017" Thanks in advance for the help.
Asked by miguel ramires (169 rep)
Jun 9, 2024, 04:00 PM
Last activity: Jul 31, 2024, 02:48 PM