Replicated cluster and sharding

30 views
Skip to first unread message

Kevin Burton

unread,
Dec 28, 2012, 5:25:20 PM12/28/12
to mongod...@googlegroups.com
I have a cluster of 4 machines. Each of the machines has a mongo server running. Each of the machines is running Version 12.04 of a Ubuntu Server. I would like to build a replication set and I would like to have the database sharded. Although the online documentation is helpful I am having a hard time converting the manual invocations of the database server, config server, sharding server, and arbiter into values that I should enter into the configuration file. Would someone be so kind as to point me to somewhere that documents the configuration file settings that need to take place so that the database server, config server, sharing server, and arbiter start up when the machine reboots?

Also since the arbiter isn't a very heavy load is it possible to run the arbiter on the same machine as a sharing server or configuration server?

Thank you for in advance for help with these newbie questions.

David Hows

unread,
Feb 18, 2013, 11:42:42 PM2/18/13
to mongod...@googlegroups.com
Hi Kevin,

The following should list all the configuration file options: http://docs.mongodb.org/manual/reference/configuration-options/

As a rule for all mongod instances you will likely need to supply a dbpath and a logpath, for any servers running on the same machine specifying a port can also be useful

For a replicaSet node (including an arbiter) you need to run mongod with the --replSet <setName> argument
For a config server you run mongod with the --configsvr argument
For mongos you need to specify --configdb then the ip:port to point at your 1 or 3 config servers as outlined: http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/#start-the-mongos-instances

You should also fine to run the arbiter on the same server as the config server from a load perspective.

Here is a simple example of commands I use to spin up a small test cluster of 9 replicaSet nodes, 3 config nodes and a mongos on my laptop:
mongod --replSet shard-a --dbpath /data/rs-a-1 --port 30000 --logpath /data/rs-a-1.log --fork
mongod --replSet shard-a --dbpath /data/rs-a-2 --port 30001 --logpath /data/rs-a-2.log --fork
mongod --replSet shard-a --dbpath /data/rs-a-3 --port 30002 --logpath /data/rs-a-3.log --fork
mongod --replSet shard-b --dbpath /data/rs-b-1 --port 30100 --logpath /data/rs-b-1.log --fork
mongod --replSet shard-b --dbpath /data/rs-b-2 --port 30101 --logpath /data/rs-b-2.log --fork
mongod --replSet shard-b --dbpath /data/rs-b-3 --port 30102 --logpath /data/rs-b-3.log --fork
mongod --replSet shard-c --dbpath /data/rs-c-1 --port 30200 --logpath /data/rs-c-1.log --fork
mongod --replSet shard-c --dbpath /data/rs-c-2 --port 30201 --logpath /data/rs-c-2.log --fork
mongod --replSet shard-c --dbpath /data/rs-c-3 --port 30202 --logpath /data/rs-c-3.log --fork
mongod --configsvr --dbpath /data/config-1 --port 27019 --logpath /data/config-1.log --fork
mongod --configsvr --dbpath /data/config-2 --port 27020 --logpath /data/config-2.log --fork
mongod --configsvr --dbpath /data/config-3 --port 27021 --logpath /data/config-3.log --fork
mongos --configdb foo:27019, foo:27020, foo:27021 --logpath /data/mongos.log --fork --port 40000

Regards,

David
Reply all
Reply to author
Forward
0 new messages