8

I'm trying to configure InfluxDB for Automatic start-up on a RHEL7 machine.

if I do:

sudo systemctl start influxdb

the service fails

[dadmin@localhost dashboard]$ sudo systemctl start influxdb
[sudo] password for dadmin: 
[dadmin@localhost dashboard]$ sudo systemctl status influxdb
● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/influxdb.service.d
           └─override.conf
   Active: failed (Result: start-limit) since Thu 2017-05-11 13:16:29 CEST; 10s ago
     Docs: https://docs.influxdata.com/influxdb/
  Process: 2562 ExecStart=/usr/bin/influxd -config /dashboard/influxdb.conf ${INFLUXD_OPTS} (code=exited, status=1/FAILURE)
 Main PID: 2562 (code=exited, status=1/FAILURE)

May 11 13:16:29 localhost.localdomain systemd[1]: influxdb.service: main process exited, code=exited, status=1/FAILURE
May 11 13:16:29 localhost.localdomain systemd[1]: Unit influxdb.service entered failed state.
May 11 13:16:29 localhost.localdomain systemd[1]: influxdb.service failed.
May 11 13:16:29 localhost.localdomain systemd[1]: influxdb.service holdoff time over, scheduling restart.
May 11 13:16:29 localhost.localdomain systemd[1]: start request repeated too quickly for influxdb.service
May 11 13:16:29 localhost.localdomain systemd[1]: Failed to start InfluxDB is an open-source, distributed, time series database.
May 11 13:16:29 localhost.localdomain systemd[1]: Unit influxdb.service entered failed state.
May 11 13:16:29 localhost.localdomain systemd[1]: influxdb.service failed.

This is the unit file:

[dadmin@localhost dashboard]$ sudo systemctl cat influxdb.service
[sudo] password for dadmin: 
# /usr/lib/systemd/system/influxdb.service
# 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/influxdb
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf ${INFLUXD_OPTS}
KillMode=control-group
Restart=on-failure

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

# /etc/systemd/system/influxdb.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/influxd -config /dashboard/influxdb.conf ${INFLUXD_OPTS}

But if I execute directly

/usr/bin/influxd -config /dashboard/influxdb.conf

InfluxDB start smoothly.

Where am I wrong?

3
  • See this relevant thread on the InfluxData community forums.
    – J.W.F.
    Commented Sep 30, 2017 at 22:34
  • Hi Davide, just a question: why is present - in the assignment of EnvironmentFile=-/etc/default/influxdb ?
    – Kyrol
    Commented Jun 22, 2020 at 23:24
  • Hi Kyrol, the prefix "-" indicates that if the file does not exist, it will not be read and no error or warning message is logged. See freedesktop.org/software/systemd/man/systemd.exec.html
    – Davide
    Commented Jun 24, 2020 at 8:11

3 Answers 3

5

I found the problem:

[dadmin@localhost dashboard]$ sudo tail /var/log/messages
May 11 16:21:41 localhost influxd: [I] 2017-05-11T14:21:41Z Using data dir: /dashboard/influxdb/data service=store
May 11 16:21:41 localhost influxd: run: open server: open tsdb store: open /dashboard/influxdb/data/_internal: permission denied
May 11 16:21:41 localhost systemd: influxdb.service: main process exited, code=exited, status=1/FAILURE
May 11 16:21:41 localhost systemd: Unit influxdb.service entered failed state.
May 11 16:21:41 localhost systemd: influxdb.service failed.
May 11 16:21:41 localhost systemd: influxdb.service holdoff time over, scheduling restart.
May 11 16:21:41 localhost systemd: start request repeated too quickly for influxdb.service
May 11 16:21:41 localhost systemd: Failed to start InfluxDB is an open-source, distributed, time series database.
May 11 16:21:41 localhost systemd: Unit influxdb.service entered failed state.
May 11 16:21:41 localhost systemd: influxdb.service failed.

When I had executed

/usr/bin/influxd -config /dashboard/influxdb.conf

The folders had been created with dadmin as owner

I removed the folders and restarted the service. Now all works fine.

1
  • Why does sudo tail /var/log/messages not work for me?
    – Newskooler
    Commented Jul 9, 2019 at 17:19
2

The config script does not have permissions.

It references directories. When you run /opt/influxdb/influxd config > /etc/opt/influxdb/influxdb.conf the outputted config file puts all the directories under ~. When you are root, ~ translates to /root.

If you don't want to use /root as your InfluxDB data directory there are a few options.

Run /opt/influxdb/influxd config > /etc/opt/influxdb/influxdb.conf as the user you want to run influxd. Then the config file will use that user's home directory as the install location. Explicitly edit /etc/opt/influxdb/influxdb.conf to reference the directories you want to use.

Also check this blog this might clear it out for you

1

you can change the user and the group to root

[dadmin@localhost dashboard]$ sudo systemctl cat influxdb.service
[sudo] password for dadmin: 
# /usr/lib/systemd/system/influxdb.service
# 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=root
Group=root
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf ${INFLUXD_OPTS}
KillMode=control-group
Restart=on-failure

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

# /etc/systemd/system/influxdb.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/influxd -config /dashboard/influxdb.conf ${INFLUXD_OPTS}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .