MongoDB学习整理之Replica Sets+Sharding(3)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:41 点击:次
/app/mongo/mongodb/bin/mongod --shardsvr --replSet shard2 --port 27018 --dbpath /app/mongo/data/shard2_2 --logpath /app/mongo/data/shard2_2/shard2_2.log --logappend --fork www.2cto.com
Server C:
/app/mongo/mongodb/bin/mongod --shardsvr --replSet shard2 --port 27018 --dbpath /app/mongo/data/shard2_3 --logpath /app/mongo/data/shard2_3/shard2_3.log --logappend --fork
用mongo连接其中一台机器的27017端口的mongod,初始化Replica Set 1,如下面代码所示:
[mongodb@Hadoop2 bin]$ /app/mongo/mongodb/bin/mongo --port 27018
MongoDB shell version: 2.0.5
connecting to: 127.0.0.1:27018/test
> config ={_id:'shard2',members:[
... {_id:0,host:'132.42.33.212:27018'},
... {_id:1,host:'132.42.33.213:27018'},
... {_id:2,host:'132.42.33.214:27018'}]
... }
{
"_id" : "shard2",
"members" : [
{
"_id" : 0,
"host" : "132.42.33.212:27018"
},
{
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>