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]# 
复制代码

 

 

posted @   会飞的斧头  阅读(798)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示