Mongo server not starting

MongoDB shell version v3.6.8

connecting to: mongodb://

2022-05-27T03:29:16.141-0700 W NETWORK [thread1] Failed to connect to, in(checking socket for error after poll), reason: Connection refused

2022-05-27T03:29:16.141-0700 E QUERY [thread1] Error: couldn’t connect to server, connection attempt failed :



exception: connect failed

I am unable to access mongo shell

Your issue is not clear.

Your title is Mongo server not starting but you show the output of starting mongosh. These are 2 different things.

When you get

when starting mongosh, it means that mongod is not running at the given address.

You have to start mongod first before you try to connect.

1 Like

Sorry newbie error . i tried this but i get .
sudo service mongod start
Failed to start mongod.service: Unit mongod.service not found.

Actually my main query is - i have to install mongodb server and shell on a machine. but since it has no internet access and the repo contains only a older version. I am transferring .deb packages to the machine and then doing sudo apt-get install the deb packages.
Like i am not even sure if i am doing the right thing . Please do help me in this regard.

service mongod status

Unit mongod.service could not be found.

You may always start mongod manually.

Otherwise, I would suggest that you install mongod on a machine that has Internet access and then copy over the mongod.service from that machine.

My recommendation is to use Atlas.

so thats the only option is it ?
what are the steps can i do to manually get all required things like mongo server, shell

Whats the advantage of using atlas?

What is your os?
Do you have mongod binary?
Just issue mongod on command line and see.It should bring up mongod on default port 27017 provided the default dirpath exists
If it is up you can connect by issuing mongo
or you can spinup your mongod from command line
mongod --port --dbpath --logpath --fork(need to pass values for first 3 parameters)

Atlas is a cloud hosted environment where you can create your Sandbox cluster and start using mongodb
All you have to do is create your account,create your Sandbox cluster,load sample data.Once you are familiar you can create your own db/collections
Please visit mongodb documentation for more details

1 Like

let me rephrase. i want to setup mongodb server on one machine with no internet access.

So i went to this page MongoDB Community Downloads | MongoDB
do i download all this files??

  • Ubuntu 20.04 x64
    • Archive:
    • Server Package: [mongodb-org-server_5.0.8_amd64.deb]
    • Mongos Package: [mongodb-org-mongos_5.0.8_amd64.deb]
    • Mongo Shell Package: [mongodb-org-shell_5.0.8_amd64.deb]

Command :mongod --port 2707 —dbpath /var/lib/mongodb --logpath /var/log/mongodb/mongod.log --fork

about to fork child process, waiting until server is ready for connections.
forked process: 265155
ERROR: child process failed, exited with 1
To see additional information in this output, start without the “–fork” option.mongod --port 2707 —dbpath /var/lib/mongodb --logpath /var/log/mongodb/mongod.log --fork
about to fork child process, waiting until server is ready for connections.
forked process: 265155
ERROR: child process failed, exited with 1
To see additional information in this output, start without the “–fork” option.

Output of mongod

{“t”:{"$date":“2022-05-29T22:52:40.682+05:30”},“s”:“I”, “c”:“NETWORK”, “id”:4915701, “ctx”:"-",“msg”:“Initialized wire specification”,“attr”:{“spec”:{“incomingExternalClient”:{“minWireVersion”:0,“maxWireVersion”:13},“incomingInternalClient”:{“minWireVersion”:0,“maxWireVersion”:13},“outgoing”:{“minWireVersion”:0,“maxWireVersion”:13},“isInternalClient”:true}}}
{“t”:{"$date":“2022-05-29T22:52:40.682+05:30”},“s”:“I”, “c”:“CONTROL”, “id”:23285, “ctx”:“main”,“msg”:“Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’”}
{“t”:{"$date":“2022-05-29T22:52:40.682+05:30”},“s”:“W”, “c”:“ASIO”, “id”:22601, “ctx”:“main”,“msg”:“No TransportLayer configured during NetworkInterface startup”}
{“t”:{"$date":“2022-05-29T22:52:40.682+05:30”},“s”:“I”, “c”:“NETWORK”, “id”:4648601, “ctx”:“main”,“msg”:“Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize.”}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“W”, “c”:“ASIO”, “id”:22601, “ctx”:“main”,“msg”:“No TransportLayer configured during NetworkInterface startup”}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“I”, “c”:“REPL”, “id”:5123008, “ctx”:“main”,“msg”:“Successfully registered PrimaryOnlyService”,“attr”:{“service”:“TenantMigrationDonorService”,“ns”:“config.tenantMigrationDonors”}}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“I”, “c”:“REPL”, “id”:5123008, “ctx”:“main”,“msg”:“Successfully registered PrimaryOnlyService”,“attr”:{“service”:“TenantMigrationRecipientService”,“ns”:“config.tenantMigrationRecipients”}}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“I”, “c”:“CONTROL”, “id”:5945603, “ctx”:“main”,“msg”:“Multi threading initialized”}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“I”, “c”:“CONTROL”, “id”:4615611, “ctx”:“initandlisten”,“msg”:“MongoDB starting”,“attr”:{“pid”:248208,“port”:27017,“dbPath”:"/data/db",“architecture”:“64-bit”,“host”:“bng-emake-10a”}}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“I”, “c”:“CONTROL”, “id”:23403, “ctx”:“initandlisten”,“msg”:“Build Info”,“attr”:{“buildInfo”:{“version”:“5.0.8”,“gitVersion”:“c87e1c23421bf79614baf500fda6622bd90f674e”,“openSSLVersion”:“OpenSSL 1.1.1f 31 Mar 2020”,“modules”:[],“allocator”:“tcmalloc”,“environment”:{“distmod”:“ubuntu2004”,“distarch”:“x86_64”,“target_arch”:“x86_64”}}}}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“I”, “c”:“CONTROL”, “id”:51765, “ctx”:“initandlisten”,“msg”:“Operating System”,“attr”:{“os”:{“name”:“Ubuntu”,“version”:“20.04”}}}
{“t”:{"$date":“2022-05-29T22:52:40.701+05:30”},“s”:“I”, “c”:“CONTROL”, “id”:21951, “ctx”:“initandlisten”,“msg”:“Options set by command line”,“attr”:{“options”:{}}}
{“t”:{"$date":“2022-05-29T22:52:40.702+05:30”},“s”:“E”, “c”:“NETWORK”, “id”:23024, “ctx”:“initandlisten”,“msg”:“Failed to unlink socket file”,“attr”:{“path”:"/tmp/mongodb-27017.sock",“error”:“Operation not permitted”}}
{“t”:{"$date":“2022-05-29T22:52:40.702+05:30”},“s”:“F”, “c”:"-", “id”:23091, “ctx”:“initandlisten”,“msg”:“Fatal assertion”,“attr”:{“msgid”:40486,“file”:“src/mongo/transport/transport_layer_asio.cpp”,“line”:1019}}
{“t”:{"$date":“2022-05-29T22:52:40.702+05:30”},“s”:“F”, “c”:"-", “id”:23092, “ctx”:“initandlisten”,“msg”:"\n\n***aborting after fassert() failure\n\n"}

Check ls -lrt /tmp/mongodb-27017.sock.It should be owned by mongod
Could be permissions issue
mongod is unable to remove the tmp file.May be it was started by a different user before

srwx------ 1 mongodb mongodb 0 May 29 23:45 /tmp/mongodb-27017.sock

Shutdown all mongods if any running
remove the file and try to start mongod again
The port you gave in your command is not correct 2707.It should be 27017
Also try to use a totally new dirpath and logpath to avoid clash with previous runs of mongod
Like your homedir or whatever path you give mongod shoulld be able to write to that directory

hello, please go to task manager, then service and make sure mongodb is running

if not, run it ,they try your campus or shell for worked for me!