大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说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/38029/conf/
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)
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/8237.html