mongo - 升级步骤

升级步骤
1. 关闭balancer
登陆mongos,执行sh.stopBalancer(),或者

连接到mongos
>use config
>db.settings.update( { _id: "balancer" }, { $set : { stopped: true } } , true );

关闭balancer后,需检查是否还有migretion:If a migration is in progress, the system will complete the in-progress migration. After disabling, you can use the following operation in the mongo shell to determine if there are no migrations in progress:

use config
while( db.locks.findOne({_id: "balancer"}).state ) {
print("waiting..."); sleep(1000);
}

2. 升级mongos,逐个升级
关闭服务后,用高版本启动

3. 升级config
升级时,至少保持一个config在线。
关闭服务后(db.shutdownServer),用高版本启动。

4. 升级mongod
首先升级secondry:关闭服务后(db.shutdownServer),使用高版本启动secondry节点,直到该节点recovery完毕(使用rs.stats()查看状态)。

升级其他secondry节点。
然后step down primary节点(rs.stepDown()),再升级primary节点。

最后升级仲裁节点。

5. 启动balancer
登陆mongos,执行sh.startBalancer(),或者

连接到mongos
>use config
>db.settings.update( { _id: "balancer" }, { $set : { stopped: false } } , true );

 

转自:http://www.cnblogs.com/yuechaotian/archive/2013/01/09/2852901.html

posted @ 2015-05-06 15:47  wsjhk  阅读(276)  评论(0编辑  收藏  举报