Just installed mongodb cant connect to server on Ubuntu 22.04 - linux

I just completed an installation of mongodb in my computer and, after starting and enabling it I keep getting the same error:
MongoDB shell version v4.2.23
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2022-11-10T16:25:32.787+0100 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 :: Connection refused :
connect#src/mongo/shell/mongo.js:353:17
#(connect):2:6
2022-11-10T16:25:32.788+0100 F - [main] exception: connect failed
2022-11-10T16:25:32.788+0100 E - [main] exiting with code 1
I uninstalled and installed multiple times and tried solutions that worked for other people in similar posts but I can not make it work.
I have a feeling it have something to do with the port it is looking for (27017) but I do not know how to check if that is the problem and, if so, how to fix it.
Thanks!

Here are a few things to consider:
Check if the MongoDB process is running (you can verify using ps, netstat (check listen port) command in the server.
See if your MongoDB service runs locally. That is because by default, the listen address of MongoDB is localhost/loopback.
Check if the firewall is running and you have allowed the port.
Verify if you are able to use telnet to command the port 27017 from the application server.

Related

mongodb suddenly stopped working on production server

I have a server running node and mongoDB. Mongo is suddenly throwing errors, I managed to get it started upon rebooting the server but the error reappears upon trying to handle a request.
The error when I try to run mongo in a shell is:
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: 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
My mongod.conf has the correct data path and I also tried setting it manually using mongod --dbpath and can confirm that it is correct.
mongod --repair doesn't work either.
Any ideas?
Turns out the server was out of storage. Running df showed that there was no disk space left.
I ended up adding a volume and moving my database and files there.

Virtuoso connection failed

I have virtuoso 6.1 in ubuntu. I was loading a dbpedia RDF but the server where virtuoso is setup disconnected while doing it, giving me this error:
Error 08S01: [Virtuoso Driver]CL065: Lost connection to server at line
2 of Top-Level: rdf_loader_run()
Since then I only get this error:
Error S2801: [Virtuoso Driver]CL033: Connect failed to localhost:1111
= localhost:1111.
I tried to kill virtuoso and restart it but nothing changes, I also tried changing the port but it still tries to connect to port 1111, and when I specify the new port it gives me the same message. Does anyone knows how to solve this issue?

Error while making connection on oracle sql developer using linux OS

I am trying to make a new connection on oracle sqldeveloper as sysdba and when i hit test or connect i got this error message:
Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection
The default port is 1521, but 1522 is often common.
Check if the database is up. database will not be up causing this issue.
or Check if you are able to connect using sqlplus

MongoError: js:237:13 connect failed [localhost:27017]

I would like to install Mongodb on IntelliJ (already with Angular and Node.js). I installed MongoDB and changed my environment variables. I use Windows 10. When I try the command line : "mongo dbs show", I get this error :
MongoDB shell version v3.4.10 connecting to:
mongodb://127.0.0.1:27017/dbs 2017-11-20T16:59:43.003+0100 W NETWORK
[thread1] Failed to connect to 127.0.0.1:27017 after 5000ms
milliseconds, giving up. 2017-11-20T16:59:43.003+0100 E QUERY
[thread1] Error: couldn't connect to server 127.0.0.1:27017,
connection attempt failed : connect#src/mongo/shell/mongo.js:237:13
#(connect):1:6 exception: connect failed
In order to fix it, I tried the instructions of related posts, that is to say :
-Create a data directory in "MongoDB\Server\3.4\data"
-Change the directoy "mongod --dbpath=..."
-Change the allowed port to 27017 thank to "add --port 27017"
I did those operations but it doesn't solve the problem. Would you know how to fix it ? I thank you very much in advance !

MongoDB connect failed

My problem here is that even after setting up mongod.exe "mongod.exe --install --logpath c:\mongodb\logs --logappend --dbpath c:\mongodb\data\db --directoryperdb", when i start up mongo.exe on another shell, i get a connection error
MongoDB shell version: 3.2.9
connecting to: test 2016-10-01T17:20:11.543+0300 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017 after 5000 milliseconds, giving up.
2016-10-01T17:20:11.543+0300 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
what is it that i'm not doing right? Running it on Windows 10. Mongod.exe after set up waits for a connection.
it is may be because of the OS privileges so for example if you are in
windows try to open the cmd(command line) in administrator mode and
try to start the MongoDB server again,i hope this fix your problem
This is because the db server must be running and waiting for connections. I think you should start your db server first with ./mongod in the root directory and leave it running. Hopefully this will help!

Resources