Search code examples
mongodbamazon-ec2amazon-web-serviceshigh-availabilityfailover

mongodb automatic failover / high availability on aws


I need the proper way of failover mechanism for mongodb on aws ec2. I know failover can be accomplished by replica sets, but what is the best way to fire a new mongo installed ubuntu-ec2 ami node and add it to replica set again automatically (with zero manual operation) and return the replica set to it's proper state ?

EBS has some problems, but if I use local instance storage, I will lost the dead nodes data, but does the replica got all the master data and so is replaca is enough to recover everthing (on mongo 1.8 with journaling), or do I have to use only EBS ?

How should I start mongo instances, If I should start with repair option, how can I sperate node's first run from failover restart ?

Regards,


Solution

  • The easiest way to bring up new nodes is to bring up a new node with a recent backup.

    So now it's a question of how you do your backup and how you restore from the backup quickly.

    The MongoDB site has a write up for backups (in general) and backups on EC2 specifically. There's also a write-up for adding a new set member.

    You can do this with instance storage or EBS drives, but you'll need different strategies for each. There's really no single way to do this, so I would check out the docs I've linked to for a primer.