openssl rand 700 -base64 > /home/hdgp-prod/public/mongodb-4.2.23/conf/mongo.key
chmod 600 /home/hdgp-prod/public/mongodb-4.2.23/conf/mongo.key
配置文件加入
security:
keyFile: "/home/hdgp-prod/public/mongodb-4.2.23/conf/mongo.key"
replication:
oplogSizeMB: 500
replSetName: mongodbData
主节点执行
cfg = {_id: 'mongodbData', members: [{_id: 1, host: '192.168.183.189:27017'},{_id: 2, host: '192.168.183.190:27017'},{_id: 3, host: '192.168.183.191:27017', arbiterOnly: true}]}
rs.initiate(cfg)
执行 rs.isMaster() 设置主节点

Comments NOTHING