I'm trying to configure a Replica Set with 2 members in local e 1 member on a cloud-server. I started the two instance from local in this way:
mongod --port 27117 --dbpath mongodb/rs0-0 --logpath mongodb/rs0-0/mongo.log --replSet rs0 --fork
mongod --port 27118 --dbpath mongodb/rs0-1 --logpath mongodb/rs0-1/mongo.log --replSet rs0 --fork
and then I started the instance on my cloud-server (after opened the port):
mongod --port 27119 --dbpath mongoRS/rs0-2 --logpath mongoRS/rs0-2/mongo.log --replSet rs0 --fork
So, I started the server to configure the Replica Set:
mongo --port 27117
rsconf = {
_id: "rs0",
members: [{
_id: 0,
host: "myLocalIP:27117"
}]
}
rs.initiate( rsconf )
rs.add("myLocalIP:27118")
rs.add("myServerIP:27119")
So I tried to do Test Connections in both directions:
from my local's shell:
mongo --host myCloudServer --port 27119
I enter in the server but it's not the Replica Set instance
from cloud-server's shell, it fails:
mongo --host myLocalIP --port 27017
where is the error? Thanks
I take it back about test connections. Both connections from myLocal to remote-myCloud and vice-versa was refused
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.