升级原因:
"errmsg" : "Encountered non-retryable error during query :: caused by :: Unable to add session into the cache because the number of active sessions is too high"
由于MongoDB4.2.0~4.2.5系列版本的session bug会话数堆积过高造成新操作无法执行且mongos无响应,所以决定将分片集群从4.2.5升级至4.2.16。具体bug信息请参考官方文档
SERVER-42827
https://jira.mongodb.org/browse/SERVER-42827
升级流程:
MongoDB分片副本集升级相对操作简单且对线上业务影响小,大体分为三步:1.进行config副本集的滚动升级,先依次升级两个从节点,再将主节点进行降级处理后升级。2.相同操作对多shard节点副本集依次进行滚动升级。3.最后依次替换重启mongos路由节点。
具体升级步骤:
1.升级前准备
1>下载并解压高版本安装包
tar -zxvf mongodb-linux-x86_64-rhel70-4.2.16.tgz
mv mongodb-linux-x86_64-rhel70-4.2.16 mongodb4216
mv mongodb4216 /usr/local/
[root@mongodb]# cp -r auth ../mongodb4216/
[root@mongodb]# cp -r conf ../mongodb4216/
[root@mongodb4216]# chown -R hkmg:hkmg mongodb4216
2>关闭Balancer与Autosplit功能
mongos> sh.stopBalancer()
{