-----------------------------------------------
MongoDB shell version: 1.6.0
Linux local 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 04:38:19 UTC
2010 x86_64 GNU/Linux
./bin/mongod --noprealloc -vvvvv --rest --replSet rep0/localhost:10001
--shardsvr --dbpath ./db/dbshard.0/rep0 --port 10000
./bin/mongod --noprealloc -vvvvv --rest --replSet rep0/localhost:10000
--shardsvr --dbpath ./db/dbshard.0/rep1 --port 10001
./bin/mongod --noprealloc -vvvvv --rest --replSet rep1/localhost:10011
--shardsvr --dbpath ./db/dbshard.1/rep0 --port 10010
./bin/mongod --noprealloc -vvvvv --rest --replSet rep1/localhost:10010
--shardsvr --dbpath ./db/dbshard.1/rep1 --port 10011
./bin/mongod --noprealloc -vvvvv --configsvr --dbpath ./db/config –
port 20000
./bin/mongos -vvvvv --configdb localhost:20000 --chunkSize 11
===============
./bin/mongo localhost:10000
config = {_id: 'rep0', members: [
{_id: 0, host: 'localhost:10000'},
{_id: 1, host: 'localhost:10001'}]
}
rs.initiate(config);
./bin/mongo localhost:10010
config = {_id: 'rep1', members: [
{_id: 0, host: 'localhost:10010'},
{_id: 1, host: 'localhost:10011'}]
}
rs.initiate(config);
========================
./bin/mongo
use admin
switched to db admin
> db.runCommand(
);
{
"ok" : 0,
"errmsg" : "can't use localhost as a shard since all shards
need to
communicate. either use all shards and configdbs in localhost or all
in actual IPs "
}