只是个笔记备忘,看不懂的请划过。

分片名称 分片副本 仲裁
rep1 192.168.3.201:11001,192.168.3.202:11001 192.168.3.213:11001
rep2 192.168.3.202:11002,192.168.3.213:11002 192.168.3.211:11002
rep3 192.168.3.206:11003,192.168.3.211:11003 192.168.3.207:11003
rep4 192.168.3.206:11004,192.168.3.207:11004 192.168.3.201:11004
rep5 192.168.3.202:11005,192.168.3.206:11005 192.168.3.205:11005
rep6 192.168.3.206:11006,192.168.3.211:11006 192.168.3.205:11006
rep7 192.168.3.211:11007,192.168.3.213:11007 192.168.3.205:11007
rep8 192.168.3.213:11008,192.168.3.202:11008 192.168.3.205:11008
rep9 192.168.3.201:11009,192.168.3.207:11009 192.168.3.205:11009
rep10 192.168.3.201:11010,192.168.3.207:11010 192.168.3.205:110010

fre
rs.initiate({_id: ‘rep4’, members: [ {_id: 0, host: ‘192.168.3.206:11004’},{_id: 1, host: ‘192.168.3.207:11004’},{_id: 2, host: ‘192.168.3.201:11004’,”arbiterOnly”:true}]})
rs.initiate({_id: ‘rep5’, members: [ {_id: 0, host: ‘192.168.3.202:11005’},{_id: 1, host: ‘192.168.3.206:11005’},{_id: 2, host: ‘192.168.3.205:11005’,”arbiterOnly”:true}]})
rs.initiate({_id: ‘rep6’, members: [ {_id: 0, host: ‘192.168.3.206:11006’},{_id: 1, host: ‘192.168.3.211:11006’},{_id: 2, host: ‘192.168.3.205:11006’,”arbiterOnly”:true}]})
rs.initiate({_id: ‘rep7’, members: [ {_id: 0, host: ‘192.168.3.211:11007’},{_id: 1, host: ‘192.168.3.213:11007’},{_id: 2, host: ‘192.168.3.205:11007’,”arbiterOnly”:true}]})
rs.initiate({_id: ‘rep8’, members: [ {_id: 0, host: ‘192.168.3.202:11008’},{_id: 1, host: ‘192.168.3.213:11008’},{_id: 2, host: ‘192.168.3.205:11008’,”arbiterOnly”:true}]})
rs.initiate({_id: ‘rep9’, members: [ {_id: 0, host: ‘192.168.3.201:11009’},{_id: 1, host: ‘192.168.3.207:11009’},{_id: 2, host: ‘192.168.3.205:11009’,”arbiterOnly”:true}]})
rs.initiate({_id: ‘rep10’, members: [ {_id: 0, host: ‘192.168.3.201:11010’},{_id: 1, host: ‘192.168.3.207:11010’},{_id: 2, host: ‘192.168.3.205:11010’,”arbiterOnly”:true}]})

db.runCommand( { addshard : “rep4/192.168.3.206:11004,192.168.3.207:11004,192.168.3.201:11004”} )
db.runCommand( { addshard : “rep5/192.168.3.202:11005,192.168.3.206:11005,192.168.3.205:11005”} )
db.runCommand( { addshard : “rep6/192.168.3.206:11006,192.168.3.211:11006,192.168.3.205:11006”} )
db.runCommand( { addshard : “rep7/192.168.3.211:11007,192.168.3.213:11007,192.168.3.205:11007”} )
db.runCommand( { addshard : “rep8/192.168.3.202:11008,192.168.3.213:11008,192.168.3.205:11008”} )
db.runCommand( { addshard : “rep9/192.168.3.201:11009,192.168.3.207:11009,192.168.3.205:11009”} )
db.runCommand( { addshard : “rep10/192.168.3.201:11010,192.168.3.207:11010,192.168.3.205:11010”} )

内核参数
系统优化
yum install -y mongodb-org-server mongodb-org-shell mongodb-org-tools mongodb-org-mongos
依赖包安装 rsync epel mongo-repo
rc.local
if test -f /sys/kernel/mm/transparent_hugepage/khugepaged/defrag; then
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
cd /home/mongodb/
./mongo.sh

!/bin/bash

nohup mongos –bind_ip_all –configdb configs/192.168.3.201:12000,192.168.3.202:12000,192.168.3.213:12000 –port=13000 –logpath=/home/mongodb/logs/mongos.log &
nohup mongod –bind_ip_all –shardsvr –dbpath=/home/mongodb/rep3-3 –replSet rep3 –port 11003 &
nohup mongod –bind_ip_all –shardsvr –dbpath=/home/mongodb/rep4-2 –replSet rep4 –port 11004 &

发表评论

邮箱地址不会被公开。 必填项已用*标注