Skip to content

Instantly share code, notes, and snippets.

@dbolkensteyn
Last active September 1, 2022 19:17
Show Gist options
  • Save dbolkensteyn/32b8b34a88786d15d38ac6374a1269ff to your computer and use it in GitHub Desktop.
Save dbolkensteyn/32b8b34a88786d15d38ac6374a1269ff to your computer and use it in GitHub Desktop.
# Simple systemd service for Nebula Graph
# Enterprise Edition comes with this feature built-in
#
# Tested on Ubuntu LTS 20.04
#
# Increase max file descriptors for systemd child processes:
# 1. echo "DefaultLimitNOFILE=130000:524288" >> /etc/systemd/system.conf
# 2. Verify a process' limits: sudo prlimit -n <PID>
#
# Usage:
# 1. Paste this file into /etc/systemd/system/nebula.service
# 2. Reload systemd's config to make it aware of this new file: sudo systemctl daemon-reload
# 3. Start: sudo systemctl start nebula
# 4. Stop: sudo systemctl stop nebula
# 5. Enable automatic start: sudo systemctl enable nebula
# 6. View logs: journalctl -u nebula.service
#
# References:
# 1. https://docs.nebula-graph.io/3.2.0/4.deployment-and-installation/manage-service/
# 2. https://docs.nebula-graph.io/3.2.0/5.configurations-and-logs/1.configurations/6.kernel-config/
# 3. https://www.freedesktop.org/software/systemd/man/systemd.service.html
# 4. https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6
# 5. https://djangoadventures.com/how-to-increase-the-open-files-limit-on-ubuntu/
#
[Unit]
Description=nebula
Wants=basic.target
After=basic.target network.target
[Service]
Type=forking
ExecStart=/usr/local/nebula/scripts/nebula.service start all
ExecReload=/usr/local/nebula/scripts/nebula.service restart all
ExecStop=/usr/local/nebula/scripts/nebula.service stop all
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment