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

More Related Content

What's hot

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.
 
NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013
NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013
NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013
Amazon Web Services
 
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
 
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
Amazon Web Services
 
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
 
(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014
(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014
(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014
Amazon Web Services
 
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
 

What's hot (20)

Windows Azure Virtual Machines
Windows Azure Virtual MachinesWindows Azure Virtual Machines
Windows Azure Virtual Machines
 
AWS Lambda at JUST EAT
AWS Lambda at JUST EATAWS Lambda at JUST EAT
AWS Lambda at JUST EAT
 
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
 
Solr Performance Monitoring with SPM
Solr Performance Monitoring with SPMSolr Performance Monitoring with SPM
Solr Performance Monitoring with SPM
 
Terraform
TerraformTerraform
Terraform
 
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
 
NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013
NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013
NFS and CIFS Options for AWS (STG401) | AWS re:Invent 2013
 
Erlang scheduler
Erlang schedulerErlang scheduler
Erlang scheduler
 
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
 
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
 
Security features In MySQL 8.0
Security features In MySQL 8.0Security features In MySQL 8.0
Security features In MySQL 8.0
 
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 - 양승도
 
Introduction To Apache Mesos
Introduction To Apache MesosIntroduction To Apache Mesos
Introduction To Apache Mesos
 
ACS & vSphere Draft
ACS & vSphere DraftACS & vSphere Draft
ACS & vSphere Draft
 
Apache Mesos
Apache MesosApache Mesos
Apache Mesos
 
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
 
Docker, Mesos, Spark
Docker, Mesos, Spark Docker, Mesos, Spark
Docker, Mesos, Spark
 
HashiCorp at Just Eat
HashiCorp at Just EatHashiCorp at Just Eat
HashiCorp at Just Eat
 
(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014
(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014
(SDD416) Amazon EBS Deep Dive | AWS re:Invent 2014
 
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
 

Viewers also liked

AWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web ServicesAWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web Services
Amazon Web Services
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
Amazon Web Services
 
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 Enterprise Day | Running Critical Business Applications on AWS
AWS Enterprise Day | Running Critical Business Applications on AWSAWS Enterprise Day | Running Critical Business Applications on AWS
AWS Enterprise Day | Running Critical Business Applications on AWS
Amazon Web Services
 
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
 
From One to Many: Evolving VPC Design
From One to Many: Evolving VPC DesignFrom One to Many: Evolving VPC Design
From One to Many: Evolving VPC Design
Amazon Web Services
 
Incident Coordination Workshop
Incident Coordination WorkshopIncident Coordination Workshop
Incident Coordination Workshop
Amazon Web Services
 
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 CloudTom Laszewski
 
Mastering Access Control Policies
Mastering Access Control PoliciesMastering Access Control Policies
Mastering Access Control Policies
Amazon Web Services
 
Introduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web ServicesIntroduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web Services
Amazon Web Services
 
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 setSudheer 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 MongoDBKishor 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
 

Viewers also liked (20)

AWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web ServicesAWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web Services
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
 
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)
 
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
 
AWS Enterprise Day | Running Critical Business Applications on AWS
AWS Enterprise Day | Running Critical Business Applications on AWSAWS Enterprise Day | Running Critical Business Applications on AWS
AWS Enterprise Day | Running Critical Business Applications on AWS
 
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
 
From One to Many: Evolving VPC Design
From One to Many: Evolving VPC DesignFrom One to Many: Evolving VPC Design
From One to Many: Evolving VPC Design
 
Incident Coordination Workshop
Incident Coordination WorkshopIncident Coordination Workshop
Incident Coordination Workshop
 
AWS Solutions Architect 準備心得
AWS Solutions Architect 準備心得AWS Solutions Architect 準備心得
AWS Solutions Architect 準備心得
 
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
 
Overview of Amazon Web Services
Overview of Amazon Web ServicesOverview of Amazon Web Services
Overview of Amazon Web Services
 
What is AWS?
What is AWS?What is AWS?
What is AWS?
 
Mastering Access Control Policies
Mastering Access Control PoliciesMastering Access Control Policies
Mastering Access Control Policies
 
Introduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web ServicesIntroduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web Services
 
Spring Data MongoDB Webiner
Spring Data MongoDB WebinerSpring Data MongoDB Webiner
Spring Data MongoDB Webiner
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica Sets
 
Setting up mongo replica set
Setting up mongo replica setSetting up mongo replica set
Setting up mongo replica set
 
MongoDB Replica Sets
MongoDB Replica SetsMongoDB Replica Sets
MongoDB Replica Sets
 
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
 
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
 

Similar to Configuring MongoDB HA Replica Set on AWS EC2

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
 
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
 
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 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 ShardingTharun Srinivasa
 
My sql with querys
My sql with querysMy sql with querys
My sql with querysNIRMAL 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 HadoopAiden 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
 

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
 
Mongodb replication
Mongodb replicationMongodb replication
Mongodb replication
 
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
 
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
 
Hadoop on osx
Hadoop on osxHadoop on osx
Hadoop on osx
 
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
 
Sharded cluster tutorial
Sharded cluster tutorialSharded cluster tutorial
Sharded cluster tutorial
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster Tutorial
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
 
Eyeball XMPP Server Administrator Guide
Eyeball XMPP Server Administrator GuideEyeball XMPP Server Administrator Guide
Eyeball XMPP Server Administrator Guide
 
fard car.pptx
fard car.pptxfard car.pptx
fard car.pptx
 
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
 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
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
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorial
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Cloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the CloudCloud Meetup - Automation in the Cloud
Cloud Meetup - Automation in the Cloud
 
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...
 

More from 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
 

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
 
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
 
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...
 
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
 
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
 
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.
 
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
 
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
 
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.
 
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 Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for AppsShepHertz Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for Apps
 
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 - アプリのための万全なエコシステム
 
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 - 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
 

Recently uploaded

Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 

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: sales@shephertz.com Skype: ShepHertz