lipon#lipon-K43U:/$ mongo
MongoDB shell version: 2.2.0
connecting to: test
Thu Oct 11 11:46:53 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
lipon#lipon-K43U:/$
Related
I seem to get this error when I launched mongo
MongoDB shell version v4.4.2
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 did do the following:
Delete the mongod.lock file
Restart computer
Installed Mongodb a few weeks ago and worked fine with it until today
This happens when I want to start:
PS C:\mongodb> mongo
MongoDB shell version v4.2.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-05-16T15:30:35.754+0200 E QUERY [js] 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 ::
A connection could not be established because the target computer refused to connect. :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2020-05-16T15:30:35.761+0200 F - [main] exception: connect failed
2020-05-16T15:30:35.761+0200 E - [main] exiting with code 1
PS C:\mongodb>
What can I do to make the connection possible again?
Thanks for a hint.
I've been told by my professor to use linux to install nodejs, expressjs, and mongoDB. I've installed mongodb from the terminal, but when I try to execute the command "mongo", I get this:
MongoDB shell version: 2.6.10
connecting to: test
2018-01-20T11:58:05.602-0500 warning: Failed to connect to
127.0.0.1:27017, reason: errno:111 Connection refused
2018-01-20T11:57:05.603-0500 Error: couldn't connect to server
127.0.0.1:27017 (127.0.0.1), connection attempt failed at
src/mongo/shell/mongo.js:146
exception: connect failed
MongoDB shell version v3.4.1
connecting to: mongodb://127.0.0.1:27017
2017-12-06T12:16:58.540+0530 W NETWORK [main] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-06T12:16:58.540+0530 E QUERY [main] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:234:13
#(connect):1:6
exception: connect failed
You need to first start mongo server at port 27017.
You can do it by executing following command:
mongod --port 27017 --dbpath [database_path]
I have a replicaset where there is one primary and two secondary nodes.
Once in a while I am not able to connect to primary and i get this error which goes away after a minute or so and I am able to connect. Any thoughts why this could be happening ?
When this error happens I tried connecting to secondary and did rs.status which said
primary is still same server and running ok.
Below is the command text from the console that shows the issue.
mongo --host <hostname> --port 27017
MongoDB shell version: 2.2.2
connecting to: <hostname>:27017/test
Sat Mar 2 14:54:02 DBClientCursor::init call() failed
Sat Mar 2 14:54:02 Error: Error during mongo startup. :: caused by :: 10276 DBClientBase::findN: transport error: <hostname>:27017 ns: admin.$cmd query: { whatsmyuri: 1 } src/mongo/shell/mongo.js:93
exception: connect failed
mongo --host <hostname> --port 27017
MongoDB shell version: 2.2.2
connecting to: <hostname>:27017/test
rs0:PRIMARY>