Reputation: 1407
I'm trying to rename a MondoDB Replica Set as explained in the MongoDB docs:
/* Set `newId` to the new replica set name */
var newId = 'idcom'
var doc = db.getSiblingDB("local").system.replset.findOne()
var oldId = doc._id
doc._id = newId
db.getSiblingDB("local").system.replset.save(doc)
db.getSiblingDB("local").system.replset.remove({_id: oldId})
However, it did not work and I am unable to revert to the previous configuration. If I attempt to repeat the instructions (start with a different port, etc.) the mongod.service on my Ubuntu machine, it does not start due to the following error:
mongod[20493]: Unrecognized option: processManagement.replication.replSetName
systemd[1]: mongod.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
systemd[1]: mongod.service: Failed with result 'exit-code'.
If I attempt starting MongoDB via mongod command mongod --dbpath /opt/mongodb/ --port 27017 --replSet idcom the server starts, but I cannot access the MongoDB terminal and logs keep throwing the following:
NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set idcomm
Any help on how to revert to the previous configuration, please? Previously the SECONDARY was set with replSetName: "comm0"
Thx!
Upvotes: 0
Views: 1205
Reputation: 59642
I would suggest to deploy the replicaset from scratch.
local
database: db.getSiblingDB('local').drop()
dbpath
(maybe you can skip this, because an Initial Sync will delete all data anyway)rs.initiate(), rs.add(), etc.
Upvotes: 1