4 1 0 2013 1-10:02:33 mongos --configdb 192.168.12.62:20000,192.168.12.63:20000,192.168.12.72:20000 --port 30000 --chunkSize 64 --logpath /home/data/mongodb/mongos.log --logappend --fork
mongodb 3072 1 0 2013 1-10:17:20 mongod --shardsvr --replSet shard1 --port 27017 --dbpath /home/data/mongodb/shard11 --oplogSize 2048 --logpath /home/data/mongodb/shard11.log --logappend --fork
root 11179 9391 0 11:14 pts/1 00:00:00 grep mongo
mongodb 30414 1 0 Feb14 1-06:20:50 mongod --shardsvr --replSet shard2 --port 27018 --dbpath /home/data/mongodb/shard21 --oplogSize 2048 --logpath /home/data/mongodb/shard21.log --logappend --fork
[root@db-m1-slave-1 ~]#
看到有4个mongo进程,
a) 启动参数有“--configdb”的就是集群入口进程;
b) Shard Server,启动参数带“--shardsvr --replSet”的是集群分片的一个片组启动进程,用户存储实际的数据块,也就是27017端口和27018端口的mongodb服务实例。至于如何判断27017端口中哪个是primary哪个是secondary需要去登录27107端口执行rs.status();去查看一下。
c) Config Server:启动参数带“--configsvr”的进程,存储了整个Cluster Metadata,其中包括chunk信息,也就是20000端口的mongodb服务实例。
d) Route Server:启动参数带“mongos --configdb”的进程,前端路由,客户端由此接入,且让整个集群看上去像单一数据库,前端应用可以透明使用,也就是30000端口的mongodb实例。
错误1:
[root@wgq nagios ~]# tail -f /usr/local/nagios/var/nagios.log
[1412819956] Warning: Return code of 13 for check of service 'Mongo Memory Usage' on host 'dbm1slave1' was out of bounds.
[1412819956] SERVICE ALERT: dbm1slave1;Mongo Memory Usage;CRITICAL;SOFT;1;(Return code of 13 is out of bounds)
[1412819975] Warning: Return code of 13 for check of service 'Mongodb Connect Check' on host 'dbm1slave1' was out of bounds.
[1412819975] SERVICE ALERT: dbm1slave1;Mongodb Connect Check;CRITICAL;SOFT;1;(Return code of 13 is out of bounds)
[1412820058] Warning: Return code of 13 for check of service 'Mongo Free Connections' on host 'dbm1slave1' was out of bounds.
需要赋值nagios用户所有权限以及r执行权限
chmod 770 /usr/lib/nagios/plugins/check_mongodb.py
chown -R nagios.nagios /usr/lib/nagios/plugins/check_mongodb.py
错误2:
监控界面Status Information一栏出现 No module named pymongo报错提示信息:
出现这个提示是因为需要安装pymongo模块,执行easy_install pymongo命令安装即可,如下所示:
[root@wgq objects]# easy_install pymongo
Searching for pymongo
Reading http://pypi.python.org/simple/pymongo/
Best match: pymongo 2.7.2
......
zip_safe flag not set; analyzing archive contents...
Adding pymongo 2.7.2 to easy-install.pth file
Installed /usr/lib/python2.6/site-packages/pymongo-2.7.2-py2.6-linux-x86_64.egg
Processing dependencies for pymongo
Finished processing dependencies for pymongo