Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13899

systemd unit mongod.service should use "After=network-online.target" (SERVER-50866)

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: 4.8.0, 4.4.2
    • Component/s: manual, Server
    • Labels:
      None

      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.)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dave.cuthbert Dave Cuthbert
              Reporter:
              backlog-server-pm Backlog - Core Eng Program Management Team
              Participants:
              Last commenter:
              Dave Cuthbert Dave Cuthbert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since reply:
                51 weeks ago
                Date of 1st Reply: