MongoDB installation and master-slave synchronization

Source: Internet
Author: User

1 , check if there is Yum Source

Yum Info Mongo-10gen

2 , add Yum Source

Vi/etc/yum.repos.d/mongodb.repo

Enter the following content:

[MongoDB]

Name=mongodbrepository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/

Gpgcheck=0

Enabled=1

3 , view MongoDB information about the server package and the information about the client package

Yum Infomongo-10gen-server

Yum Info Mongo-10gen

4 , installation MongoDB server-side and client Tools  

[Email protected]]# yum Install Mongo-10gen-server

[Email protected]]# yum Install Mongo-10gen

or (according to the latest stable version)

Yum Install-y mongodb-org

Download a solution with slow source speed

Download Manual Download RMP package, upload to server /var/cache/yum in the corresponding MongoDB directory under

5. Install PHP extensions

Yum Installphp-pecl-mongo

(Note: Install Php-mongo I can't pretend before . Php-common module, otherwise cannot be installed);

6.mongodb master-Slave synchronization

Note:mongodb2.6 later version does not support the local Library to establish the user,+auth synchronization can be used the keyfile .

Produce keyfile :

OpenSSL rand-base64 753

Save the generated content to the newly created Key file, specify all groups, modify permissions to - , while copying a copy to the specified location from.

Master configuration file:

Vi/etc/mongod.conf

Keyfile=/mnt/mongod/key

#bind_ip

Start:

Mongod-dbpath/mnt/mongod/db-logpath/mnt/mongod/log/mongod.log-master-f/etc/mongod.conf

From the configuration file:

Vi/etc/mongod.conf

keyfile=/Mongod/key

#bind_ip

Start:

mongod-dbpath/mongod/db/-logpath/mongod/log/mongod.log-slave-source 115.28.245.30-f/etc/mongod.conf

On the host, you can see:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/57/AF/wKioL1SiY9TgrvAVAAC5Nx8v6GI721.jpg "title=" QQ picture 0.png "alt=" Wkiol1siy9tgrvavaac5nx8v6gi721.jpg "/>

From the machine you can see:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/57/B2/wKiom1SiYy7RpIceAAFh4rv-UZQ671.jpg "title=" QQ picture 4.png "alt=" Wkiom1siyy7rpiceaafh4rv-uzq671.jpg "/>

This indicates that the synchronization is successful.


MongoDB installation and master-slave synchronization

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.