I am using mGo as a driver for my Go Web App to another MongoDB system. So I am not running Mongo on the same system. (URL is not localhost).
However, I get "panic: no reachable servers" error.
Here is the test function that runs right when the Go server starts:
dialInfo, err0 := mgo.ParseURL("mongodb://1234MY456IP:27017,27018")
if err0 != nil {
panic(err0)
}
dialInfo.Direct = true
dialInfo.FailFast = true
session, err := mgo.DialWithInfo(dialInfo)
if err != nil {
panic(err)
}
defer session.Close()
One of the answers in a similar question was to make sure MongoDB is running on netstat
or ps
.
I don't see any processes running on ps except ps and bash. And I don't see it on netstat either.
That being I've ran sudo service mongod start/stop/restart and tested with the mongo shell. What am I doing wrong?
Err0 and err print the same error message.