Connect Failed - Any Clue?

I’m trying to make Lab - Launching Mongod, but I have problem with connection.
In first window I use mongod:

mongod --dbpath /data/db/ --port 27000 --bind_ip “,” --auth

2020-02-12T09:08:06.142+0000 I NETWORK [initandlisten] listening via socket bound to
2020-02-12T09:08:06.143+0000 I NETWORK [initandlisten] listening via socket bound to

In second I use mongo from Lab:

mongo admin --host --eval ’
user: “m103-admin”,
pwd: “m103-pass”,
roles: [
{role: “root”, db: “admin”}

MongoDB shell version v4.2.2
connecting to: mongodb://
2020-02-12T10:18:22.405+0100 E QUERY [js] Error: couldn’t connect to server, connection attempt failed: SocketException: Error connecting to :: caused by :: Nie mozna nawiazac polaczenia, poniewaz komputer docelowy aktywnie go odmawia. :
2020-02-12T10:18:22.418+0100 F - [main] exception: connect failed
2020-02-12T10:18:22.419+0100 E - [main] exiting with code 1

Any clue what i’m doing wrong?

For some reason mongod started in first terminal is not running anymore.
Second terminal is noton same host.

HI @MarcinGuziak,

In addition to @steevej-1495,

You can use this command to check if your mongod instance is currently running or not.

ps -ef | grep mongod

Shubham Ranjan
Curriculum Services Engineer

In my case, mongod is running, ps -ef | grep mongod shows that.

Yet, trying to create the user fails with this message:

connecting to: mongodb://localhost:27000/admin?gssapiServiceName=mongodb
2020-02-18T03:43:52.663+0000 W NETWORK [thread1] Failed to connect to, in(checking socket for error after poll), reason: Connection refused
2020-02-18T03:43:52.663+0000 E QUERY [thread1] Error: couldn’t connect to server localhost:27000, connection attempt failed :
exception: connect failed

Could you please share the output of ps -aef | grep [m]ongod? The output of ss -tlnp might be usefull too as mongod might be running but not on localhost:27000.

Hi @garga1,

Please provide the information requested by @steevej-1495 in the previous post.