Mongo single device shard -- 1 config {_ id: shard1, members: [{_ id: 0, host: 127.0.0.1: 27018}, {_ id: 1, host: 127.0.0.1: 27019}, {_ id: 2, host: 127.0.0.1: 27020}, {_ id: 3, host: 127.0.0.1: 27021}]} rs. initiate (config); rs. add ({_ id: 4, host: 127.0.0.1: 27022,
Mongo single device shard -- 1 config = {_ id: shard1, members: [{_ id: 0, host: 127.0.0.1: 27018}, {_ id: 1, host: 127.0.0.1: 27019}, {_ id: 2, host: 127.0.0.1: 27020}, {_ id: 3, host: 127.0.0.1: 27021}]} rs. initiate (config); rs. add ({_ id: 4, host: 127.0.0.1: 27022,
Mongo single device shard-1
Config = {_ id: 'shard1 ', members: [{_ id: 0, host: '100. 0.0.1: 27018 '}, {_ id: 1, host: '2017. 0.0.1: 27019 '}, {_ id: 2, host: '2017. 0.0.1: 27020 '}, {_ id: 3, host: '100. 0.0.1: 27021 '}]}
Rs. initiate (config );
Rs. add ({"_ id": 4, host: "127.0.0.1: 27022", arbiterOnly: true });
Config = {_ id: 'shard2 ', members: [{_ id: 0, host: '123. 0.0.1: 27028 '}, {_ id: 1, host: '2017. 0.0.1: 27029 '}, {_ id: 2, host: '2017. 0.0.1: 27030 '}, {_ id: 3, host: '100. 0.0.1: 27031 '}]}
Rs. initiate (config );
Rs. add ({"_ id": 4, host: "127.0.0.1: 27032", arbiterOnly: true });
Config = {_ id: 'shard3 ', members: [{_ id: 0, host: '123. 0.0.1: 27038 '}, {_ id: 1, host: '2017. 0.0.1: 27039 '}, {_ id: 2, host: '2017. 0.0.1: 27040 '}, {_ id: 3, host: '100. 0.0.1: 27041 '}]}
Rs. initiate (config );
Rs. add ({"_ id": 4, host: "127.0.0.1: 27042", arbiterOnly: true });
Sudo mongod -- configsvr -- dbpath/data/mongo/ReplicaSetData-shard1/config -- port 20000 -- logpath/data/mongo/ReplicaSetData-shard1/config. log -- logappend -- fork
Sudo mongod -- configsvr -- dbpath/data/mongo/ReplicaSetData-shard2/config -- port 20001 -- logpath/data/mongo/ReplicaSetData-shard2/config. log -- logappend -- fork
Sudo mongod -- configsvr -- dbpath/data/mongo/ReplicaSetData-shard3/config -- port 20002 -- logpath/data/mongo/ReplicaSetData-shard3/config. log -- logappend -- fork
Sudo mongos -- configdb 127.0.0.1: 20000,127.0 .0.1: 20001,127.0 .0.1: 20002 -- port 30000 -- chunkSize 5 -- logpath/data/mongo/ReplicaSetData-shard-log/mongos. log -- logappend -- fork