MongoDB Cluster Environment storage space vector data

Source: Internet
Author: User

I have previously studied how to build a mongodb environment (see). Considering that the mongodb cluster environment will be used in the future and the multi-bit 32-bit OS environment, I have constructed a mongodb cluster environment. For details about the process, see "sharding with replica set.

In this experiment, four XP machines are built with VMWare 8.0, with IP addresses 192.168.111.11, 192.168.111.12, 192.168.111.13, and 192.168.111.14 in sequence.

Preparation instructions:

1. Three sharding parts, each of which occupies three machines, among which 192.168.111.11 is the primary storage, and 192.168.111.12 and 192.168.111.13 are Replica Sets.
Configsever occupies 192.168.111.11, 192.168.111.12, and 192.168.111.13.
3. One routing node Mongos runs on 192.168.111.14.


The composition of sharding A is: 192.168.111.11: 10000 192.168.111.12: 10001 192.168.111.13: 10002
The composition of sharding B is: 192.168.111.11: 20000 192.168.111.12: 20001 192.168.111.13: 20002
Sharding C consists: 192.168.111.11: 30000 192.168.111.12: 30001 192.168.111.13: 30002
Configsever: 192.168.111.11: 40000 192.168.111.12: 40001 192.168.111.13: 40002
Mongos:192.168.111.14:50000



First, go down to 2.0.2 from the mongodb official website and decompress it to the root directory of the C drive. The four VMS are the same. Therefore, you can deploy them first and then copy them. Create a data folder under the C directory, and create sub-directories A, B, c, and config under the data Directory, which are sharding a to C services in sequence, and the config directory is configsever service.

The following content is the service startup script, which can be executed separately in the bat situation to avoid manual errors when entering a large number of commands in cmd.

Build sharding

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ a -- port 10000 -- shardsvr -- replSet setA -- rest -- oplogSize 64

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ a -- port 10001 -- shardsvr -- replSet setA -- rest -- oplogSize 64

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ a -- port 10002 -- shardsvr -- replSet setA -- rest -- oplogSize 64

Run:

Call cmd.exe 192.168.111.11: 10000/admin
Config = {_ id: 'seta', members: [{_ id: 0, host: '100. 168.111.11: 10000 '}, {_ id: 1, host: '2017. 168.111.12: 10001 '}, {_ id: 2, host: '2017. 168.111.13: 10002 '}]}
Rs. initiate (config)

Build sharding B

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ B -- port 20000 -- shardsvr -- replSet setB -- rest -- oplogSize 64

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ B -- port 20001 -- shardsvr -- replSet setB -- rest -- oplogSize 64

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ B -- port 20002 -- shardsvr -- replSet setB -- rest -- oplogSize 64

Run:

Call cmd.exe 192.168.111.11: 20000/admin
Config = {_ id: 'setb', members: [{_ id: 0, host: '100. 168.111.11: 20000 '}, {_ id: 1, host: '2017. 168.111.12: 20001 '}, {_ id: 2, host: '2017. 168.111.13: 20002 '}]}
Rs. initiate (config)

Build sharding C

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ c -- port 30000 -- shardsvr -- replSet setC -- rest -- oplogSize 64

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ B -- port 30001 -- shardsvr -- replSet setC -- rest -- oplogSize 64

Run:

Mongod.exe -- logappend -- dbpath c: \ data \ c -- port 30002 -- shardsvr -- replSet setC -- rest -- oplogSize 64

Run:

Call cmd.exe 192.168.111.11: 30000/admin
Config = {_ id: 'setb', members: [{_ id: 0, host: '100. 168.111.11: 30000 '}, {_ id: 1, host: '2017. 168.111.12: 30001 '}, {_ id: 2, host: '2017. 168.111.13: 30002 '}]}
Rs. initiate (config)

  • 1
  • 2
  • Next Page

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.