MongoDB HA in AWS using Multiple AZ

174 views
Skip to first unread message

vineet khanna

unread,
Aug 25, 2014, 10:14:55 PM8/25/14
to mongod...@googlegroups.com
Hi, 

I am in process of setup HA for mongodb in AWS. In my region only 2 availability zone is available.

Currently we are having 9 shards, each shard is having 3 member replicaSet.


How many member replicaSet should i configure across 2 availability zone to achieve complete HA.

Thanks!

Vineet

vineet khanna

unread,
Aug 27, 2014, 1:52:57 AM8/27/14
to mongod...@googlegroups.com
Anyone can help here.

Should i go for 5 member replicaSet or 7 member replicaSet.

Asya Kamsky

unread,
Sep 2, 2014, 12:36:49 AM9/2/14
to mongodb-user
What exactly do you mean by "complete HA"? If you have 2
availability zones and you're worried about losing an entire
availability zone, you cannot increase your fault-tolerance by having
more members - you would have to have a third location for the last
(odd) member then.

Asya
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user"
> group.
>
> For other MongoDB technical support options, see:
> http://www.mongodb.org/about/support/.
> ---
> 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.
> To post to this group, send email to mongod...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mongodb-user.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mongodb-user/fcd054c7-1d3d-4c5c-a7f2-bd1d09995da5%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

vineet khanna

unread,
Sep 2, 2014, 1:54:12 AM9/2/14
to mongod...@googlegroups.com
Thanks Asya for the clarification.

"complete HA" means same if one availability zone goes down mongo cluster should be working properly.

Asya Kamsky

unread,
Sep 2, 2014, 1:00:31 PM9/2/14
to mongodb-user
Right, got it.

Since majority of nodes is needed to elect a primary (or keep existing
primary from stepping down) no matter how many nodes you have, if they
are all in two availability zones, then necessarily the majority will
be in one (and minority in the other). Losing the AZ the majority is
in will lose write availability.

The only way around that is to have N nodes where N is odd. Have
(N-1)/2 number of nodes in each of the two AZs and have an arbiter or
Nth node somewhere else that's not in either of those availability
zones. This applies whether N is 3, 5, or 7.

Asya
> https://groups.google.com/d/msgid/mongodb-user/4832f27c-c177-4a0b-8fcd-2300cb8680af%40googlegroups.com.

vineet khanna

unread,
Sep 2, 2014, 10:29:21 PM9/2/14
to mongod...@googlegroups.com
Thanks Asya for the detailed description and workaround.

Arbiter option seems reasonable to me, will try and test this scenario.

Just one concern backup node with 
"votes" : 0,
"priority" : 0 

Will considered as a member in this situation.

Just wanted to know in (N-1)/2 formula, should i consider backup node. 

Tehmasp Chaudhri

unread,
Sep 3, 2014, 1:41:46 AM9/3/14
to mongod...@googlegroups.com
I can tell you from my experience - in AWS VPC - where you will have 3 AZs to use - I've done 2 (AZ1), 2 (AZ2), 1 Aribiter (AZ3) to great success. Echoing Asya's reply.

vineet khanna

unread,
Sep 3, 2014, 4:51:00 PM9/3/14
to mongod...@googlegroups.com
Thanks for the suggestion Tehmasp. that's the suitable option if you have 3 AZs but in Singapore only 2 AZs are available.

Asya Kamsky

unread,
Sep 4, 2014, 4:30:52 AM9/4/14
to mongodb-user
I would recommend against setting votes to 0 on the backup node -
having 0-vote nodes makes it much harder to reason about majority and
durable writes...

Asya
> https://groups.google.com/d/msgid/mongodb-user/08671d1e-a7e0-4ffb-85ea-90d68488a4ef%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages