[SERVER-49538] Each time server restarts, mongod fails to start Created: 16/Jul/20  Updated: 27/Oct/23  Resolved: 16/Jul/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: firstName lastName Assignee: Dmitry Agranat
Resolution: Community Answered Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 18.04 LTS, mongodb 4.0.10


Operating System: ALL
Participants:

 Description   

After server machine reboot, mongod fails to start with error code: 48.
Mitigation is to manualy run `sudo systemctl restart mongod` and it works.
I played aroung and at one point deleting mongodb-27017.sock file was needed
for mongodb to start, but after a reboot behavior went to the one I just describe.
I've tried combinations of mongod.service running and file pre booting status:

  1. mongod.service - running mongodb-27017.sock -exist
  2. mongod.service - running mongodb-27017.sock - does not exist
  3. mongod.service - stoped mongodb-27017.sock -exist
  4. mongod.service - stoped mongodb-27017.sock -does not exist

and problem persist.
What is a long term mitigation, ie, how to make mongod starts good after server reboot?

Short logs:

2020-07-16T07:22:34.792+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net:

{ bindIp: "127.0.0.1,192.168.2.170", port: 27017 }

, processManageme$
2020-07-16T07:22:34.792+0200 E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
2020-07-16T07:22:34.793+0200 I CONTROL [initandlisten] now exiting
2020-07-16T07:22:34.793+0200 I CONTROL [initandlisten] shutting down with code:48



 Comments   
Comment by firstName lastName [ 16/Jul/20 ]

Hi and thanks Dmitry,

I already had in mongod.conf local static ip address of server, just forgot to post that in bug report.
Link that you sent me says that you can also add static host name which I did and now it works fine after restart  .
Of course I first looked at stack overflow, but answers there didn't helped me and to be honest this sound as a bug.
Probably mongod gets ready before server still does not have static ip address. In my humble opinion, in link that you sent
me, it should write as preferable way to set static host name, instead of ip address, thanks again Dmitry.

Cheers, firstName

 

Comment by Dmitry Agranat [ 16/Jul/20 ]

Hi nikolarancic@yahoo.com,

You need to bind values with appropriate internal IP or resolvable hostname.

The SERVER project is for bugs and feature suggestions for the MongoDB server. As this ticket does not appear to be a bug, I will now close it. If you need further assistance troubleshooting, I encourage you to ask our community by posting on the MongoDB Community Forums or on Stack Overflow with the mongodb tag.

Regards,
Dima

Comment by firstName lastName [ 16/Jul/20 ]

Forgot to add, when server reboots mongodb-27017.sock has valid user permisions: 'srwx------ 1 mongodb mongodb 0 јул 16 07:31 mongodb-27017.sock'

Generated at Thu Feb 08 05:20:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.