If so, how?
When I first created the replica set, I chose a confusing name; I'd like to change it now.
The replica set name is mentioned in /etc/mongod.conf
, and I'm not sure when it reads/rereads that. Since the replica set name can also be passed in as a command-line parameter, I'm assuming (and currently testing) the following:
replSet
CLI argument or replSet
value in /etc/mongod.conf
, then restartIn other words, I'm assuming the answer to my original question is "no, you must restart" or "no, replica set name is immutable". I'll probably figure this out soon enough since I'm trying it locally.
Here's how to do it with downtime:
Update the local.system.replset doc on each server with the new replica set name. You have to change every server here.
Here is how to update local.system.replset in mongo shell:
use local
var doc = db.system.replset.findOne()
doc._id = 'NewReplicaSetName'
db.system.replset.save(doc)
db.system.replset.remove({_id:'OldReplicaSetName'})