MongoDB shell version: 3.2.1 connecting to: 172.17.0.2:27017/db 2016-02-08T10:43:40.421+0000 E QUERY [thread1] Error: network error while attempting to run command 'isMaster' on host '172.17.0.2:27017' : [email protected]/mongo/shell/mongo.js:226:14 @(connect):1:6 exception: connect failed
This error is usually caused by attempting to connect without SSL to a MongoDB server that requires it, which is the case on Aptible Deploy.
To solve the issue, connect to your MongoDB server over SSL.
Connection URLs generated by Aptible Deploy include the
ssl=true parameter, which should instruct your MongoDB client to connect over SSL. If your client not connect over SSL despite this parameter, consult its documentation.
Make sure you use a hostname to connect to MongoDB databases when using a database tunnel.
If you use an IP address for the host, certificate verification will fail.
You can work with
--sslAllowInvalidCertificatesin your command line, but using a hostname is simpler and safer.
The MongoDB CLI client does not accept database URLs. Use the following to connect:
mongo --ssl \ --username aptible --password "$PASSWORD" \ --host "$HOST" --port "$PORT"
Updated 6 months ago