mongodb分片叢集報錯261
阿新 • • 發佈:2020-07-29
報錯資訊為:
root@jpvsmgmaster4:/# mongo --port 27017 MongoDB shell version v4.2.3 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("14ebc864-e221-48df-8f3f-d2a0dd05f3de") } MongoDB server version: 4.2.3 Server has startup warnings: 2020-04-02T09:58:39.176+0000 I CONTROL [main] 2020-04-02T09:58:39.176+0000 I CONTROL [main] ** WARNING: Access control is not enabled for the database. 2020-04-02T09:58:39.176+0000 I CONTROL [main] ** Read and write access to data and configuration is unrestricted. 2020-04-02T09:58:39.176+0000 I CONTROL [main] mongos> sh.status()2020-04-02T10:00:29.355+0000 E QUERY [js] uncaught exception: Error: error: { "ok" : 0, "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", "code" : 261, "codeName" : "TooManyLogicalSessions", "operationTime" : Timestamp(1585821629, 5), "$clusterTime" : { "clusterTime" : Timestamp(1585821629, 5), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DBCommandCursor@src/mongo/shell/query.js:696:15 DBQuery.prototype._exec@src/mongo/shell/query.js:111:28 DBQuery.prototype.hasNext@src/mongo/shell/query.js:282:5 DBCollection.prototype.findOne@src/mongo/shell/collection.js:255:10 printShardingStatus@src/mongo/shell/utils_sh.js:551:19 sh.status@src/mongo/shell/utils_sh.js:98:5 @(shell):1:1
從上面資訊可以看出報錯是因為config的session太多沒有回收導致
解決方法:
1、臨時解決
將配置伺服器為多節點副本集(config)- 重新啟動副本集中的任何節點。
- 將重新啟動的節點轉換為主節點。
- 下次重新整理時,將重新建立會話集合。
簡單來說,就是依次重啟config節點,注意要先重啟從節點,在重啟主節點
重啟後會釋放session連線,但是一段時間同樣的報錯還會重複出現
2、永久解決辦法
經過查詢發現出現此問題的mongo版本是4.2.3,將其升級成4.2.8 最新版本,壓測後沒有出現此問題,徹底解決