鸦鸦 发表于 2018-10-27 08:40:22

mongodb shard

# ./mongo --port 29003  MongoDB shell version: 2.6.0
  connecting to: 127.0.0.1:29003/test
  > config = {_id: 'shard3', members: [
  ... {_id: 0, host: '172.16.200.200:29003',priority:1},
  ... {_id: 1, host: '172.16.200.201:29003',priority:0},
  ... {_id: 2, host: '172.16.200.202:29003',arbiterOnly:true}]};
  {
  "_id" : "shard3",
  "members" : [
  {
  "_id" : 0,
  "host" : "172.16.200.200:29003",
  "priority" : 1
  },
  {
  "_id" : 1,
  "host" : "172.16.200.201:29003",
  "priority" : 0
  },
  {
  "_id" : 2,
  "host" : "172.16.200.202:29003",
  "arbiterOnly" : true
  }
  ]
  }
  > rs.initiate(config);
  {
  "info" : "Config now saved locally.Should come online in about a minute.",
  "ok" : 1
  }
  >
  shard3:SECONDARY>
  shard3:SECONDARY>
  shard3:SECONDARY>
  shard3:PRIMARY>

页: [1]
查看完整版本: mongodb shard