zoukankan      html  css  js  c++  java
  • mongodb分片集群报错261

    报错信息为:
    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)
    1. 重新启动副本集中的任何节点。
    2. 将重新启动的节点转换为主节点。
    3. 下次刷新时,将重新创建会话集合。    

    简单来说,就是依次重启config节点,注意要先重启从节点,在重启主节点

    重启后会释放session连接,但是一段时间同样的报错还会重复出现

    2、永久解决办法

    经过查询发现出现此问题的mongo版本是4.2.3,将其升级成4.2.8 最新版本,压测后没有出现此问题,彻底解决

  • 相关阅读:
    special word count
    Regular Expression
    position 之 fixed vs sticky
    查看linux并发连接数的方法
    Linux/Unix环境下的make命令详解(转)
    Redis数据结构(转)
    maven中依懒scope说明
    mysql主从复制
    linux查看是否已经安装某个软件
    在mac下使用py2app打包python项目
  • 原文地址:https://www.cnblogs.com/dzc-/p/13398880.html
Copyright © 2011-2022 走看看