zoukankan      html  css  js  c++  java
  • mongo——通过docker查看mongo集群的状态和数据

    docker exec -it mongoconfig  mongo 192.168.1.20:26001 -eval "rs.status().members"

    docker exec -it mongoconfig  mongo 192.168.1.20:26002 -eval "rs.status().members"

    docker exec -it mongoconfig  mongo 192.168.1.20:26003 -eval "rs.status().members"

    docker exec -it mongoconfig  mongo 192.168.1.22:27017/dragon_1252 -eval "db.globalActivityEntity.find({},{}).pretty()"

     

    docker exec -it mongoconfig mongo 192.168.1.22:27017 -eval "sh.status()"

    [root@localhost data]# docker exec -it mongoconfig mongo 192.168.1.22:27017 -eval "sh.status()"
    MongoDB shell version v4.0.24
    connecting to: mongodb://192.168.1.22:27017/test?gssapiServiceName=mongodb
    Implicit session: session { "id" : UUID("7689623a-a7d0-44f7-8b2d-28ef076fd1fb") }
    MongoDB server version: 4.0.24
    --- Sharding Status --- 
      sharding version: {
          "_id" : 1,
          "minCompatibleVersion" : 5,
          "currentVersion" : 6,
          "clusterId" : ObjectId("60a247795914528e195d954b")
      }
      shards:
            {  "_id" : "replshard1",  "host" : "replshard1/192.168.1.20:26002,192.168.1.21:26002",  "state" : 1 }
            {  "_id" : "replshard2",  "host" : "replshard2/192.168.1.20:26003,192.168.1.21:26003",  "state" : 1 }
      active mongoses:
            "4.0.24" : 1
      autosplit:
            Currently enabled: yes
      balancer:
            Currently enabled:  yes
            Currently running:  no
            Failed balancer rounds in last 5 attempts:  4
            Last reported error:  Could not find host matching read preference { mode: "primary" } for set replshard2
            Time of Reported error:  Tue Nov 16 2021 03:26:54 GMT+0000 (UTC)
            Migration Results for the last 24 hours: 
                    No recent migrations
      databases:
            {  "_id" : "config",  "primary" : "config",  "partitioned" : true }
                    config.system.sessions
                            shard key: { "_id" : 1 }
                            unique: false
                            balancing: true
                            chunks:
                                    replshard1    512
                                    replshard2    512
                            too many chunks to print, use verbose if you want to force print
            {  "_id" : "dragon_1251",  "primary" : "replshard2",  "partitioned" : false,  "version" : {  "uuid" : UUID("b2f454a7-58a0-4954-9fbb-c5e68af27dbd"),  "lastMod" : 1 } }
            {  "_id" : "dragon_1252",  "primary" : "replshard1",  "partitioned" : false,  "version" : {  "uuid" : UUID("ac2e89ce-add6-463e-a013-f884191b309f"),  "lastMod" : 1 } }
            {  "_id" : "dragon_cross",  "primary" : "replshard2",  "partitioned" : false,  "version" : {  "uuid" : UUID("8150488c-f236-4fd7-a47b-ab7146a6adde"),  "lastMod" : 1 } }
            {  "_id" : "dragon_global",  "primary" : "replshard1",  "partitioned" : false,  "version" : {  "uuid" : UUID("4686f30f-cfc1-421b-9f40-e21d08910438"),  "lastMod" : 1 } }
    
    [root@localhost data]# 

     

  • 相关阅读:
    [vue Debugger] sourcemap
    [vuex]持久化存储
    [vuex]字典值封装到vuex缓存
    [vue]常用指令集合
    VSCode插件集合
    [element-ui] 表格点击出现编辑效果实现
    [pdf] 插件实现pdf上传预览、打印
    [html] 特殊字符
    [element-ui] 穿梭框对象重复不添加方案
    Redis持久化
  • 原文地址:https://www.cnblogs.com/xingchong/p/15568294.html
Copyright © 2011-2022 走看看