2

I am going to setup MongoDB cluster:

3 config servers, 3 routing servers, 2 shards (replica set per shard).

A replica set is just simply 1 primary, 1 secondary and 1 arbiter.

Therefore, in my concept, totally 12 (3 + 3 + 2*3) servers will be setup.

However, it is limited only 3 servers physically. Is there any good way to allocate those instances into 3 servers?

My idea is that:

ServerA - 1 config instance, 1 routing instance, 1 primary (shard I), 1 secondary (shard II)

ServerB - 1 config instance, 1 routing instance, 1 secondary (shard I), 1 arbiter (shard II)

ServerC - 1 config instance, 1 routing instance, 1 arbiter (shard I), 1 primary (shard II)

In a result, if one server is down, the whole MongoDB cluster still works. Since I lack in experience of database cluster and distributed system, I would like to obtain professional suggestion from all of you.

In addiction, I would like to know is it possible to allocate MongoDB data to other server storage (i.e. SAN)?

Thank you for any advices.

migrated from stackoverflow.com Apr 3 '14 at 14:12

This question came from our site for professional and enthusiast programmers.

  • If any of the three config server instance is down then your balancer / mongos will not be able to perform chunk migration or splits so you will not be able to add any new data, you will still be able to read just not add. You need 3 config machines to ensure 2 phase commit and to keep your meta data on your cluster consistent. This is by design to prevent data corruption or inconsistency. So in this case, any one server down will leave your cluster running in read-only mode. – eoinbrazil Apr 3 '14 at 14:52
  • You can use SAN storage but in general local disks will give higher performance, however this depends on the particular SAN. – eoinbrazil Apr 3 '14 at 14:54
  • @eoinbrazil, many thanks, then I would like to know how may I setup load balancing and failover using shard and replica set so that once a server is down, the whole cluster still works? Thank you for your professional advices again. – fmchan Apr 3 '14 at 16:35
  • @eoinbrazil, I found a paragraph talking about this issue on MongoDB official website. "If one or two config servers become unavailable, the cluster’s metadata becomes read only. You can still read and write data from the shards, but no chunk migrations or splits will occur until all three servers are available. If all three config servers are unavailable, you can still use the cluster if you do not restart the mongos instances until after the config servers are accessible again." is it an opposite to your option? docs.mongodb.org/manual/core/sharded-cluster-config-servers – fmchan Apr 3 '14 at 16:42
  • If you continue write operations and end up with a shard that has too many chunks, the balancer/mongos will attempt to automatically balance these chunks to the other shards. In general, you can use the cluster but my answer is that you should always err on the side of caution so whilst you can sent new data, if you send more than your chunk size (default is 64MB) you'll trigger a balancing round. The key point here is that you want your 3 config server instances up, without these your cluster will operate in a degraded state as it is unable to balance. – eoinbrazil Apr 4 '14 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.