MSC添加shard节点
1.MSC添加shard节点
mkdir -p /mongodb/38027/conf /mongodb/38027/log /mongodb/38027/data
mkdir -p /mongodb/38028/conf /mongodb/38028/log /mongodb/38028/data
mkdir -p /mongodb/38029/conf /mongodb/38029/log /mongodb/38029/data
cat > /mongodb/38027/conf/mongodb.conf <<EOF
systemLog:
destination: file
path: /mongodb/38027/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38027/data
directoryPerDB: true
#engine: wiredTiger
wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
net:
bindIp: 10.0.0.51,127.0.0.1
port: 38027
replication:
oplogSizeMB: 2048
replSetName: sh3
sharding:
clusterRole: shardsvr
processManagement:
fork: true
EOF
\cp /mongodb/38027/conf/mongodb.conf /mongodb/38028/conf/
\cp /mongodb/38027/conf/mongodb.conf /mongodb/38029/conf/
\cp /mongodb/38027/conf/mongodb.conf /mongodb/38029/conf/
sed ‘s#38027#38028#g’ /mongodb/38028/conf/mongodb.conf -i
sed ‘s#38027#38029#g’ /mongodb/38029/conf/mongodb.conf -i
sed ‘s#38027#38029#g’ /mongodb/38029/conf/mongodb.conf -i
mongod -f /mongodb/38027/conf/mongodb.conf
mongod -f /mongodb/38028/conf/mongodb.conf
mongod -f /mongodb/38029/conf/mongodb.conf
mongo –port 38027 admin
config = {_id: ‘sh3’, members: [
{_id: 0, host: ‘10.0.0.51:38027’},
{_id: 1, host: ‘10.0.0.51:38028’},
{_id: 2, host: ‘10.0.0.51:38029’,”arbiterOnly”:true}]
}
rs.initiate(config)
版权声明:本文为wx1899325原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。