当前位置:数据库 > DB2 >>

mongodb 配置replSet mongodb 配置副本集

 

1.启动mongodb

./mongod --rest --replSet set1

这里的set1为replSet名称

 

 

2.rs.status()查看当前副本集合的状态

内容如下,有些可能会不同

{

"startupStatus" : 3,

"info" : "run rs.initiate(...) if not yet done for the set",

"errmsg" : "can't get local.system.replset config from self or any seed (EMPTYCONFIG)",

"ok" : 0

}

 

 

意思是还没有得到副本集合的配置信息

config ={_id:"set1",members:[{_id:0,host:"127.0.0.1"}]}

rs.initiate(config);

3 添加一个新的node

rs.add("192.168.30.25")

显示ok

4 rs.status()查看配置信息

 

摘自 rjgcx2的专栏

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,