connecting with mongos

1,239 views
Skip to first unread message

Sara Ali

unread,
Aug 29, 2012, 4:09:49 AM8/29/12
to mongod...@googlegroups.com
How to connect the shell to mongos? I am getting the output

>use admin
switched to db admin
>db.runCommand( { enableSharding : "foo" } )
{
"errmsg" : "no such cmd:enableSharding",
"bad cmd" : {
"enablesharding" : "foo"
},
"ok" : 0
}


--
Sara Ali
BICSE 7A
NUST-SEECS

Francesca

unread,
Aug 29, 2012, 4:20:39 AM8/29/12
to mongodb-user
Hi Sara

Here's an overview of how to configure your mongos.
http://www.mongodb.org/display/DOCS/A+Sample+Configuration+Session

It looks to me like you didn't add a shard before you enabled sharding
on your Mongos, so your DB can't recognize it yet.

Add this

switched to db admin
> db.runCommand( { addshard : "localhost:10000" } )
{ "shardadded" : "shard0000", "ok" : 1 }
> db.runCommand( { addshard : "localhost:10001" } )
{ "shardadded" : "shard0001", "ok" : 1 }

should work.

In the meantime, it might be helpful to read up on how to configure
your db for sharding. this overview is more detailed than the first,
but it will be helpful going forward.
http://www.mongodb.org/display/DOCS/Configuring+Sharding

thanks!

s-ali

unread,
Aug 29, 2012, 6:24:51 AM8/29/12
to mongod...@googlegroups.com
when I write  db.runCommand( { addshard : "localhost:10000" } )  on mongo.exe shell , it gives error "no such cmd : addshard".

The link you gave has the command
$ mkdir /data/db/a /data/db/b
please tell me where to write this command??

Francesca Krihely

unread,
Aug 29, 2012, 6:34:28 AM8/29/12
to mongod...@googlegroups.com
That can go straight in the terminal before you begin you mongod process. This command starts up your shards essentially creating a directory for your shards to go. 

--
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



--
   

name     : "Francesca  Krihely", 
  title    : "Community Manager for MongoDB at 10gen",
  phone    : "+44 7446 107810",
  location : "London, UK",
  twitter  : ["@francium", "@MongoDB""@10gen"],
  facebook : ["MongoDB", "10gen"] }

Reply all
Reply to author
Forward
0 new messages