Closed Fallsleep closed 1 year ago
I'm getting in mongodb compass ,how to resolve this though this is not a compass issue
@Fallsleep Sorry, this went under our radar. You probably configured your replica sets to refer to each other using the 127.0.0.1
address, the client (regardless of which MongoDB client you are using) detects that and then tries to connect to that endpoint as well (because it doesn’t know that 127.0.0.1:27017
and 192.168.10.10:27017
refer to the same address).
You can either use directConnection=true
to connect to a single host to work around this, or you could set up a mongos
in front of the replica set and then connect to that.
@harshita-2003 Yeah, that’s probably a separate issue. Most likely, your MongoDB server is not actually running on port 27017; that’s what you’d want to check first.
It worked after start the mongodb from services , thankyou!
Yes, I changed the replica set config to the virtual box host name instead of 127.0.0.1, and add the host name in hosts file, it can work well.
Bug Report
Current Behavior
When I try to connect to the replica set mongodb in
VirtulaBox
,it come intoUnable to connect: connect ECONNREFUSED 127.0.0.1:27017
.connect string:
mongodb://homestead:secret@192.168.10.10:27017,192.168.10.10:27018,192.168.10.10:27019/?authSource=admin&replicaSet=rs0&readPreference=primary&ssl=false
after setting
Port Forwarding
rule inVirtulaBox
, it connect well.I guess there're some bugs with replica set connect code.
Code/Gist
Expected Behavior/Code
Environment
Possible Solution
Additional Context/Screenshots