SlideShare a Scribd company logo
1 of 27
Download to read offline
Installing and
Setting up
mongoDB replica
set
PREPARED BY SUDHEER KONDLA
SOLUTIONS ARCHITECT
 If you have multiple virtual machines, bring up VMs that you want to install
mongoDB and set up a replica set.
 The presentation is based on VMs created using VMWare’s ESXi/Vsphere and
RHEL/Oracle Linux.
 This presentation is based on setting up replica set on local machine (Ubuntu
14.14) and
 with 6 VMs in the MongoDB cluster (RedHat Linux).
 Each VM consists of 2 vCPUs and 4 GB of RAM
 Each VM is created with 80 GB of disk space. No special mounts/ file systems are
used.
 Linux version used: 6.5
Bring up VIRTUAL MACHINES
ESXi Hardware configuration
VM Configuration
Installing mongdb
 The following steps guide you through installing mongodb software on Linux.
 set yum repository and download packages using yum package installer.
 [root@bigdata1 ~]# cd /etc/yum.repos.d/
 [root@bigdata1 yum.repos.d]# ls -l
 -rw-r--r-- 1 root root 122 Dec 17 20:50 mongodb.repo
 [root@bigdata1 yum.repos.d]# scp mongodb.repo
bigdata6:/etc/yum.repos.d/
 Before you run “yum install”, be sure to check internet is working.
 [root@bigdata6 yum.repos.d]# yum install -y mongodb-org-2.6.1 mongodb-
org-server-2.6.1 mongodb-org-shell-2.6.1 mongodb-org-mongos-2.6.1
mongodb-org-tools-2.6.1
Create yum repository for mongodb
Yum Install mongodb
Yum Install mongodb
Setting up mongodb
 Make sure to create /data/configdb and /data/db directories on each
servers
 The above directories should be owned by mongod user and mongod group.
 Change ownership to mongod
 As a root user run “chown mongod:mongod /data/configdb” and “chown
mongod:mongod /data/db”
 Without above directories mongod process will not start
 When you start mongo daemon process it will create
“/data/configdb/mongod.lock” file
 You can also start mongod process with service option as root. For example
“service mongod start”
 You can also configure mongo daemon to start at system boot.
Creating a replica set
 This procedure describes deploying a replica set in a development or test environment.
 Three member replica sets provide enough redundancy to survive most network partitions and
other system failures.
 These sets also have sufficient capacity for many distributed read operations.
 Replica sets should always have an odd number of members.
 This ensures that elections will proceed smoothly.
 Before you can deploy a replica set, you must install MongoDB on each system that will be part of
yourreplica set.
 For test and development systems, you can run your mongod instances on a local system.
 The examples in this procedure create a new replica set named rs0.
 If your application connects to more than one replica set, each set should have a distinct name.
 Some drivers group replica set connections by replica set name.
Setting up local replica sets
 Make 3 directories to set up 3 replicas on local node.
 mkdir -p /data/mongodb/rs0-0 /data/mongodb/rs0-1 /data/mongodb/rs0-2
 Start 3 mongo daemons on local node with 3 different available ports.
 mongod --port 27017 --dbpath /data/mongodb/rs0-0 --replSet rs0 --smallfiles --
oplogSize 128
 mongod --port 27018 --dbpath /data/mongodb/rs0-1 --replSet rs0 --smallfiles --
oplogSize 128
 mongod --port 27019 --dbpath /data/mongodb/rs0-2 --replSet rs0 --smallfiles --
oplogSize 128
 Check the mongo daemons running with “ps –ef|grep mongo” command
Initialize and add replica sets on local node. Connect to first mongo process and initialize mongoDB replica.
hadoop@hadoop:~/admin$ mongo --port 27017
MongoDB shell version: 2.6.4
connecting to: 127.0.0.1:27017/test
> rs.initiate()
{
"info2" : "no configuration explicitly specified -- making one",
"me" : "hadoop:27017",
"info" : "Config now saved locally. Should come online in about a minute.",
"ok" : 1
}
> rs.conf()
{
"_id" : "rs0",
"version" : 1,
"members" : [
{
"_id" : 0,
"host" : "hadoop:27017"
}
]
}
Adding replicas
 rs0:PRIMARY> rs.add("hadoop:27018")
 { "ok" : 1 }
 rs0:PRIMARY> rs.add("hadoop:27019")
 { "ok" : 1 }
Replica status
Connect to local replicas
Setting 3 node mongo replica
 Install mongodb software on all nodes in the cluster.
 Start mongod, mongoes and config servers on all nodes.
Add replica sets on other nodes
Primary and Secondary replica
Connections to Primary replica sets
Connections secondary replica set
CRUD operations on replica sets
Reading from secondary replica
Setting up and Working with MMS
 Mongo Management Service (MMS ) automates , monitors, admisters your mongo
instances.
 Compatible with mongoDB version 2.4 or later.
 To use Automation, you must have an agent running on every host where a managed
MongoDB instance runs.
 Agents do not transmit any data from a MongoDB deployment. The agents only
communicate cluster configuration information
 You can configure all MongoDB deployment types, including standalones, replica sets,
and sharded clusters. You can also configure replica set-member types, such as arbiter,
hidden, and delayed secondary, and can configure replica set options, such as priority
level.
 You can deploy MongoDB to Amazon Web Services (AWS).
 MMS Monitoring will scale its request cycle to limit more expensive statistics gathering. The
DB Stats information updates every 10 minutes, and the agent will throttle the frequency
to reduce the impact on the database
 MMS Backup creates backups of MongoDB replica sets and sharded clusters.
Configure Monitor and Backup Agents
MMS Deployment Page
Monitor MongoDB server with MMS

More Related Content

What's hot

MongoDB Database Replication
MongoDB Database ReplicationMongoDB Database Replication
MongoDB Database ReplicationMehdi Valikhani
 
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...ronwarshawsky
 
On MongoDB backup
On MongoDB backupOn MongoDB backup
On MongoDB backupWilliam Yeh
 
Keeping your files safe in the post-Snowden era with SXFS
Keeping your files safe in the post-Snowden era with SXFSKeeping your files safe in the post-Snowden era with SXFS
Keeping your files safe in the post-Snowden era with SXFSRobert Wojciechowski
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisationgrooverdan
 
Pgbr 2013 postgres on aws
Pgbr 2013   postgres on awsPgbr 2013   postgres on aws
Pgbr 2013 postgres on awsEmanuel Calvo
 
REDIS intro and how to use redis
REDIS intro and how to use redisREDIS intro and how to use redis
REDIS intro and how to use redisKris Jeong
 
MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016Dave Stokes
 
High Performance Wordpress
High Performance WordpressHigh Performance Wordpress
High Performance WordpressGareth Davies
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaYoungHeon (Roy) Kim
 
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 KLGareth Davies
 
Mysql data replication
Mysql data replicationMysql data replication
Mysql data replicationTuấn Ngô
 
MySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkMySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkLouis liu
 
How (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureHow (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureMiklos Szel
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitRedis Labs
 
Introduction of mesos persistent storage
Introduction of mesos persistent storageIntroduction of mesos persistent storage
Introduction of mesos persistent storageZhou Weitao
 

What's hot (20)

MongoDB Database Replication
MongoDB Database ReplicationMongoDB Database Replication
MongoDB Database Replication
 
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
 
On MongoDB backup
On MongoDB backupOn MongoDB backup
On MongoDB backup
 
Keeping your files safe in the post-Snowden era with SXFS
Keeping your files safe in the post-Snowden era with SXFSKeeping your files safe in the post-Snowden era with SXFS
Keeping your files safe in the post-Snowden era with SXFS
 
Containers > VMs
Containers > VMsContainers > VMs
Containers > VMs
 
Haproxy - zastosowania
Haproxy - zastosowaniaHaproxy - zastosowania
Haproxy - zastosowania
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisation
 
Pgbr 2013 postgres on aws
Pgbr 2013   postgres on awsPgbr 2013   postgres on aws
Pgbr 2013 postgres on aws
 
REDIS intro and how to use redis
REDIS intro and how to use redisREDIS intro and how to use redis
REDIS intro and how to use redis
 
Tuning Linux for MongoDB
Tuning Linux for MongoDBTuning Linux for MongoDB
Tuning Linux for MongoDB
 
MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016
 
High Performance Wordpress
High Performance WordpressHigh Performance Wordpress
High Performance Wordpress
 
Puppet
PuppetPuppet
Puppet
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & Grafana
 
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
 
Mysql data replication
Mysql data replicationMysql data replication
Mysql data replication
 
MySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkMySQL Tokudb engine benchmark
MySQL Tokudb engine benchmark
 
How (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureHow (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructure
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbit
 
Introduction of mesos persistent storage
Introduction of mesos persistent storageIntroduction of mesos persistent storage
Introduction of mesos persistent storage
 

Viewers also liked

MongoDB Replica Sets
MongoDB Replica SetsMongoDB Replica Sets
MongoDB Replica SetsMongoDB
 
Lightning Talk: What You Need to Know Before You Shard in 20 Minutes
Lightning Talk: What You Need to Know Before You Shard in 20 MinutesLightning Talk: What You Need to Know Before You Shard in 20 Minutes
Lightning Talk: What You Need to Know Before You Shard in 20 MinutesMongoDB
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDBMongoDB
 
Spring Data MongoDB Webiner
Spring Data MongoDB WebinerSpring Data MongoDB Webiner
Spring Data MongoDB WebinerHakan Özler
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica SetsMongoDB
 
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
 
MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)MongoSF
 
Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2ShepHertz
 
MongoDB Administration 101
MongoDB Administration 101MongoDB Administration 101
MongoDB Administration 101MongoDB
 
Everything You Need to Know About Sharding
Everything You Need to Know About ShardingEverything You Need to Know About Sharding
Everything You Need to Know About ShardingMongoDB
 
Back to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica SetsBack to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica SetsMongoDB
 

Viewers also liked (12)

MongoDB Replica Sets
MongoDB Replica SetsMongoDB Replica Sets
MongoDB Replica Sets
 
Lightning Talk: What You Need to Know Before You Shard in 20 Minutes
Lightning Talk: What You Need to Know Before You Shard in 20 MinutesLightning Talk: What You Need to Know Before You Shard in 20 Minutes
Lightning Talk: What You Need to Know Before You Shard in 20 Minutes
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 
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
 
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
 
MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)
 
Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2
 
MongoDB Administration 101
MongoDB Administration 101MongoDB Administration 101
MongoDB Administration 101
 
Everything You Need to Know About Sharding
Everything You Need to Know About ShardingEverything You Need to Know About Sharding
Everything You Need to Know About Sharding
 
Back to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica SetsBack to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica Sets
 

Similar to Install and Set Up a MongoDB Replica Set

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 minutesSudheer Kondla
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
 
Introducing with MongoDB
Introducing with MongoDBIntroducing with MongoDB
Introducing with MongoDBMahbub Tito
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefMatt Ray
 
Install websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bitsInstall websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bitsManuel Vega
 
MongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialMongoDB - Sharded Cluster Tutorial
MongoDB - Sharded Cluster TutorialJason 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 2017Antonios Giannopoulos
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & IntroductionJerwin Roy
 
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 EC2benjaminwootton
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Install nagios
Install nagiosInstall nagios
Install nagioshassandb
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guidePhilip Zhong
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleChanaka Lasantha
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and ShardingTharun Srinivasa
 

Similar to Install and Set Up a MongoDB Replica Set (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
 
Hadoop on osx
Hadoop on osxHadoop on osx
Hadoop on osx
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Introducing with MongoDB
Introducing with MongoDBIntroducing with MongoDB
Introducing with MongoDB
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
Install websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bitsInstall websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bits
 
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 – 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
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
 
zLAMP
zLAMPzLAMP
zLAMP
 
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
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Install nagios
Install nagiosInstall nagios
Install nagios
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guide
 
grate techniques
grate techniquesgrate techniques
grate techniques
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmaple
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
 

More from Sudheer Kondla

MongoDB cluster_on_aws_example
MongoDB cluster_on_aws_exampleMongoDB cluster_on_aws_example
MongoDB cluster_on_aws_exampleSudheer Kondla
 
AWS multi-region DB design and deployment
AWS multi-region DB design and deploymentAWS multi-region DB design and deployment
AWS multi-region DB design and deploymentSudheer Kondla
 
Data platform architecture
Data platform architectureData platform architecture
Data platform architectureSudheer Kondla
 
Digital transformation is not about technology
Digital transformation is not about technologyDigital transformation is not about technology
Digital transformation is not about technologySudheer Kondla
 
Cloudera cluster setup and configuration
Cloudera cluster setup and configurationCloudera cluster setup and configuration
Cloudera cluster setup and configurationSudheer Kondla
 

More from Sudheer Kondla (7)

MongoDB cluster_on_aws_example
MongoDB cluster_on_aws_exampleMongoDB cluster_on_aws_example
MongoDB cluster_on_aws_example
 
No sql
No sqlNo sql
No sql
 
AWS multi-region DB design and deployment
AWS multi-region DB design and deploymentAWS multi-region DB design and deployment
AWS multi-region DB design and deployment
 
Aws aurora scaling
Aws aurora scalingAws aurora scaling
Aws aurora scaling
 
Data platform architecture
Data platform architectureData platform architecture
Data platform architecture
 
Digital transformation is not about technology
Digital transformation is not about technologyDigital transformation is not about technology
Digital transformation is not about technology
 
Cloudera cluster setup and configuration
Cloudera cluster setup and configurationCloudera cluster setup and configuration
Cloudera cluster setup and configuration
 

Install and Set Up a MongoDB Replica Set

  • 1. Installing and Setting up mongoDB replica set PREPARED BY SUDHEER KONDLA SOLUTIONS ARCHITECT
  • 2.  If you have multiple virtual machines, bring up VMs that you want to install mongoDB and set up a replica set.  The presentation is based on VMs created using VMWare’s ESXi/Vsphere and RHEL/Oracle Linux.  This presentation is based on setting up replica set on local machine (Ubuntu 14.14) and  with 6 VMs in the MongoDB cluster (RedHat Linux).  Each VM consists of 2 vCPUs and 4 GB of RAM  Each VM is created with 80 GB of disk space. No special mounts/ file systems are used.  Linux version used: 6.5
  • 3. Bring up VIRTUAL MACHINES
  • 6. Installing mongdb  The following steps guide you through installing mongodb software on Linux.  set yum repository and download packages using yum package installer.  [root@bigdata1 ~]# cd /etc/yum.repos.d/  [root@bigdata1 yum.repos.d]# ls -l  -rw-r--r-- 1 root root 122 Dec 17 20:50 mongodb.repo  [root@bigdata1 yum.repos.d]# scp mongodb.repo bigdata6:/etc/yum.repos.d/  Before you run “yum install”, be sure to check internet is working.  [root@bigdata6 yum.repos.d]# yum install -y mongodb-org-2.6.1 mongodb- org-server-2.6.1 mongodb-org-shell-2.6.1 mongodb-org-mongos-2.6.1 mongodb-org-tools-2.6.1
  • 7. Create yum repository for mongodb
  • 10. Setting up mongodb  Make sure to create /data/configdb and /data/db directories on each servers  The above directories should be owned by mongod user and mongod group.  Change ownership to mongod  As a root user run “chown mongod:mongod /data/configdb” and “chown mongod:mongod /data/db”  Without above directories mongod process will not start  When you start mongo daemon process it will create “/data/configdb/mongod.lock” file  You can also start mongod process with service option as root. For example “service mongod start”  You can also configure mongo daemon to start at system boot.
  • 11. Creating a replica set  This procedure describes deploying a replica set in a development or test environment.  Three member replica sets provide enough redundancy to survive most network partitions and other system failures.  These sets also have sufficient capacity for many distributed read operations.  Replica sets should always have an odd number of members.  This ensures that elections will proceed smoothly.  Before you can deploy a replica set, you must install MongoDB on each system that will be part of yourreplica set.  For test and development systems, you can run your mongod instances on a local system.  The examples in this procedure create a new replica set named rs0.  If your application connects to more than one replica set, each set should have a distinct name.  Some drivers group replica set connections by replica set name.
  • 12. Setting up local replica sets  Make 3 directories to set up 3 replicas on local node.  mkdir -p /data/mongodb/rs0-0 /data/mongodb/rs0-1 /data/mongodb/rs0-2  Start 3 mongo daemons on local node with 3 different available ports.  mongod --port 27017 --dbpath /data/mongodb/rs0-0 --replSet rs0 --smallfiles -- oplogSize 128  mongod --port 27018 --dbpath /data/mongodb/rs0-1 --replSet rs0 --smallfiles -- oplogSize 128  mongod --port 27019 --dbpath /data/mongodb/rs0-2 --replSet rs0 --smallfiles -- oplogSize 128  Check the mongo daemons running with “ps –ef|grep mongo” command
  • 13. Initialize and add replica sets on local node. Connect to first mongo process and initialize mongoDB replica. hadoop@hadoop:~/admin$ mongo --port 27017 MongoDB shell version: 2.6.4 connecting to: 127.0.0.1:27017/test > rs.initiate() { "info2" : "no configuration explicitly specified -- making one", "me" : "hadoop:27017", "info" : "Config now saved locally. Should come online in about a minute.", "ok" : 1 } > rs.conf() { "_id" : "rs0", "version" : 1, "members" : [ { "_id" : 0, "host" : "hadoop:27017" } ] }
  • 14. Adding replicas  rs0:PRIMARY> rs.add("hadoop:27018")  { "ok" : 1 }  rs0:PRIMARY> rs.add("hadoop:27019")  { "ok" : 1 }
  • 16. Connect to local replicas
  • 17. Setting 3 node mongo replica  Install mongodb software on all nodes in the cluster.  Start mongod, mongoes and config servers on all nodes.
  • 18. Add replica sets on other nodes
  • 20. Connections to Primary replica sets
  • 22. CRUD operations on replica sets
  • 24. Setting up and Working with MMS  Mongo Management Service (MMS ) automates , monitors, admisters your mongo instances.  Compatible with mongoDB version 2.4 or later.  To use Automation, you must have an agent running on every host where a managed MongoDB instance runs.  Agents do not transmit any data from a MongoDB deployment. The agents only communicate cluster configuration information  You can configure all MongoDB deployment types, including standalones, replica sets, and sharded clusters. You can also configure replica set-member types, such as arbiter, hidden, and delayed secondary, and can configure replica set options, such as priority level.  You can deploy MongoDB to Amazon Web Services (AWS).  MMS Monitoring will scale its request cycle to limit more expensive statistics gathering. The DB Stats information updates every 10 minutes, and the agent will throttle the frequency to reduce the impact on the database  MMS Backup creates backups of MongoDB replica sets and sharded clusters.
  • 25. Configure Monitor and Backup Agents