Last active
April 7, 2016 08:54
-
-
Save trungv0/adc1d50c81ffe623443402774f678427 to your computer and use it in GitHub Desktop.
MongoDB Replica
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm --import https://www.mongodb.org/static/pgp/server-3.2.asc | |
cat > /etc/yum.repos.d/mongodb-org-3.2.repo << EOF | |
[mongodb-org-3.2] | |
name=MongoDB Repository | |
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/ | |
gpgcheck=1 | |
enabled=1 | |
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc | |
EOF | |
yum install -y mongodb-org | |
chkconfig mongod on | |
/etc/init.d/mongod start | |
# update mongod config | |
vim /etc/mongod.conf | |
#> bind_ip 0.0.0.0 | |
#> replSet=set | |
# update /etc/hosts so each node can refer to other using hostname | |
# on primary node only | |
mongod | |
#> rs.initiate(); | |
#> rs.conf(); | |
#> rs.add('node-2'); // replace with nodes to be added | |
#> rs.add('node-3'); // replace with nodes to be added |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment