Running influxdb as systemd service

Hello,

I’m currently struggling on getting influxdb (v2) running as a systemd service…

Where do I need to put the config file? What is my working directory if I start it with systemd?
I tried to use the WorkingDirectory option in the systemd unit file and put the config file into /var/lib/influxdb but it isn’t working…

My systemd unit file looks like this:

# If you modify this, please also make sure to edit init.sh

[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target

[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb2
ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh
KillMode=control-group
Restart=on-failure
Type=forking
PIDFile=/var/lib/influxdb/influxd.pid
StateDirectory=influxdb
StateDirectoryMode=0750
LogsDirectory=influxdb
LogsDirectoryMode=0750
UMask=0027
WorkingDirectory=/var/lib/influxdb

[Install]
WantedBy=multi-user.target
Alias=influxd.service

Really not easy to get started with influxdb2 :exploding_head:

Hi @Sh1ndy if you this cat this directory here:

/etc/influxdb/config.toml

This gives you the default config location. You can add your config changes there and restart the service. Hope this helps :slight_smile:

1 Like

Works, thank you very much!