MongoDB shell version v4.4.14
connecting to : mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
I am on Ubuntu 16.04 and I am basically trying to encrypt data from client to server using TLS/SSL. So, I created a CA file and I am trying to connect to mongodb using that certificate with this command :
However even the command “mongo” gives me this error. I am new to Linux so I do not know how to verify that mongodb is on the right IP and port could you please show step by step ?
Is your mongod up and running on port 27017?
ps -ef|grep mongo or check from service status depending on your install method
Is it running as service or manually started from command line?
In this post : Error: couldn't connect to server 127.0.0.1:27017 - #4 by Stephen_Fuller it says I need to create some directories because me too when I run the command : " netstat -an | grep 27017` " I don’t get any output. But I don’t know what I have to do since it is not stated clearly in the other post
Check your mongod.log for more errors
Cd to your dbpath dir if it exists no need to create first
The command i gave is to connect assuming your mongod is running with no acces control
Since you say your mongod runs on port 27017 please check step by step first whether you can connect without security parms enabled
Shutdown your mongod edit config file and comment the security params.Start mongod and try to connect issuing just mongo
If you can connect then add back tls and other params and investigate why it is not working
This is the actual error I am getting from the logs :
“msg”:“Error receiving request from client. Ending connection from remote”,“attr”:{“error”:{“code”:141,“codeName”:“SSLHandshakeFailed”,“errmsg”:“SSL handshake received but server is started without SSL support”},“remote”:“127.0.0.1:34766”,“connectionId”:4}}
please I stack same error
mongo
MongoDB shell version v4.4.23
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
please provide me with implement command
Thank you in advans