Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation of mongodb and master-slave synchronization

2025-04-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Check whether there is a yum source.

Yum info mongo-10gen

2. Add yum source

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

Enter the following:

[mongodb]

Name=MongoDBRepository

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

Gpgcheck=0

Enabled=1

3. View the information of mongoDB server package and client package.

Yum infomongo-10gen-server

Yum info mongo-10gen

4. Install the server and client tools of MongoDB

[root@localhostxxx] # yum install mongo-10gen-server

[root@localhostxxx] # yum install mongo-10gen

Or (according to the latest stable version)

Yum install-y mongodb-org

The solution of slow downloading source

Download the rmp package manually and upload it to the corresponding mongodb directory in the server / var/cache/yum

5. Install the php extension

Yum installphp-pecl-mongo

(note: the php-common module cannot be installed before installing php-mongo, otherwise it cannot be installed)

Master-slave synchronization of 6.mongodb

Note: future versions of mongodb2.6 do not support the establishment of local library users, and synchronization of + auth can be done with keyFile.

Generate keyFile:

Openssl rand-base64 753

Save the generated content to the new key file, specify all groups, modify permission to 600, and make a copy to the specified location of the slave.

Master profile:

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 profile:

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

You can see it on the host:

From the plane, you can see:

That means the synchronization is successful.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report