mongo sharded cluster with replica set with one arbiter

349 views
Skip to first unread message

Virendra Agarwal

unread,
Jan 9, 2014, 6:03:11 AM1/9/14
to mongod...@googlegroups.com
Hi I have one replica set with two server and one arbiter instance i need to add this existing sharded cluster.
I use following command to add this replica server to sharded cluster
db.getSiblingDB("config").shards.save( {_id: "shard0000", host: "firstset/host:27017,host2:27017" } )

do i need to specify arbiter server host name in this command.

Jon Rangel

unread,
Jan 10, 2014, 6:13:51 AM1/10/14
to mongod...@googlegroups.com
The first thing to mention is that, in general, modifying the config database directly is not recommended.  You should use the helper methods provided by the shell.  In this case, please use sh.addShard() to add a shard (see http://docs.mongodb.org/manual/reference/method/sh.addShard/ for documentation).

The parameter passed to sh.addShard() is a seed list of the host(s) that make up the shard.  For a replica set, you need to provide the replica set name and at least one of the hosts in the replica set.  The other hosts in the set will be automatically discovered.  However, more than one node, including arbiters, may be specified if desired.

Regards,

Jon

Asya Kamsky

unread,
Jan 11, 2014, 4:04:54 AM1/11/14
to mongodb-user
Let me add to Jon's excellent response (just to emphasize it strongly):

NEVER MODIFY CONFIG DATABASE DIRECTLY (unless documentation or MongoDB support instruct you to do so).

You are saying that you want to add this replica set to an existing cluster - if that cluster already had a shard named "shard0000" you would be over-writing its information in the shards collection.  Use existing sh.* commands to interact with the sharded cluster and always connect to it through mongos process - never directly to config servers.

Asya



--
--
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
 
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Virendra Agarwal

unread,
Jan 21, 2014, 5:06:32 AM1/21/14
to mongod...@googlegroups.com
Thanks Jon.
I did it as per your suggestions. I am not modifying it on config servers. i did it using mongos shell.

Regards
Virendra

Virendra Agarwal

unread,
Jan 21, 2014, 5:07:33 AM1/21/14
to mongod...@googlegroups.com
Thanks Asya.
. I am not modifying it on config servers. i did it using mongos shell.

Regards
Virendra

Asya Kamsky

unread,
Jan 26, 2014, 3:46:00 AM1/26/14
to mongodb-user
Yes, you are using the shell but you are doing the wrong thing - you are attempting to perform a change operation directly on the config database.  This is what you are NOT supposed to do.

Use "sh" commands, like sh.addShard() and do NOT do this=> "db.getSiblingDB("config").shards.save" <= BAD
Reply all
Reply to author
Forward
0 new messages