"errmsg" : "no such cmd: removeshard"

593 views
Skip to first unread message

mvj3

unread,
Jul 17, 2012, 12:08:28 AM7/17/12
to mongod...@googlegroups.com
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:27030
MongoDB 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.

Nat

unread,
Jul 17, 2012, 12:25:20 AM7/17/12
to mongod...@googlegroups.com
To removeshard, you need to execute it via mongos. Don't run that via config server directly.

Note that to remove a shard, you need to have that shard to be up so it can drain the existing data in that shard to other shards before dropping it.

http://www.mongodb.org/display/DOCS/removeshard+command
From: mvj3 <mvj...@gmail.com>
Date: Mon, 16 Jul 2012 21:08:28 -0700 (PDT)
Subject: [mongodb-user] "errmsg" : "no such cmd: removeshard"
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

David Chen

unread,
Jul 18, 2012, 2:06:24 AM7/18/12
to mongod...@googlegroups.com
thank you so much, nat!
Reply all
Reply to author
Forward
0 new messages