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

Big data distributed memory

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

I. create a directory

1.mkdir-p / home/mongodb/data/master

2.mkdir-p / home/mongodb/data/slaver

3.mkdir-p / home/mongodb/data/arbiter

II. Configuration file

1. Create a master.conf file

# master.conf

Dbpath=/home/mongodb/data/master

Logpath=/home/mongodb/log/master.log

Pidfilepath=/home/mongodb/master.pid

Directoryperdb=true

Logappend=true

ReplSet=testrs

Bind_ip=192.168.1.4

Port=27017

OplogSize=10000

Fork=true

Noprealloc=true

two。 Create an arbiter.conf file

# arbiter.conf

Dbpath=/home/mongodb/data/arbiter

Logpath=/home/mongodb/log/arbiter.log

Pidfilepath=/home/mongodb/arbiter.pid

Directoryperdb=true

Logappend=true

ReplSet=testrs

Bind_ip=192.168.1.12

Port=27017

OplogSize=10000

Fork=true

Noprealloc=true

3. Create a slaver.conf file

# slaver.conf

Dbpath=/home/mongodb/data/slaver

Logpath=/home/mongodb/log/slaver.log

Pidfilepath=/home/mongodb/slaver.pid

Directoryperdb=true

Logappend=true

ReplSet=testrs

Bind_ip=192.168.1.11

Port=27017

OplogSize=10000

Fork=true

Noprealloc=true

III. Start the command

Cd / home/mongodb/bin./mongod-f / home/mongodb/master.conf./mongod-- fork-- dbpath / home/mongodb/db-- logpath / home/mongodb/log/set1.log-- replSet test./mongod-- fork-- dbpath / home/mongodb/db-- logpath / home/mongodb/log/set1.log-- replSet test./mongod-- fork-- dbpath / home/mongodb/db-- logpath / home/mongodb/log/set1.log-- replSet test./mongo 192.168.1.4

four。 Actual combat

1. Engineering configuration

two。 Part of the core code

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

Internet Technology

Wechat

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

12
Report