MongoDB distributed and non-relational databases (1)

Source: Internet
Author: User
I. Prepare the environment 1, download the latest version of mongodb_64 installation package: www. mongodb. orgdownloads2, unzip the installation configuration: # tarzxvfmongodb-linux-x86_64-2.2.3.tgz-Cusrlocal # mvmo

1. Prepare the environment 1. download the latest mongodb_64-bit installation package: mongodb_64.

I. Prepare the environment

1. download the latest mongodb_64-bit installation package:

2. Unzip the installation Configuration:

# Tar zxvf mongodb-linux-x86_64-2.2.3.tgz-C/usr/local/

# Music mongodb-linux-x86_64-2.2.3/mongodb

# Mkdir data_mongo

# Cd data_mongo

# Mkdir config

# Mkdir ku1-zu

# Mkdir ku2-bei

# Mkdir ku3-abr

# Mkdir logs

# Cd ../mongodb/

# Mkdir conf

# Cd conf/

# Touch ku1-zu.conf

# Touch ku2-bei.conf

# Touch ku3-abr.conf

# Touch config. conf

# Touch mongos. conf


[Configuration file on 192.168.10.20]

# Vi ku1-zu.conf

Logpath =/usr/local/data_mongo/logs/ku1.log

Logappend = true

Dbpath =/usr/local/data_mongo/kustmzu

Shardsvr = true

ReplSet = rs1

Bind_ip = 127.0.0.1, 192.168.10.20

MaxConns = 5000

Fork = true

Port = 27011

OplogSize = 1000

Profile = 1

Slowms = 500

Rest = true

Directoryperdb = true

Journal = true

# Vi ku2-bei.conf

Logpath =/usr/local/data_mongo/logs/ku2.log

Logappend = true

Dbpath =/usr/local/data_mongo/ku2_bei

Shardsvr = true

ReplSet = rs2

Bind_ip = 127.0.0.1, 192.168.10.20

MaxConns = 5000

Fork = true

Port = 27013

OplogSize = 1000

Profile = 1

Slowms = 500

Rest = true

Directoryperdb = true

Journal = true

Vi ku3-abr.conf

Logpath =/usr/local/data_mongo/logs/ku3.log

Logappend = true

Dbpath =/usr/local/data_mongo/ku3_abr

Shardsvr = true

ReplSet = rs3

Bind_ip = 127.0.0.1, 192.168.10.20

MaxConns = 5000

Fork = true

Port = 27015

Vi config. conf

Logpath =/usr/local/data_mongo/logs/config. log

Logappend = true

Dbpath =/usr/local/data_mongo/config

Configsvr = true

Bind_ip = 127.0.0.1, 192.168.10.20

Fork = true

Port = 20000

Vi mongos. conf

Configdb = 192.168.10.20: 20000,192.168 .10.21: 20000,192.168 .10.22: 20000

Logpath =/usr/local/data_mongo/logs/mongos. log

Logappend = true

ChunkSize = 10

Fork = true

MaxConns = 6000

Port = 30000

[Configuration file on 192.168.10.21] [config. conf, mongos. conf are almost the same as 10.20]

Vi ku1-abr.conf

Logpath =/usr/local/data_mongo/logs/ku1.log

Logappend = true

Dbpath =/usr/local/data_mongo/kumo-abr

Shardsvr = true

ReplSet = rs1

Bind_ip = 127.0.0.1, 192.168.10.21

MaxConns = 5000

Fork = true

Port = 27011

Vi ku2-zu.conf

Logpath =/usr/local/data_mongo/logs/ku2.log

Logappend = true

Dbpath =/usr/local/data_mongo/ku2_zu

Shardsvr = true

ReplSet = rs2

Bind_ip = 127.0.0.1, 192.168.10.21

MaxConns = 5000

Fork = true

Port = 27013

OplogSize = 1000

Profile = 1

Slowms = 500

Rest = true

Directoryperdb = true

Journal = true

Vi ku3-bei.conf

Logpath =/usr/local/data_mongo/logs/ku3.log

Logappend = true

Dbpath =/usr/local/data_mongo/ku3_bei

Shardsvr = true

ReplSet = rs3

Bind_ip = 127.0.0.1, 192.168.10.21

MaxConns = 5000

Fork = true

Port = 27015

OplogSize = 1000

Profile = 1

Slowms = 500

Rest = true

Directoryperdb = true

Journal = true

[Configuration file on 192.168.10.22] [config. conf, mongos. conf are almost the same as 10.20]

Vi ku1-bei.conf

Logpath =/usr/local/data_mongo/logs/ku1.log

Logappend = true

Dbpath =/usr/local/data_mongo/kustmbei

Shardsvr = true

ReplSet = rs1

Bind_ip = 127.0.0.1, 192.168.10.22

MaxConns = 5000

Fork = true

Port = 27011

OplogSize = 1000

Profile = 1

Slowms = 500

Rest = true

Directoryperdb = true

Journal = true


Vi ku2-abr.conf

Ogpath =/usr/local/data_mongo/logs/ku2.log

Logappend = true

Dbpath =/usr/local/data_mongo/ku2_abr

Shardsvr = true

ReplSet = rs2

Bind_ip = 127.0.0.1, 192.168.10.22

MaxConns = 5000

Fork = true

Port = 27013

Vi ku3-zu.conf

Logpath =/usr/local/data_mongo/logs/ku3.log

Logappend = true

Dbpath =/usr/local/data_mongo/ku3-zu

Shardsvr = true

ReplSet = rs3

Bind_ip = 127.0.0.1, 192.168.10.22

MaxConns = 5000

Fork = true

Port = 27015

OplogSize = 1000

Profile = 1

Slowms = 500

Rest = true

Directoryperdb = true

Journal = true

3. Start: [This is the same as 192.168.10.20 and the other two, but both must start shard, that is, the custom ku1 ku2 ku3, and then start config and mongos]

/Usr/local/mongodb/bin/mongod-f/usr/local/mongodb/conf/ku1-zu.conf

/Usr/local/mongodb/bin/mongod-f/usr/local/mongodb/conf/ku2-bei.conf

/Usr/local/mongodb/bin/mongod-f/usr/local/mongodb/conf/ku3-abr.conf

/Usr/local/mongodb/bin/mongod-f/usr/local/mongodb/conf/config. conf

/Usr/local/mongodb/bin/mongos-f/usr/local/mongodb/conf/mongos. conf

4, 4-1 configure congif and route: [ku1 ku2 ku3 each database group randomly finds a corresponding port for configuration]

For example, in ku1, I initialize the replica set on 192.168.10.20.

#/Usr/local/mongodb/bin/mongo -- port 27011

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.