时间:2021-07-01 10:21:17 帮助过:22人阅读
调试mongodb 集群期间发现一个小神器,不敢独享!相关介绍如下:
mongo-monitor CLI是一个简洁和简单的工具来检查MongoDB的服务,在集群调试升级期间,故障排查,添加节点,调整分片、修改配置等操作时可以实时查看整个集群状态,全方位了解集群状态,自动秒级刷新状态。
显示效果预览:
Shard: shard1
SECONDARY : 172.19.9.11:27001
PRIMARY : 172.19.9.12:27001
SECONDARY : 172.19.9.13:27001
Shard: shard2
SECONDARY : 172.19.9.11:27002
PRIMARY : 172.19.9.12:27002
SECONDARY : 172.19.9.13:27002
Shard: shard3
PRIMARY : 172.19.9.11:27003
SECONDARY : 172.19.9.12:27003
STARTUP : 172.19.9.13:27003
Events:
Time : 2018-12-04T05:22:48.687Z
Connection : mongodb://127.0.0.1:27017
Configuration : sharded
使用npm 安装
yum install npm -y
npm install -g mongo-monitor
brew install npm
npm install -g mongo-monitor
mongo-monitor mongodb://127.0.0.1:27017
mongo-monitor 127.0.0.1:27001,127.0.0.1:27002,127.0.0.1:27003?replicaSet=shard3
mongo-monitor 10.12.7.194:27002,10.12.7.165:27002,10.12.7.78:27002?replicaSet=shard2
Time : 2018-12-04T05:43:28.414Z
Connection : mongodb://10.12.7.194:27002,10.12.7.165:27002,10.12.7.78:27002?replicaSet=shard2
Configuration : replicaset
Replicaset: shard2
SECONDARY : 10.12.7.165:27002
PRIMARY : 10.12.7.194:27002
SECONDARY : 10.12.7.78:27002
Events:
2018-12-04T05:43:26.366Z : joined
2018-12-04T05:43:26.364Z : joined
mongo-monitor admin:P@sswrd@10.12.7.194:27002,10.12.7.165:27002,10.12.7.78:27002?replicaSet=shard2
如果输入连接端口和shard不匹配,将打印告警信息如下:
Events:
2018-12-04T05:42:46.306Z : setName from ismaster does not match provided connection setName [shard2] != [shard1]
2018-12-04T05:42:45.291Z : setName from ismaster does not match provided connection setName [shard2] != [shard1]
mongo-monitor 192.168.1.5:27001,127.0.0.1:27002,127.0.0.1:27003?replicaSet=shard3
https://github.com/dwmkerr/mongo-monitor
调试期间发现这个工具打印的信息略少,给开发者提了一个 issues ,希望能多输出点信息,加上分片使用内存,网络等信息:
https://github.com/dwmkerr/mongo-monitor/issues/20
Shard: shard1
SECONDARY : 172.19.9.11:27001 vsize:9.85G res:8.43G net_in:159b net_out:64.8k conn:18
PRIMARY : 172.19.9.12:27001 vsize:9.85G res:8.43G net_in:140b net_out:64.8k conn:18
SECONDARY : 172.19.9.13:27001 vsize:9.85G res:8.43G net_in:119b net_out:64.8k conn:18
mongodb 监控工具 mongo-monitor 安装部署
标签:bre cas 1.5 nts issue 0.12 调整 简洁 VID