Mongo and mongod command shows error in macos - mongodb

When I run mongod the following error shows:
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

Related

Error :couldn't connect to server 127.0.0.1:27017, connection attempt failed: NetworkTimeout Error connecting caused by Socket operation timed out

MongoDB shell version v4.4.6
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: NetworkTimeout: Error connecting to 127.0.0.1:27017 :: caused by :: Socket operation timed out :
connect#src/mongo/shell/mongo.js:374:17
#(connect):2:6
exception: connect failed
exiting with code 1
Everytime when I run mongo command , it says error connecting to 127.0.0.1:27017 caused by socket opeartion timed out.
Tried following many instructions given by peers , but it didn't work.
Hope I get rid of this by your instructions.
Thanks!
Reason: mongodb service is not running
Run mongodb service method:
Open the terminal and execute mongod -dbpath "D:\Program Files\MongoDB\data\db"
("D:\Program Files\MongoDB\data\db" is the directory you created to store data)
Open another terminal and execute mongo

MongoDB refused to connect

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

MongoDB: Error: couldn't connect to server 127.0.0.1:27017

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.

Connection attempt failed: SocketException: Error connecting to mongodb Error

I deployed the mongodb on my GCP Compute Engine using the bitnami, but my mongodb it's not starting after a restart of my GCP machine, getting the following error:
MongoDB shell version v4.0.6
connecting to: mongodb://ip:27017/admin?gssapiServiceName=mongodb
2019-04-02T10:22:05.815+0000 E QUERY [js] Error: couldn't connect
to server ip:27017, connection attempt failed: SocketException:
Error connecting to ip:27017
:: caused by :: Connection timed out :
connect#src/mongo/shell/mongo.js:343:13
#(connect):1:6
exception: connect failed

Mongo errno:111 Connection refused (ubuntu)?

my mongod service is unable to start i try all the solution available i tried following commands
sudo rm /var/lib/mongod/mongod.lock
sudo service mongod start
sudo service mongod restart
but still get the following error :-
MongoDB shell version: 3.2.19
connecting to: test
2018-07-23T04:49:02.322+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2018-07-23T04:49:02.322+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed