4、主从配置
--------------------------------------------------------------------------------
| 主 | php1 | 172.17.16.7 |
| 从 | mysql1 | 172.17.16.21 |
#两个服务器修改hosts:
172.17.16.7 php1.domain.com
#主上添加配置:vim /etc/mongod.conf
master = true
source = php1.dapingmu.conf
#从上添加配置:
#vim /etc/mongod.conf
slave = true
source = php1.dapingmu.com
#查看主从,使用robomongo或直接在服务器上使用命令行工具
#主服务器上
#mongo
>use local
>db.slaves.find()
/* 0 */
{
"_id" : ObjectId("526b44843f12574552e6ce48"),
"config" : {
"host" : "172.17.16.21:29025",
"upgradeNeeded" : true
},
"ns" : "local.oplog.$main",
"syncedTo" : Timestamp(1382870579, 1)
}
5、监控管理
--------------------------------------------------------------------------------
#mongostat
The mongostat utility provides a quick overview of the status of a currently running mongod or mongos instance. mongostat is functionally similar to the UNIX/Linux file system utility vmstat, but provides data regarding mongod and mongos instances.
#mongotop
mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data. mongotop provides statistics on a per-collection level. By default, mongotop returns values every second.
#mongodb连接管理客户端robomongo
下载地址:www.robomongo.org
#MMS管理
管理地址:https://mms.mongodb.com
需要安装pymongo并安装mms agent
1、安装Python 2.6+
2、安装PyMongo
3、下载:mms-monitoring-agent
wget https://mms.mongodb.com/settings/mmsAgent/15f01bbee11f24c1c5b2b31fab30c406/mms-monitoring-agent-(MMS-Group-Name).tar.gz
4、解压并运行
$ nohup python agent.py >> /YOUR_LOG_DIRECTORY/agent.log 2>&1 &
5、添加一个Mongo Node
即可登录MMS管理地址查看MongoDB 节点监控信息图表
