MongoDB (iv)--master-Slave construction

Source: Internet
Author: User

1. Enter into the/usr/java, Cd/usr/java

2. New Mongodbmaster-slave,mkdir Mongodbmaster-slave

3. Go to the Mongodbmaster-slave folder, create a new master and slave folder, mkdir master slave

4. Enter the master and slave, create a new data and log file, mkdir data log, enter into data, create a new db file, MkDir db

5. Go to Mongodbmaster-slave, configure temporary environment variables, export path=/usr/java/mongodb/bin: $PATH

6. See if the staging environment variable is configured successfully: Echo $PATH

7. Perform Mongod--help to view help information

 

--master: Specifies the master node;

--slave: Specifies the slave node;

--source: The port that points to the service.

8. Copy the MongoDB configuration file to master and slave:

CP mongodb.conf. /mongodbmaster-slave/master/mongodb.conf

CP mongodb.conf. /mongodbmaster-slave/slave/mongodb.conf

9. Modify the mongodb.conf in master, vim mongodb.conf

dbpath=/usr/java/mongodbmaster-slave/master/data/Dblogpath=/usr/java/mongodbmaster-slave/master/log/ mongodb.loglogappend=trueFork=truebind_ip=192.168.80.128Port =27020Master=truesource=192.168.80.128:27021    # slave IP and port

Modify the paths of DBPath and LogPath, modify bind_ip and port.

MongoDB (iv)--master-Slave construction

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.