SlideShare a Scribd company logo
Configuring MongoDB HA Replica Set on AWS EC2
Background
It has always been a tedious task to choose the right configuration for
MongoDB on AWS EC2
Choosing the right configuration in this environment is always challenging
and it takes a lots of time to make your system Production Ready.
What does it take?
All it needs is two machines that will be used as PRIMARY (Master)
and SECONDARY (Slave) node and one ARBITER machine for the
replica set.
However, it might get changed based on your application
requirement and you can opt for higher number of nodes based on
your need
ARBITER is only required in case of even number replica set. If you
want to maintain replica set with one PRIMARY and two SECONDARY,
ARBITER is not required
Hardware Requirement
Two 64 bit EC2 instances of medium/large or higher configuration
based on your App requirement for PRIMARY and SECONDARY node
(There is a data storage limitation of using 32 bit machine and can only
support upto 2.5 GB storage)

A small 32 bit EC2 machine for MongoDB ARBITER
It is recommended –

• to have machines in different availability zone to make it High
available in-case of a shutdown of one availability zone
• to use Ext4 EBS volume to support I/O suspend and write-cache
flushing for multi-disk consistent snapshots
Installation Steps
Create and Launch an EC2 instance of required configuration as
stated above for PRIMARY, SECONDARY and ARBITER nodes
Create an EBS volume of required size to be used for MongoDB storage
for both nodes
Connect to EC2 instances on PRIMARY and SECONDARY node via SSH
Make an Ext4 file system on both nodes via sudo mkfs -t ext4
/dev/<Created EBS Volume>

Create directory /data/db or any other of your own choice and mount
it to attached volume using sudo mount -a /dev/< Created EBS
Volume > /data/db
Contd..
Edit your /etc/fstab to enumerate it on start up of instance using
sudo echo ‘/dev/sdf /data/db auto noatime,noexec,nodiratime 0 0’
>> /etc/fstab
Download and Install MongoDB on all instances
Start the PRIMARY node with following command in MongoDB
directory using mongod --rest --replSet myHASet (where myHASet is
the name of Replica set; you can choose any name of your choice)
Go to Mongo terminal in MongoDB directory.
Initialize the set using command rs.initiate() on mongo terminal
Check the status of Replica set after initialization using rs.status()
command.
Contd..
If initialization is success you will see OK in the output something like
this
{
"set" : "sample",
"myState" : 1,
"members" : [
{
"name" : "<PRIMARY_HOSTNAME>:27017",
"self" : true
}
],
"ok" : 1
}
You can also check the status on
http://<PRIMARY_NODE>:27017/_replSet
Your Primary node is ready to use now. You can insert/update document
on this node
Contd..
Now start the SECONDARY node with same command as on primary
mongod --rest --replSet myHASet
Tell the PRIMARY node to add SECONDARY node in replica set. Go to
mongo console on PRIMARY node and add this using
rs.add(“<SECONDARY_HOSTNAME>”);
If addition is successful you will see the response
Once your SECONDARY node is attached to replica set you can check
the status on http://<PRIMARY_NODE>:27017/_replSet
Now start the ARBITER node using mongod --rest --replSet myset -oplogSize 8
Contd..
Add the ARBITER node in replica set using command rs.add( {
_id:2, host:”<ARBITER_HOSTNAME>”, arbiterOnly:true } )
Once ARBITER is added successfully, you are done with the
configuration and your replica set is ready to use.
Got o http://<PRIMARY_NODE>:27017/_replSet and you should
be able to see the status of each node.
To test the replica, take down the primary node, and see if
SECONDARY is able to pick up and will become PRIMARY node.
You can fire the command db.isMaster() to check the status if
SECONDARY node has turned up as Master node.
Connecting Replica
• After you have setup the replica set successfully, you can connect with it
using JAVA driver from your client application
• You can use the following code snippet for making connection to replica set
List addrs = new ArrayList();
addrs.add( new ServerAddress(“<PRIMARY_HOST>",”<MONGO_PORT>" ) );
addrs.add( new ServerAddress(“<SECONDARY_HOST>",“<MONGO_PORT>"));
Mongo m = new Mongo(addrs);
DB db = m.getDB(“<NAME_OF_DB>");

• MongoDB driver is smart enough to connect to PRIMARY node only, in-case if
PRIMARY node is down, it will automatically switch to another node for
communication
Conclusion
Here is an honest attempt to guide you to setup MongoDB on AWS
EC2. Though this is an open forum and you all are open to post your
comments if I have missed anything
Also, if you don’t want to get into setting up the infrastructure and
administration for MongoDB, you can directly use our App42 NoSQL
Cloud Storage Service.
This service can be accessed using our REST API or using native
platform SDKs available in different languages like iOS, Android,
J2ME, JAVA, PHP, Ruby, Windows Phone and C#
Links for Reference :
http://www.shephertz.com
http://api.shephertz.com
http://appwarp.shephertz.com

http://app42paas.shephertz.com/

Follow us on:

Contact: sales@shephertz.com
Skype: ShepHertz
Ad

More Related Content

What's hot (17)

Windows Azure Virtual Machines
Windows Azure Virtual MachinesWindows Azure Virtual Machines
Windows Azure Virtual Machines
Neil Mackenzie
 
AWS Lambda at JUST EAT
AWS Lambda at JUST EATAWS Lambda at JUST EAT
AWS Lambda at JUST EAT
Andrew Brown
 
Setup Kubernetes Cluster On AWS Using KOPS
Setup Kubernetes Cluster On AWS Using KOPSSetup Kubernetes Cluster On AWS Using KOPS
Setup Kubernetes Cluster On AWS Using KOPS
Sivaprakash
 
Solr Performance Monitoring with SPM
Solr Performance Monitoring with SPMSolr Performance Monitoring with SPM
Solr Performance Monitoring with SPM
Sematext Group, Inc.
 
Terraform
TerraformTerraform
Terraform
Adam Vincze
 
How to Run Solr on Docker and Why
How to Run Solr on Docker and WhyHow to Run Solr on Docker and Why
How to Run Solr on Docker and Why
Sematext Group, Inc.
 
Erlang scheduler
Erlang schedulerErlang scheduler
Erlang scheduler
dennis zhuang
 
Apache Kafka, HDFS, Accumulo and more on Mesos
Apache Kafka, HDFS, Accumulo and more on MesosApache Kafka, HDFS, Accumulo and more on Mesos
Apache Kafka, HDFS, Accumulo and more on Mesos
Joe Stein
 
Security features In MySQL 8.0
Security features In MySQL 8.0Security features In MySQL 8.0
Security features In MySQL 8.0
Mydbops
 
AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도
AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도
AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도
Amazon Web Services Korea
 
Introduction To Apache Mesos
Introduction To Apache MesosIntroduction To Apache Mesos
Introduction To Apache Mesos
Joe Stein
 
ACS & vSphere Draft
ACS & vSphere DraftACS & vSphere Draft
ACS & vSphere Draft
Aaron Delp
 
Apache Mesos
Apache MesosApache Mesos
Apache Mesos
Puneet soni
 
DataStax: Backup and Restore in Cassandra and OpsCenter
DataStax: Backup and Restore in Cassandra and OpsCenterDataStax: Backup and Restore in Cassandra and OpsCenter
DataStax: Backup and Restore in Cassandra and OpsCenter
DataStax Academy
 
Docker, Mesos, Spark
Docker, Mesos, Spark Docker, Mesos, Spark
Docker, Mesos, Spark
Qiang Wang
 
HashiCorp at Just Eat
HashiCorp at Just EatHashiCorp at Just Eat
HashiCorp at Just Eat
Andrew Brown
 
Building Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KLBuilding Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KL
Gareth Davies
 
Windows Azure Virtual Machines
Windows Azure Virtual MachinesWindows Azure Virtual Machines
Windows Azure Virtual Machines
Neil Mackenzie
 
AWS Lambda at JUST EAT
AWS Lambda at JUST EATAWS Lambda at JUST EAT
AWS Lambda at JUST EAT
Andrew Brown
 
Setup Kubernetes Cluster On AWS Using KOPS
Setup Kubernetes Cluster On AWS Using KOPSSetup Kubernetes Cluster On AWS Using KOPS
Setup Kubernetes Cluster On AWS Using KOPS
Sivaprakash
 
Solr Performance Monitoring with SPM
Solr Performance Monitoring with SPMSolr Performance Monitoring with SPM
Solr Performance Monitoring with SPM
Sematext Group, Inc.
 
Apache Kafka, HDFS, Accumulo and more on Mesos
Apache Kafka, HDFS, Accumulo and more on MesosApache Kafka, HDFS, Accumulo and more on Mesos
Apache Kafka, HDFS, Accumulo and more on Mesos
Joe Stein
 
Security features In MySQL 8.0
Security features In MySQL 8.0Security features In MySQL 8.0
Security features In MySQL 8.0
Mydbops
 
AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도
AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도
AWS re:Invent re:Cap - 새로운 관계형 데이터베이스 엔진: Amazon Aurora - 양승도
Amazon Web Services Korea
 
Introduction To Apache Mesos
Introduction To Apache MesosIntroduction To Apache Mesos
Introduction To Apache Mesos
Joe Stein
 
ACS & vSphere Draft
ACS & vSphere DraftACS & vSphere Draft
ACS & vSphere Draft
Aaron Delp
 
DataStax: Backup and Restore in Cassandra and OpsCenter
DataStax: Backup and Restore in Cassandra and OpsCenterDataStax: Backup and Restore in Cassandra and OpsCenter
DataStax: Backup and Restore in Cassandra and OpsCenter
DataStax Academy
 
Docker, Mesos, Spark
Docker, Mesos, Spark Docker, Mesos, Spark
Docker, Mesos, Spark
Qiang Wang
 
HashiCorp at Just Eat
HashiCorp at Just EatHashiCorp at Just Eat
HashiCorp at Just Eat
Andrew Brown
 
Building Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KLBuilding Scalable Web Apps - LVL.UP KL
Building Scalable Web Apps - LVL.UP KL
Gareth Davies
 

Viewers also liked (18)

Using Amazon RDS to power enterprise applications (Peoplesoft)
Using Amazon RDS to power enterprise applications (Peoplesoft) Using Amazon RDS to power enterprise applications (Peoplesoft)
Using Amazon RDS to power enterprise applications (Peoplesoft)
Tom Laszewski
 
AWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
AWS Summit London 2014 - JUST EAT - High Availability and Rapid ChangeAWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
AWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
daniel-richardson
 
AWS CloudFormation template with single & redundant system
AWS CloudFormation template with single & redundant systemAWS CloudFormation template with single & redundant system
AWS CloudFormation template with single & redundant system
Naoya Hashimoto
 
AWS Solutions Architect 準備心得
AWS Solutions Architect 準備心得AWS Solutions Architect 準備心得
AWS Solutions Architect 準備心得
Cliff Chao-kuan Lu
 
Data Center Migration to the AWS Cloud
Data Center Migration to the AWS CloudData Center Migration to the AWS Cloud
Data Center Migration to the AWS Cloud
Tom Laszewski
 
What is AWS?
What is AWS?What is AWS?
What is AWS?
Martin Yan
 
Spring Data MongoDB Webiner
Spring Data MongoDB WebinerSpring Data MongoDB Webiner
Spring Data MongoDB Webiner
Hakan Özler
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica Sets
MongoDB
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
Sudheer Kondla
 
MongoDB Replica Sets
MongoDB Replica SetsMongoDB Replica Sets
MongoDB Replica Sets
MongoDB
 
Getting started with replica set in MongoDB
Getting started with replica set in MongoDBGetting started with replica set in MongoDB
Getting started with replica set in MongoDB
Kishor Parkhe
 
Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB
MongoDB
 
Advanced Replication
Advanced ReplicationAdvanced Replication
Advanced Replication
MongoDB
 
MongoDB Database Replication
MongoDB Database ReplicationMongoDB Database Replication
MongoDB Database Replication
Mehdi Valikhani
 
MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)
MongoSF
 
Netflix Aws Startup Tour 090617134938 Phpapp02
Netflix Aws Startup Tour 090617134938 Phpapp02Netflix Aws Startup Tour 090617134938 Phpapp02
Netflix Aws Startup Tour 090617134938 Phpapp02
GovCloud Network
 
Advanced data migration techniques for Amazon RDS
Advanced data migration techniques for Amazon RDSAdvanced data migration techniques for Amazon RDS
Advanced data migration techniques for Amazon RDS
Tom Laszewski
 
MongoDb scalability and high availability with Replica-Set
MongoDb scalability and high availability with Replica-SetMongoDb scalability and high availability with Replica-Set
MongoDb scalability and high availability with Replica-Set
Vivek Parihar
 
Using Amazon RDS to power enterprise applications (Peoplesoft)
Using Amazon RDS to power enterprise applications (Peoplesoft) Using Amazon RDS to power enterprise applications (Peoplesoft)
Using Amazon RDS to power enterprise applications (Peoplesoft)
Tom Laszewski
 
AWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
AWS Summit London 2014 - JUST EAT - High Availability and Rapid ChangeAWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
AWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
daniel-richardson
 
AWS CloudFormation template with single & redundant system
AWS CloudFormation template with single & redundant systemAWS CloudFormation template with single & redundant system
AWS CloudFormation template with single & redundant system
Naoya Hashimoto
 
AWS Solutions Architect 準備心得
AWS Solutions Architect 準備心得AWS Solutions Architect 準備心得
AWS Solutions Architect 準備心得
Cliff Chao-kuan Lu
 
Data Center Migration to the AWS Cloud
Data Center Migration to the AWS CloudData Center Migration to the AWS Cloud
Data Center Migration to the AWS Cloud
Tom Laszewski
 
Spring Data MongoDB Webiner
Spring Data MongoDB WebinerSpring Data MongoDB Webiner
Spring Data MongoDB Webiner
Hakan Özler
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica Sets
MongoDB
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
Sudheer Kondla
 
MongoDB Replica Sets
MongoDB Replica SetsMongoDB Replica Sets
MongoDB Replica Sets
MongoDB
 
Getting started with replica set in MongoDB
Getting started with replica set in MongoDBGetting started with replica set in MongoDB
Getting started with replica set in MongoDB
Kishor Parkhe
 
Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB Back to Basics: Build Something Big With MongoDB
Back to Basics: Build Something Big With MongoDB
MongoDB
 
Advanced Replication
Advanced ReplicationAdvanced Replication
Advanced Replication
MongoDB
 
MongoDB Database Replication
MongoDB Database ReplicationMongoDB Database Replication
MongoDB Database Replication
Mehdi Valikhani
 
MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)
MongoSF
 
Netflix Aws Startup Tour 090617134938 Phpapp02
Netflix Aws Startup Tour 090617134938 Phpapp02Netflix Aws Startup Tour 090617134938 Phpapp02
Netflix Aws Startup Tour 090617134938 Phpapp02
GovCloud Network
 
Advanced data migration techniques for Amazon RDS
Advanced data migration techniques for Amazon RDSAdvanced data migration techniques for Amazon RDS
Advanced data migration techniques for Amazon RDS
Tom Laszewski
 
MongoDb scalability and high availability with Replica-Set
MongoDb scalability and high availability with Replica-SetMongoDb scalability and high availability with Replica-Set
MongoDb scalability and high availability with Replica-Set
Vivek Parihar
 
Ad

Similar to Configuring MongoDB HA Replica Set on AWS EC2 (20)

Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
Sudheer Kondla
 
Mongodb replication
Mongodb replicationMongodb replication
Mongodb replication
PoguttuezhiniVP
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love Systemd
Richard Lister
 
Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2
benjaminwootton
 
Hadoop on osx
Hadoop on osxHadoop on osx
Hadoop on osx
Devopam Mittra
 
Sharded cluster tutorial
Sharded cluster tutorialSharded cluster tutorial
Sharded cluster tutorial
Antonios Giannopoulos
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster Tutorial
Jason Terpko
 
MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017
Antonios Giannopoulos
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
Jerwin Roy
 
Eyeball XMPP Server Administrator Guide
Eyeball XMPP Server Administrator GuideEyeball XMPP Server Administrator Guide
Eyeball XMPP Server Administrator Guide
Eyeball Networks
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
tarungupta276841
 
Oracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupOracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard Setup
Arun Sharma
 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
MuhammadShoaibHussai2
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
Tharun Srinivasa
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
NIRMAL FELIX
 
R hive tutorial supplement 1 - Installing Hadoop
R hive tutorial supplement 1 - Installing HadoopR hive tutorial supplement 1 - Installing Hadoop
R hive tutorial supplement 1 - Installing Hadoop
Aiden Seonghak Hong
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorial
Antonios Giannopoulos
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloud
petriojala123
 
Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...
Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...
Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...
Nagios
 
Setting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutesSetting up mongodb sharded cluster in 30 minutes
Setting up mongodb sharded cluster in 30 minutes
Sudheer Kondla
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love Systemd
Richard Lister
 
Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2Configuring Your First Hadoop Cluster On EC2
Configuring Your First Hadoop Cluster On EC2
benjaminwootton
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster Tutorial
Jason Terpko
 
MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017
Antonios Giannopoulos
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
Jerwin Roy
 
Eyeball XMPP Server Administrator Guide
Eyeball XMPP Server Administrator GuideEyeball XMPP Server Administrator Guide
Eyeball XMPP Server Administrator Guide
Eyeball Networks
 
Oracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard SetupOracle 11g Installation With ASM and Data Guard Setup
Oracle 11g Installation With ASM and Data Guard Setup
Arun Sharma
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
Tharun Srinivasa
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
NIRMAL FELIX
 
R hive tutorial supplement 1 - Installing Hadoop
R hive tutorial supplement 1 - Installing HadoopR hive tutorial supplement 1 - Installing Hadoop
R hive tutorial supplement 1 - Installing Hadoop
Aiden Seonghak Hong
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorial
Antonios Giannopoulos
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloud
petriojala123
 
Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...
Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...
Nagios Conference 2014 - Mike Weber - Expanding NRDS Capabilities on Linux Sy...
Nagios
 
Ad

More from ShepHertz (15)

ShepHertz Facial recognition based attendance and visitor management system
ShepHertz Facial recognition based attendance and visitor management systemShepHertz Facial recognition based attendance and visitor management system
ShepHertz Facial recognition based attendance and visitor management system
ShepHertz
 
Configure &amp; send push notification on i os device
Configure &amp; send push notification on i os deviceConfigure &amp; send push notification on i os device
Configure &amp; send push notification on i os device
ShepHertz
 
Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...
Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...
Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...
ShepHertz
 
A Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dx
A Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dxA Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dx
A Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dx
ShepHertz
 
Media &amp; entertainment marketing automation and omnichannel media
Media &amp; entertainment marketing automation and omnichannel mediaMedia &amp; entertainment marketing automation and omnichannel media
Media &amp; entertainment marketing automation and omnichannel media
ShepHertz
 
Insurance marketing automation and omni channel insurance.
Insurance marketing automation and omni channel insurance.Insurance marketing automation and omni channel insurance.
Insurance marketing automation and omni channel insurance.
ShepHertz
 
Travel and aviation marketing automation and omnichannel travel
Travel and aviation marketing automation and omnichannel travelTravel and aviation marketing automation and omnichannel travel
Travel and aviation marketing automation and omnichannel travel
ShepHertz
 
Gaming marketing automation and multiplayer game development
Gaming marketing automation and multiplayer game developmentGaming marketing automation and multiplayer game development
Gaming marketing automation and multiplayer game development
ShepHertz
 
Retail marketing automation and omni channel retail experience.
Retail marketing automation and omni channel retail experience.Retail marketing automation and omni channel retail experience.
Retail marketing automation and omni channel retail experience.
ShepHertz
 
Banking Services Marketing Automation and Omni-channel Banking
Banking Services Marketing Automation and Omni-channel BankingBanking Services Marketing Automation and Omni-channel Banking
Banking Services Marketing Automation and Omni-channel Banking
ShepHertz
 
ShepHertz Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for AppsShepHertz Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for Apps
ShepHertz
 
Push Notification with Unity in iOS using App42 Backend
Push Notification with Unity in iOS using App42 BackendPush Notification with Unity in iOS using App42 Backend
Push Notification with Unity in iOS using App42 Backend
ShepHertz
 
ShepHertz - アプリのための万全なエコシステム
ShepHertz - アプリのための万全なエコシステムShepHertz - アプリのための万全なエコシステム
ShepHertz - アプリのための万全なエコシステム
ShepHertz
 
App42 Student Lab - Android Game Dev Series V 0.1
App42 Student Lab - Android Game Dev Series V 0.1App42 Student Lab - Android Game Dev Series V 0.1
App42 Student Lab - Android Game Dev Series V 0.1
ShepHertz
 
ShepHertz - A Complete Cloud Ecosystem for your Apps
ShepHertz - A Complete Cloud Ecosystem for your AppsShepHertz - A Complete Cloud Ecosystem for your Apps
ShepHertz - A Complete Cloud Ecosystem for your Apps
ShepHertz
 
ShepHertz Facial recognition based attendance and visitor management system
ShepHertz Facial recognition based attendance and visitor management systemShepHertz Facial recognition based attendance and visitor management system
ShepHertz Facial recognition based attendance and visitor management system
ShepHertz
 
Configure &amp; send push notification on i os device
Configure &amp; send push notification on i os deviceConfigure &amp; send push notification on i os device
Configure &amp; send push notification on i os device
ShepHertz
 
Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...
Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...
Complete steps to Integrate Push Notification for Your Cocos2dx App with Push...
ShepHertz
 
A Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dx
A Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dxA Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dx
A Complete Tutorial to Develop Real-Time Fighting Game with Cocos2dx
ShepHertz
 
Media &amp; entertainment marketing automation and omnichannel media
Media &amp; entertainment marketing automation and omnichannel mediaMedia &amp; entertainment marketing automation and omnichannel media
Media &amp; entertainment marketing automation and omnichannel media
ShepHertz
 
Insurance marketing automation and omni channel insurance.
Insurance marketing automation and omni channel insurance.Insurance marketing automation and omni channel insurance.
Insurance marketing automation and omni channel insurance.
ShepHertz
 
Travel and aviation marketing automation and omnichannel travel
Travel and aviation marketing automation and omnichannel travelTravel and aviation marketing automation and omnichannel travel
Travel and aviation marketing automation and omnichannel travel
ShepHertz
 
Gaming marketing automation and multiplayer game development
Gaming marketing automation and multiplayer game developmentGaming marketing automation and multiplayer game development
Gaming marketing automation and multiplayer game development
ShepHertz
 
Retail marketing automation and omni channel retail experience.
Retail marketing automation and omni channel retail experience.Retail marketing automation and omni channel retail experience.
Retail marketing automation and omni channel retail experience.
ShepHertz
 
Banking Services Marketing Automation and Omni-channel Banking
Banking Services Marketing Automation and Omni-channel BankingBanking Services Marketing Automation and Omni-channel Banking
Banking Services Marketing Automation and Omni-channel Banking
ShepHertz
 
ShepHertz Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for AppsShepHertz Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for Apps
ShepHertz
 
Push Notification with Unity in iOS using App42 Backend
Push Notification with Unity in iOS using App42 BackendPush Notification with Unity in iOS using App42 Backend
Push Notification with Unity in iOS using App42 Backend
ShepHertz
 
ShepHertz - アプリのための万全なエコシステム
ShepHertz - アプリのための万全なエコシステムShepHertz - アプリのための万全なエコシステム
ShepHertz - アプリのための万全なエコシステム
ShepHertz
 
App42 Student Lab - Android Game Dev Series V 0.1
App42 Student Lab - Android Game Dev Series V 0.1App42 Student Lab - Android Game Dev Series V 0.1
App42 Student Lab - Android Game Dev Series V 0.1
ShepHertz
 
ShepHertz - A Complete Cloud Ecosystem for your Apps
ShepHertz - A Complete Cloud Ecosystem for your AppsShepHertz - A Complete Cloud Ecosystem for your Apps
ShepHertz - A Complete Cloud Ecosystem for your Apps
ShepHertz
 

Recently uploaded (20)

Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 

Configuring MongoDB HA Replica Set on AWS EC2

  • 1. Configuring MongoDB HA Replica Set on AWS EC2
  • 2. Background It has always been a tedious task to choose the right configuration for MongoDB on AWS EC2 Choosing the right configuration in this environment is always challenging and it takes a lots of time to make your system Production Ready.
  • 3. What does it take? All it needs is two machines that will be used as PRIMARY (Master) and SECONDARY (Slave) node and one ARBITER machine for the replica set. However, it might get changed based on your application requirement and you can opt for higher number of nodes based on your need ARBITER is only required in case of even number replica set. If you want to maintain replica set with one PRIMARY and two SECONDARY, ARBITER is not required
  • 4. Hardware Requirement Two 64 bit EC2 instances of medium/large or higher configuration based on your App requirement for PRIMARY and SECONDARY node (There is a data storage limitation of using 32 bit machine and can only support upto 2.5 GB storage) A small 32 bit EC2 machine for MongoDB ARBITER It is recommended – • to have machines in different availability zone to make it High available in-case of a shutdown of one availability zone • to use Ext4 EBS volume to support I/O suspend and write-cache flushing for multi-disk consistent snapshots
  • 5. Installation Steps Create and Launch an EC2 instance of required configuration as stated above for PRIMARY, SECONDARY and ARBITER nodes Create an EBS volume of required size to be used for MongoDB storage for both nodes Connect to EC2 instances on PRIMARY and SECONDARY node via SSH Make an Ext4 file system on both nodes via sudo mkfs -t ext4 /dev/<Created EBS Volume> Create directory /data/db or any other of your own choice and mount it to attached volume using sudo mount -a /dev/< Created EBS Volume > /data/db
  • 6. Contd.. Edit your /etc/fstab to enumerate it on start up of instance using sudo echo ‘/dev/sdf /data/db auto noatime,noexec,nodiratime 0 0’ >> /etc/fstab Download and Install MongoDB on all instances Start the PRIMARY node with following command in MongoDB directory using mongod --rest --replSet myHASet (where myHASet is the name of Replica set; you can choose any name of your choice) Go to Mongo terminal in MongoDB directory. Initialize the set using command rs.initiate() on mongo terminal Check the status of Replica set after initialization using rs.status() command.
  • 7. Contd.. If initialization is success you will see OK in the output something like this { "set" : "sample", "myState" : 1, "members" : [ { "name" : "<PRIMARY_HOSTNAME>:27017", "self" : true } ], "ok" : 1 } You can also check the status on http://<PRIMARY_NODE>:27017/_replSet Your Primary node is ready to use now. You can insert/update document on this node
  • 8. Contd.. Now start the SECONDARY node with same command as on primary mongod --rest --replSet myHASet Tell the PRIMARY node to add SECONDARY node in replica set. Go to mongo console on PRIMARY node and add this using rs.add(“<SECONDARY_HOSTNAME>”); If addition is successful you will see the response Once your SECONDARY node is attached to replica set you can check the status on http://<PRIMARY_NODE>:27017/_replSet Now start the ARBITER node using mongod --rest --replSet myset -oplogSize 8
  • 9. Contd.. Add the ARBITER node in replica set using command rs.add( { _id:2, host:”<ARBITER_HOSTNAME>”, arbiterOnly:true } ) Once ARBITER is added successfully, you are done with the configuration and your replica set is ready to use. Got o http://<PRIMARY_NODE>:27017/_replSet and you should be able to see the status of each node. To test the replica, take down the primary node, and see if SECONDARY is able to pick up and will become PRIMARY node. You can fire the command db.isMaster() to check the status if SECONDARY node has turned up as Master node.
  • 10. Connecting Replica • After you have setup the replica set successfully, you can connect with it using JAVA driver from your client application • You can use the following code snippet for making connection to replica set List addrs = new ArrayList(); addrs.add( new ServerAddress(“<PRIMARY_HOST>",”<MONGO_PORT>" ) ); addrs.add( new ServerAddress(“<SECONDARY_HOST>",“<MONGO_PORT>")); Mongo m = new Mongo(addrs); DB db = m.getDB(“<NAME_OF_DB>"); • MongoDB driver is smart enough to connect to PRIMARY node only, in-case if PRIMARY node is down, it will automatically switch to another node for communication
  • 11. Conclusion Here is an honest attempt to guide you to setup MongoDB on AWS EC2. Though this is an open forum and you all are open to post your comments if I have missed anything Also, if you don’t want to get into setting up the infrastructure and administration for MongoDB, you can directly use our App42 NoSQL Cloud Storage Service. This service can be accessed using our REST API or using native platform SDKs available in different languages like iOS, Android, J2ME, JAVA, PHP, Ruby, Windows Phone and C#
  • 12. Links for Reference : http://www.shephertz.com http://api.shephertz.com http://appwarp.shephertz.com http://app42paas.shephertz.com/ Follow us on: Contact: [email protected] Skype: ShepHertz