Mongodb-(1) Master-slave

Source: Internet
Author: User

MongoDB Master-Slave construction

--- xudong He (maintenance engineer of a listed company)

With the heart of Thanksgiving, return everyone ( year 7 months )

Directory

MongoDB Master-Slave construction ... 1

Environment Introduction ... 1

Note: ... 1

master server configuration file ... 1

from the server configuration file ... 2

Connection Test ... 2

Primary server for write testing ... 2

View status from server ... 2

Environment Introduction

service / version

Ip address

hostname

MongoDB main /3.0.4

192.168.200.185

Mongodb.1.hxd

MongoDB from /3.0.4

192.168.200.185

Mongodb.2.hxd

Note:

Firewall

SELinux

master server configuration file

[Email protected] run]# cat/etc/mongodb.conf

Port = 27017

DBPath =/usr/local/mongodb/data/

LogPath =/usr/local/mongodb/logs/mongodb.log

Logappend = True

Journal = True

#pidfile =/var/run/mongodb.pid

Fork = True

Master = True

from the server configuration file

[Email protected] ~]# cat/etc/mongodb.conf

Port = 27017

DBPath =/usr/local/mongodb/data/

LogPath =/usr/local/mongodb/logs/mongodb.log

Logappend = True

Journal = True

#pidfile =/var/run/mongodb.pid

Fork = True

Master = True

Connection Test

Mongod-f/etc/mongodb.conf

You can view the mongod–help Help file in detail

Primary server for write testing

Db.test.save ({a:1})

View status from server

> Show DBS;

Local 2.077GB

Test 0.078GB

> Use test

Switched to DB test

> Show Collections;

System.indexes

Test

> Db.test.find ()

{"_id": ObjectId ("55a48bfb03a8ff3c6a51e14d"), "a": 1}


This article from the "Clear Sky" blog, declined reprint!

Mongodb-(1) Master-slave

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.