Courseiva
Server Administration →easyMultiple Choice

C100DBA Server Administration Practice Question

A MongoDB DBA is asked to ensure that the mongod process on a Linux server automatically restarts if it crashes. The server uses systemd. Which command should the DBA run to enable this behavior?

⚠ Common exam trap

The trap here is assuming that systemctl enable mongod also enables automatic restart on failure, when it only enables start at boot.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Edit the mongod.service unit file to include Restart=always, then run systemctl daemon-reload and systemctl restart mongod

To enable automatic restart of mongod on failure when using systemd, you must modify the service unit file to include Restart=always (or Restart=on-failure). After editing, run systemctl daemon-reload to reload the configuration, and then restart the service. The systemctl enable command only ensures start at boot, not restart on crash. The other commands are either manual restarts or do not provide automatic restart functionality. (Explanation length: 65 words)

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    systemctl enable mongod

    Why it's wrong here

    The systemctl enable mongod command configures the mongod service to start automatically at system boot, but it does not configure automatic restart if the process crashes. To achieve automatic restart on failure, you need to set the Restart directive in the service unit file and reload systemd. Enabling the service only affects boot-time behavior, not runtime failures. Therefore, this command alone does not meet the requirement. (Explanation length: 58 words)

  • ✗

    Run mongod --fork --logpath /var/log/mongodb/mongod.log

    Why it's wrong here

    The mongod --fork command starts mongod as a background process, but it does not provide any automatic restart capability if the process crashes. This is a manual way to run mongod, and it is typically used when not using a service manager. It does not integrate with systemd and will not restart on failure. Therefore, it does not meet the requirement for automatic restart. (Explanation length: 55 words)

  • ✗

    systemctl restart mongod

    Why it's wrong here

    The systemctl restart mongod command stops and then starts the mongod service immediately. It does not configure any automatic restart behavior. This is a one-time action and would not ensure that the process restarts if it crashes later. The DBA needs to modify the service configuration to enable automatic restarts on failure, not just restart the service manually. (Explanation length: 55 words)

  • ✓

    Edit the mongod.service unit file to include Restart=always, then run systemctl daemon-reload and systemctl restart mongod

    Why this is correct

    This approach correctly modifies the systemd service unit for mongod to include the Restart=always directive, which tells systemd to restart the service if it exits, regardless of the exit status. After editing the unit file, you must run systemctl daemon-reload to reload the systemd manager configuration, and then restart the service to apply the change. This ensures that if mongod crashes, systemd will automatically restart it. This is the recommended method for achieving automatic restart on failure. (Explanation length: 68 words)

About these practice questions

Courseiva writes every C100DBA question from scratch — 222 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official MongoDB exam blueprint

This C100DBA practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DBA exam.