标签:mongodb replica set 配置
# mongodb.conf replSet = replsetname命令行模式:
mongod --replSet "replsetname"
$ ./bin/mongo
> rs.initiate():
> rs.conf();返回如下结果。
{ "_id" : "replsetname", "version" : 1, "members" : [ { "_id" : 1, "host" : "mongodb0.example.net:27017" } ] }
> rs.add("mongodb1.example.net")
> rs.status()返回下面信息。
{ "set" : "replisetname", "date" : ISODate("2014-08-23T07:43:51Z"), "myState" : 2, "members" : [ { "_id" : 0, "name" : "mongodb0.example.net:2701", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 3816405, "optime" : Timestamp(1408335342, 1), "optimeDate" : ISODate("2014-08-18T04:15:42Z"), "lastHeartbeat" : ISODate("2014-08-23T07:43:51Z"), "lastHeartbeatRecv" : ISODate("2014-08-23T07:43:50Z"), "pingMs" : 1, },
标签:mongodb replica set 配置
原文地址:http://blog.csdn.net/yonggang7/article/details/38778729