MongoDB does not open Port

Hello,

We are running a MongoDB server at Debian 10.13.
The MongoDB version is 4.4.19.
After the restart of one MongoDB server, the process does not open a network port anymore.
I have already checked the configuration file:

net:
  port: 27017
  bindIp: localhost,127.0.0.1

Even when I try to use another port it does not work.
The mondogb user and group is the owner of the dataarea and of the socket.
I already tried to use the repair command but after it starts, it does nothing to the database, even after running for up to 12 hours.

When I unmap the dataarea, a new one will be created and the server starts as I would expect it.
I tried to use a backup of the server (without restoring the DB) to check whether there has been a change to the os which prevents the server from opening the port.

In the log files you can see this:

{"t":{"$date":"2023-03-02T09:16:03.095Z"},"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":"2023-03-02T09:16:03.112Z"},"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":"2023-03-02T09:16:03.112Z"},"s":"D2", "c":"CONNPOOL", "id":22558,   "ctx":"main","msg":"Initializing connection pool controller","attr":{"pool":"NetworkInterfaceTL-ReplNetwork","controller":"LimitController"}}
{"t":{"$date":"2023-03-02T09:16:03.112Z"},"s":"D1", "c":"NETWORK",  "id":22940,   "ctx":"main","msg":"file descriptor and connection resource limits","attr":{"hard":64000,"soft":64000,"conn":51200}}
{"t":{"$date":"2023-03-02T09:16:03.112Z"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":31002,"port":27017,"dbPath":"/var/lib/mongodb","architecture":"64-bit","host":"linsrv150"}}
{"t":{"$date":"2023-03-02T09:16:03.112Z"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.19","gitVersion":"9a996e0ad993148b9650dc402e6d3b1804ad3b8a","openSSLVersion":"OpenSSL 1.1.1n  15 Mar 2022","modules":[],"allocator":"tcmalloc","environment":{"distmod":"debian10","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2023-03-02T09:16:03.113Z"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"PRETTY_NAME=\"Debian GNU/Linux 10 (buster)\"","version":"Kernel 4.19.0-23-amd64"}}}
{"t":{"$date":"2023-03-02T09:16:03.113Z"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"config":"/etc/mongod.conf","net":{"bindIp":"localhost,127.0.0.1","port":27017},"processManagement":{"timeZoneInfo":"/usr/share/zoneinfo"},"storage":{"dbPath":"/var/lib/mongodb","directoryPerDB":true,"engine":"wiredTiger","journal":{"enabled":true}},"systemLog":{"destination":"file","logAppend":false,"path":"/var/log/mongodb/mongod.log","timeStampFormat":"iso8601-utc","verbosity":5}}}}
{"t":{"$date":"2023-03-02T09:16:03.113Z"},"s":"D1", "c":"NETWORK",  "id":22940,   "ctx":"initandlisten","msg":"file descriptor and connection resource limits","attr":{"hard":64000,"soft":64000,"conn":51200}}
{"t":{"$date":"2023-03-02T09:16:03.113Z"},"s":"D1", "c":"EXECUTOR", "id":23104,   "ctx":"OCSPManagerHTTP-0","msg":"Starting thread","attr":{"threadName":"OCSPManagerHTTP-0","poolName":"OCSPManagerHTTP"}}
{"t":{"$date":"2023-03-02T09:16:03.113Z"},"s":"D3", "c":"EXECUTOR", "id":23108,   "ctx":"OCSPManagerHTTP-0","msg":"Waiting for work","attr":{"numThreads":1,"minThreads":1}}
{"t":{"$date":"2023-03-02T09:16:03.113Z"},"s":"D2", "c":"-",        "id":23323,   "ctx":"initandlisten","msg":"Starting periodic job {job_name}","attr":{"job_name":"FlowControlRefresher"}}
{"t":{"$date":"2023-03-02T09:16:03.113Z"},"s":"D4", "c":"STORAGE",  "id":22222,   "ctx":"FlowControlRefresher","msg":"Trimmed samples. Num: {numTrimmed}","attr":{"numTrimmed":0}}
{"t":{"$date":"2023-03-02T09:16:03.114Z"},"s":"D4", "c":"-",        "id":20518,   "ctx":"FlowControlRefresher","msg":"Refreshing tickets. Before: {tickets} Now: {numTickets}","attr":{"tickets":1000000000,"numTickets":1000000000}}
{"t":{"$date":"2023-03-02T09:16:04.113Z"},"s":"D4", "c":"STORAGE",  "id":22222,   "ctx":"FlowControlRefresher","msg":"Trimmed samples. Num: {numTrimmed}","attr":{"numTrimmed":0}}
{"t":{"$date":"2023-03-02T09:16:04.113Z"},"s":"D4", "c":"-",        "id":20518,   "ctx":"FlowControlRefresher","msg":"Refreshing tickets. Before: {tickets} Now: {numTickets}","attr":{"tickets":1000000000,"numTickets":1000000000}}
{"t":{"$date":"2023-03-02T09:16:05.113Z"},"s":"D4", "c":"STORAGE",  "id":22222,   "ctx":"FlowControlRefresher","msg":"Trimmed samples. Num: {numTrimmed}","attr":{"numTrimmed":0}}
{"t":{"$date":"2023-03-02T09:16:05.113Z"},"s":"D4", "c":"-",        "id":20518,   "ctx":"FlowControlRefresher","msg":"Refreshing tickets. Before: {tickets} Now: {numTickets}","attr":{"tickets":1000000000,"numTickets":1000000000}}
{"t":{"$date":"2023-03-02T09:16:06.113Z"},"s":"D4", "c":"STORAGE",  "id":22222,   "ctx":"FlowControlRefresher","msg":"Trimmed samples. Num: {numTrimmed}","attr":{"numTrimmed":0}}
{"t":{"$date":"2023-03-02T09:16:06.113Z"},"s":"D4", "c":"-",        "id":20518,   "ctx":"FlowControlRefresher","msg":"Refreshing tickets. Before: {tickets} Now: {numTickets}","attr":{"tickets":1000000000,"numTickets":1000000000}}
{"t":{"$date":"2023-03-02T09:16:07.113Z"},"s":"D4", "c":"STORAGE",  "id":22222,   "ctx":"FlowControlRefresher","msg":"Trimmed samples. Num: {numTrimmed}","attr":{"numTrimmed":0}}
{"t":{"$date":"2023-03-02T09:16:07.113Z"},"s":"D4", "c":"-",        "id":20518,   "ctx":"FlowControlRefresher","msg":"Refreshing tickets. Before: {tickets} Now: {numTickets}","attr":{"tickets":1000000000,"numTickets":1000000000}}

Even reinstalling the mongodb packages does not solve the issue.
Do you have any idea?

Thanks for your help!
Best regards
Florian

Hello @Florian_Streppel ,

Welcome to The MongoDB Community Forums! :wave:

To understand your use-case better, please share more details such as:

  • How did you determine that the port was not opened? Was there an error in the logs?
  • What is your deployment topology? If it is a replica set please share the output of rs.status() and rs.conf()
  • By dataarea did you mean the dbpath? What does unmap means in this context?
  • I don’t see any errors in the logs you shared, could you please share the error you are getting?

Warning: Only use mongod --repair if you have no other options. The operation removes and does not save any corrupt data during the repair process and should not be run in a replica set as mentioned in the repairDatabase manual.

If you’re having issues starting and connecting to a self-hosted MongoDB deployment, you might find hints in the following topic:

Regards,
Tarun

Hello Tarun,

sorry for my late reply.

  • How did you determine that the port was not opened? Was there an error in the logs?

When I let me show the open ports on the server there is no mongodb port opened.
In the logfiles it look like the port is opened. So there are no hints in the log for me.

  • What is your deployment topology? If it is a replica set please share the output of rs.status() and rs.conf()

I cannot share the output because I cannot even connect to the server with the cli.

  • By dataarea did you mean the dbpath? What does unmap means in this context?

Yes I mean the dbpath. The dbpath is a mapped nfs share and I unmounted the share to test, whether there is an issue with the data.

  • I don’t see any errors in the logs you shared, could you please share the error you are getting?

Thats my issue as well. I cannot see any error. But the mongod process does not open a port I can connect to.

Best regards
Florian

Did you run something like netstat ?

Yes I ran netstat -tulpen but there is no port opened for mongod.

Please post the output of the below to investigate further:

systemctl status mongod.service

telnet 127.0.0.1 27017

netstat -an | grep LISTEN

systemctl status ufw.service

iptables -L