Automate the prod mongodb data cut to beta
This is very clunky at the moment but would be pretty
- Create a new volume based on the latest EBS prod volume snapshot.
- Attach the volume to
mongo-beta-01
. - Start a new mongod without replica set configuration on a temporary port.
- Run this to update the replica set name:
use local
var doc = db.system.replset.findOne()
doc._id = 'TroupeBetaProdData'
db.system.replset.save(doc)
db.system.replset.remove({_id:'TroupeReplicaSet'})
- Restart mongod.
- Run this to reconfigure the replica set (assuming the temporary port is 27018):
c = rs.conf()
c.members = [
{
"_id" : 1,
"host" : "mongo-beta-01.beta.gitter:27018",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"tags" : {},
"slaveDelay" : NumberLong(0),
"votes" : 1
}
]
rs.reconfig(c, {force: 1})
- Run this script to scrub everything that could trigger unwanted notifications and similar stuff.
- Stop all mongod processes.
- Swap the data volume with the new one.
- Start mongod using upstart.
- Run this to update the replica set member:
c = rs.conf()
c.members[0].host = "mongo-beta-01.beta.gitter:27017"
rs.reconfig(c, {force: 1})