1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| mongo 192.168.0.11:20001/admin use admin config = {_id: 'CN_sh', members: [ {_id: 0, host: '192.168.0.11:20001'}, {_id: 1, host: '192.168.0.11:20002'}, {_id: 2, host: '192.168.0.12:20003'}] } rs.initiate(config)
mongo 192.168.0.12:20001/admin use admin config = {_id: 'US_sh', members: [ {_id: 0, host: '192.168.0.12:20001'}, {_id: 1, host: '192.168.0.12:20002'}, {_id: 2, host: '192.168.0.11:20003'}] } rs.initiate(config)
mongo --port 20004 admin use admin config = {_id: 'configReplSet', members: [ {_id: 0, host: '192.168.0.11:20004'}, {_id: 1, host: '192.168.0.11:20005'}, {_id: 2, host: '192.168.0.11:20006'}] } rs.initiate(config)
|