Thursday, April 10, 2025

Reconfiguring MongoDB ReplicaSets

 Reconfiguring ReplicaSet:

For example, port has to change for one of a member.

1) Stop the member and restart using new port number

2) Modify the member with new port number

conf = rs.config()

conf.members[2].host="192.168.1.52:27019"

3) Apply the reconfiguration

rs.reconfig(conf)   or    rs.reconfig(conf, {force:true})  # Force option is only if it's really necessary

4) Verify the changes

rs.config() 

rs.status()

No comments:

Post a Comment

ScyllaDB vs Cassandra: What Makes ScyllaDB the Better Choice? For years, Apache Cassandra has been a go-to NoSQL database for applications...