一、启动两个mongodb实例
1.
mongod --port 27001 --oplogSize 100 --dbpath F:\DEVELOPER\innovateServices\mongodb\data\rs1 --logpath F:\DEVELOPER\innovateServices\mongodb\log\rs\rs1.log --replSet rs/127.0.0.1:27001 --journal
2.
mongod --port 27002 --oplogSize 100 --dbpath F:\DEVELOPER\innovateServices\mongodb\data\rs2 --logpath F:\DEVELOPER\innovateServices\mongodb\log\rs\rs2.log --replSet rs/127.0.0.1:27002 --journal
二、连接上27001,配置replica set
1.
mongo --port 27001
2.
config={_id:"rs",members:[{_id:0,hosst:"127.0.0.1:27001"},{_id:1,host:"127.0.0.1:27002"}]}
3.
rs.initiate(config)
4.查看rs状态
rs.status()
三、配置结束