MongoDB Shard Configuration under Windows

Source: Internet
Author: User

1. Shard Server Settings
Mongod-port 10001-dbpath=f:/dbsoft/mongodb/rs_data/master-directoryperdb--shardsvr-replset RetA--rest--oplogSize 64
Mongod-port 10002-dbpath=f:/dbsoft/mongodb/rs_data/slaver-directoryperdb--shardsvr-replset RetA--rest--oplogSize 64
Mongod-port 10003-dbpath=f:/dbsoft/mongodb/rs_data/arbiter-directoryperdb--shardsvr-replset RetA--rest-- Oplogsize 64

2. Initialization
D:/mongodb-win32-i386-1.8.0/bin>call Mongo.exe 127.0.0.1:10000/admin
MongoDB Shell version:1.8.0
Connecting To:127.0.0.1:10000/admin
> config={_id: "Reta", members:[{"_id": 0,host: "127.0.0.1:10001"},{"_id": 1,host: "127.0.0.1:10002"},{"_id": 2, Host: "127.0.0.1:10003"}]}

{"_id":"setA","members":[{"_id":0,"host":"127.0.0.1:10000"},{"_id":1,"host":"127.0.0.1:10001"},{"_id":2,"host": "127.0.0.1:10002"}]}
setA> rs.initiate(config);

3. Configure Server Settings
Mongod-configsvr-port 20001-dbpath=f:/dbsoft/mongodb/rs_data/set1

4. Routing Server settings
MONGOs--configdb 127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003--port 27017

5. Setting up Shards
>mongo 127.0.0.1:30001/admin
> Db.runcommand ({addshard: "seta/127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003", Name: "Shardseta"})

6. If you need to set up multiple shards
Repeat steps.

MongoDB Shard Configuration under Windows

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.