Mongodb Replica Set Cluster _mongodb

Source: Internet
Author: User
Tags mongodb

[Test@localhost mongodb-replica]$ TAR-ZXVF mongodb-linux-x86_64-3.0.5.tgz

[Test@localhost mongodb-replica]$ MV mongodb-linux-x86_64-3.0.5 Mongodb-replica

[Test@localhost mongodb-replica]$ pwd

/home/zhaohongyong/install/mongodb-replica

[Test@localhost mongodb-replica]$ mkdir log data

[Test@localhost mongodb-replica]$ Touch start.sh

[Test@localhost mongodb-replica]$ VI start.sh

#!/bin/sh
echo ' Start reboot MONGO '
# nohup/bin/mongod--port=27017--dbpath data/--logpath Log/mongodb.log &
Nohup./bin/mongod--replset repset--port=27018--dbpath data/--logpath Log/mongodb.log &


Echo ' started MONGO '
~

[Test@localhost mongodb-replica]$ sh start.sh #启动

There are at least three machines configured above, login on any MongoDB instance, enter Admin library, execute config command:

Use admin

Config = {_id: "Repset", members:[
{_id:0,host: "172.16.2.132:27017"},
{_id:1,host: "172.16.2.133:27018"},
{_id:2,host: "172.16.2.134:27017"}]
}
Rs.initiate (config);


http://blog.csdn.net/mchdba/article/details/51638131













Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.