[DOCS-13899] systemd unit mongod.service should use "After=network-online.target" (SERVER-50866) Created: 29/Sep/20  Updated: 13/Nov/23  Resolved: 29/Oct/20

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.8.0, 4.4.2, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Dave Cuthbert (Inactive)
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
backported by DOCS-13919 [BACKPORT] [v4.4] systemd unit mongod... Closed
Documented
documents SERVER-50866 systemd unit mongod.service should us... Closed
Participants:
Days since reply: 3 years, 19 weeks, 2 days ago
Epic Link: DOCSP-9747
Story Points: 5

 Description   

Description

Downstream Change Summary

This change may affect how the service starts and stops on systemd Linux distros.

This is so any configurations which bind to a specific IP address can be supported properly. Before this change, the service may have failed to start because it came online before the network interface was configured with an IP address. Now, systemd will wait to start the service until after all network interfaces are configured or have failed to be configured. In cases where DHCP is used to configure a network interface, this may introduce a short delay in startup until network interface configuration either succeeds or fails.

Another result of this change is that mongod state is based on the networking state in systemd. Shutting down network services via systemd will now also stop mongod, and starting the network interface back up will start mongod again. This situation is extremely rare and does not usually happen except during OS shutdown and restart, or when a sysadmin would have intended all services to be unavailable (such as single-user mode).

Description of Linked Ticket

Currently the systemd unil file mongod.service waits for the network.target to be reached, via the line After=network.target. However, most Linux distributions with systemd support network-online.target, which is a better indicator that the network is up and available for MongoDB. When only waiting on network.target, it is possible that the mongod service fails to start upon system reboot.

See this systemd documentation page for a more detailed explanation.

We suggest changing the mongod.service file to specify:

After=network-online.target network.target

Scope of changes

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)


Generated at Thu Feb 08 08:09:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.