MongoDB Master-slave + fragmentation cluster configuration

Source: Internet
Author: User
Tags config mkdir mongodb linux

Sharding One

192.168.100.208

192.168.100.209

192.168.100.210

Tar zxvf mongodb-linux-x86_64-2.2.0.tgz

MV Mongodb-linux-x86_64-2.2.0/usr/local/mongo

192.168.100.208

Mkdir-p/usr/local/mongo/data/shard1_1

Mkdir-p/usr/local/mongo/data/shard2_1

Mkdir-p/usr/local/mongo/conf

Mkdir-p/usr/local/mongo/log

Mongod--shardsvr--replset shard1--port 27017--dbpath=/usr/local/mongo/data/shard1_1--logpath=/usr/local/mongo/ Logshard1_1.log--logappend--fork

192.168.100.209

Mkdir-p/usr/local/mongo/data/shard1_2

Mkdir-p/usr/local/mongo/data/shard2_2

Mkdir-p/usr/local/mongo/conf

Mkdir-p/usr/local/mongo/log

Mongod--shardsvr--replset shard1--port 27017--dbpath=/usr/local/mongo/data/shard1_2--logpath=/usr/local/mongo/ Logshard1_2.log--logappend--fork

192.168.100.210

Mkdir-p/usr/local/mongo/data/shard1_3

Mkdir-p/usr/local/mongo/data/shard2_3

Mkdir-p/usr/local/mongo/conf

Mkdir-p/usr/local/mongo/log

Mongod--shardsvr--replset shard1--port 27017--dbpath=/usr/local/mongo/data/shard1_3--logpath=/usr/local/mongo/ Logshard1_3.log--logappend--fork

#用mongo 27017-Port Mongod connected to one of the machines, initialize replica Sets "Shard1" and execute:

MONGO--port 27017

MongoDB Shell version:2.2.0

Connecting To:127.0.0.1:27017/test

Welcome to the MongoDB shell.

For interactive help, type ' help '.

For more comprehensive documentation

http://docs.mongodb.org/

Questions? Try the Support group

Http://groups.google.com/group/mongodb-user

> config = {_id: ' Shard1 ', Members: [config = {_id: ' Shard1 ', Members: [

... {_id:0, Host: ' 192.168.100.208:27017 '},{_id:0, Host: ' 192.168.100.208:27017 '},

... {_id:1, Host: ' 192.168.100.209:27017 '},{_id:1, Host: ' 192.168.100.209:27017 '},

... {_id:2, Host: ' 192.168.100.210:27017 '}] {_id:2, Host: ' 192.168.100.210:27017 '}]

... }}

{

"_id": "Shard1",

"Members": [

{

"_id": 0,

"Host": "192.168.100.208:27017"

},

{

"_id": 1,

"Host": "192.168.100.209:27017"

},

{

"_id": 2,

"Host": "192.168.100.210:27017"

}

]

}

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.