mkdir -p /data/mongo/27017 /data/mongo/27018 /data/mongo/27019 mkdir -p /var/log/mongodb sudo mongod --replSet rs-local-test --dbpath /data/mongo/27017 --port 27017 --logpath /var/log/mongodb/27017.log --fork sudo mongod --replSet rs-local-test --dbpath /data/mongo/27018 --port 27018 --logpath /var/log/mongodb/27018.log --fork sudo mongod --replSet rs-local-test --dbpath /data/mongo/27019 --port 27019 --logpath /var/log/mongodb/27019.log --fork mongostat --host 127.0.0.1 --port 27017 --discover rs.initiate({ "_id":"rs-local-test", "members":[ {"_id":0,"host":"127.0.0.1:27017"}, {"_id":1,"host":"127.0.0.1:27018"}, {"_id":2,"host":"127.0.0.1:27019"} ] })
原文地址:https://www.cnblogs.com/zyxx/p/9557342.html
时间: 2024-10-08 22:00:59