Hello,
We use a single mongod server before, and need to use sharding feature to split records into two servers now. So add another box yesterday, setup one mongos, three mongod processes, here's commands:
mongod --bind_ip 192.168.0.4 --port 27018 --shardsvr --profile 1 --cpu --logappend --journal --rest --fork --logpath /dbs/mongodb/log/mongod.log --pidfilepath /dbs/mongodb/mongodb.pid --dbpath /dbs/mongodb --oplogSize 10240
mongod --bind_ip 192.168.0.200 --port 27019 --shardsvr --profile 1 --cpu --logappend --journal --rest --fork --logpath /dbs/mongodb/log/mongod.log --pidfilepath /dbs/mongodb/mongodb.pid --dbpath /dbs/mongodb --oplogSize 10240
mongod --bind_ip 192.168.0.4 --port 27030 --configsvr --profile 1 --cpu --logappend --journal --rest --fork --logpath /dbs/mongodb_config/log/mongod.log --pidfilepath /dbs/mongodb_config/mongodb.pid --dbpath /dbs/mongodb_config --oplogSize 10240 # i add shards here. db.runCommand( { addshard :
"host.mongo.master:27018", maxSize : 800000 /*MB*/ } ); db.runCommand( {
addshard : "host.mongo.shard200:27019", maxSize : 800000 /*MB*/ } )
mongos --bind_ip 192.168.0.4 --port 27017 --configdb
192.168.0.4:27030 --maxConns 30000 --logappend --fork --logpath /dbs/mongodb/log/mongos.log --pidfilepath /dbs/mongodb_config/mongodb.pid --chunkSize 64
For some reasons we shutdown the 192.168.0.200, and then i can't remove this shard. Here's the steps:
$ mongo
192.168.0.4:27030MongoDB shell version: 2.0.6
connecting to:
192.168.0.4:27030/test> show dbs
admin 0.015625GB
config 0.203125GB
local 0.078125GB
> use config
switched to db config
> show collections
chunks
databases
lockpings
locks
mongos
settings
shards
system.indexes
version
> db.shards.find()
{ "_id" : "shard0000", "host" : "host.mongo.master:27018", "maxSize" : NumberLong(800000) }
{ "_id" : "shard0001", "host" : "host.mongo.shard200:27019", "maxSize" : NumberLong(800000) }
> db.shards.where(:_id => "shard0001").find()
Mon Jul 16 21:21:02 SyntaxError: syntax error (shell):1
> db.shards.where(_id: "shard0001").find()
Mon Jul 16 21:21:12 SyntaxError: missing ) after argument list (shell):1
> db.runCommand( { removeshard: "shard0001"})
{
"errmsg" : "no such cmd: removeshard",
"bad cmd" : {
"removeshard" : "shard0001"
},
"ok" : 0
}
>
I think there's something wrong with the relations between these mongo processes, thx.