搭建Mongodb集群:分片Sharding+副本集Replica Set

架构图如下:
客户请求: client
路由:Mongs1 Mongs2 Mongs3
40000 40100 402000
配置: config1 config2 config3
config:30000 30100 30200
副本集:
rs1: 27017 27117 27217
rs2: 27018 27118 27218
rs3: 27019 27119 27219

添加windows服务形式启动:
rs1:
sc.exe create MongoDB0 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb0.cfg\"" DisplayName= "MongoDB0" start= "auto"
sc.exe create MongoDB1 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb1.cfg\"" DisplayName= "MongoDB1" start= "auto"
sc.exe create MongoDB2 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb2.cfg\"" DisplayName= "MongoDB2" start= "auto"
sc.exe create config1 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\config1.cfg\"" DisplayName= "config1" start= "auto"


rs2:
sc.exe create MongoDB3 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb3.cfg\"" DisplayName= "MongoDB3" start= "auto"
sc.exe create MongoDB4 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb4.cfg\"" DisplayName= "MongoDB4" start= "auto"
sc.exe create MongoDB5 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb5.cfg\"" DisplayName= "MongoDB5" start= "auto"
sc.exe create config2 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\config2.cfg\"" DisplayName= "config2" start= "auto"


rs3:
sc.exe create MongoDB6 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb6.cfg\"" DisplayName= "MongoDB6" start= "auto"
sc.exe create MongoDB7 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb7.cfg\"" DisplayName= "MongoDB7" start= "auto"
sc.exe create MongoDB8 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\mongodb8.cfg\"" DisplayName= "MongoDB8" start= "auto"
sc.exe create config3 binPath= "\"D:\mongodb\bin\mongod.exe\" --service --config=\"D:\mongodb\db\config3.cfg\"" DisplayName= "config3" start= "auto"


net start MongoDB0
net start MongoDB1
net start MongoDB2
net start MongoDB3
net start MongoDB4
net start MongoDB5
net start MongoDB6
net start MongoDB7
net start MongoDB8
net start config1
net start config2
net start config3
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值