Chinaunix首页 | 论坛 | 博客
  • 博客访问: 365646
  • 博文数量: 166
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1640
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-05 11:44
个人简介

文章不在长,坚持不懈记录下努力前行的脚步

文章分类

全部博文(166)

文章存档

2017年(19)

2016年(59)

2015年(88)

我的朋友

分类: NOSQL

2017-08-29 18:20:09

Mongo replica set + sharding

架构

角色分配

主机

IP

服务及端口

Server A

10.0.0.6/27

mongod shard1_1:27017

mongod shard2_1:27018

mongod config1:20000

mongs1:30000

Server B

10.0.0.85/27

mongod shard1_2:27017

mongod shard2_2:27018

mongod config2:20000

mongs2:30000

Server C

10.0.0.17/27

mongod shard1_3:27017

mongod shard2_3:27018

mongod config3:20000

mongs3:30000

1 创建数据目录

Server A :

[root@localhost bin]# mkdir -p /data/shard1_1

[root@localhost bin]# mkdir -p /data/shard2_1

[root@localhost bin]# mkdir -p /data/config

Server B :

[root@localhost bin]# mkdir -p /data/shard1_2

[root@localhost bin]# mkdir -p /data/shard2_2

[root@localhost bin]# mkdir -p /data/config

Server C :

[root@localhost bin]# mkdir -p /data/shard1_3

[root@localhost bin]# mkdir -p /data/shard2_3

[root@localhost bin]# mkdir -p /data/config

 

2 配置Replica Sets

2.1 配置shard1所用到的Replica Sets

Server A :

[root@localhost bin]# /Apps/mongo/bin/mongod --shardsvr --replSet shard1 --port 27017

--dbpath /data/shard1_1 --logpath /data/shard1_1/shard1_1.log --logappend --fork

[root@localhost bin]# all output going to: /data/shard1_1/shard1_1.log

forked process: 18923

Server B :

[root@localhost bin]# /Apps/mongo/bin/mongod --shardsvr --replSet shard1 --port 27017

--dbpath /data/shard1_2 --logpath /data/shard1_2/shard1_2.log --logappend --fork

forked process: 18859

[root@localhost bin]# all output going to: /data/shard1_2/shard1_2.log

[root@localhost bin]#

Server C :

[root@localhost bin]# /Apps/mongo/bin/mongod --shardsvr --replSet shard1 --port 27017

--dbpath /data/shard1_3 --logpath /data/shard1_3/shard1_3.log --logappend --fork

all output going to: /data/shard1_3/shard1_3.log

forked process: 18768

[root@localhost bin]#

mongo 连接其中一台机器的27017 端口的mongod,初始化Replica Setsshard1”,执行:

[root@localhost bin]# ./mongo --port 27017

备注:
ERROR: child process failed, exited with error number 1

keyfile文件缺失或生成方式以及文件权限可能有问题
==================================
openssl rand -base64 755 > keyfile
chmod 400 keyfile

阅读(832) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~