一, 配置環境:
系統: CentOS 7 x64
tokumx1 ip: 192.168.0.155
tokumx2 ip: 192.168.0.156
tokumx3 ip: 192.168.0.157
二, 部署前準備:
useradd -u 1002 tokumx
tar zxvf tokumx-1.5.1-linux-x86_64-main.tar.gz
mv tokumx-1.5.1-linux-x86_64 /opt/local/tokumx/
mkdir -p /opt/local/tokumx/data/shard
mkdir -p /opt/local/tokumx/data/logs
mkdir -p /opt/local/tokumx/data/config
chown -R tokumx:tokumx /opt/local/tokumx
三, 增加配置檔案
vi /opt/local/tokumx/tokumx.conf
-----------------------------------------------------------------
port=27017
fork=true
logpath=/opt/local/tokumx/data/logs/shard.log
pidfilepath=/opt/local/tokumx/tokumx.pid
logappend=true
dbpath=/opt/local/tokumx/data/shard/
shardsvr=true
directio=true
maxConns=20000
replSet=shard1
oplogSize=5000
cacheSize=8G
expireOplogDays=15
--------------------------------------------------------------------
四, 啟動tokumx 例項
啟動之前需要關閉hugepages:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
/opt/local/tokumx/bin/mongod -f /opt/local/tokumx/tokumx.conf
五, 初始化replica set
/opt/local/tokumx/bin/mongo
config={
"_id" : "shard1",
"members" : [
{"_id" : 0, "host" : "192.168.0.155:27017"},
{"_id" : 1, "host" : "192.168.0.156:27017"},
{"_id" : 2, "host" : "192.168.0.157:27017"}
]
}
rs.initiate(config)
然後檢視叢集執行情況:
rs.status()
固定 主伺服器
cfg = rs.conf()
cfg.members[0].priority = 1
cfg.members[1].priority = 0.5
cfg.members[2].priority = 0.5
rs.reconfig(cfg)