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 “127.0.0.1,192.168.103.100” --auth

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

In second I use mongo from Lab:

mongo admin --host 127.0.0.1:27000 --eval ’
db.createUser({
user: “m103-admin”,
pwd: “m103-pass”,
roles: [
{role: “root”, db: “admin”}
]
})

MongoDB shell version v4.2.2
connecting to: mongodb://127.0.0.1:27000/admin?compressors=disabled&gssapiServiceName=mongodb
2020-02-12T10:18:22.405+0100 E QUERY [js] Error: couldn’t connect to server 127.0.0.1:27000, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27000 :: caused by :: Nie mozna nawiazac polaczenia, poniewaz komputer docelowy aktywnie go odmawia. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
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.
Or
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

Thanks,
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 127.0.0.1:27000, 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 :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
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.