1 (edited by KB7777 2017-05-26 08:27:04)

Topic: Redis systemd problem

Hello.

After redis installation at CentOS 7 (full update) there is problem with launching redis service.
The proper /etc/systemd/system/multi-user.target.wants/redis.service in my case is:

[Unit]
Description=Redis persistent key-value database
After=network.target

[Service]
PermissionsStartOnly=true
ExecStartPre=-/usr/bin/mkdir /var/run/redis
ExecStartPre=/usr/bin/chown -R :redis /var/run/redis
ExecStartPre=/usr/bin/chmod g+w /var/run/redis
ExecStart=/usr/bin/redis-server /etc/redis.conf --daemonize no
ExecStop=/usr/libexec/redis-shutdown
User=redis
Group=redis

[Install]
WantedBy=multi-user.target

and after every update I had to add this 3 lines with "ExecStartPre".

It is because of /run which is tmpfs -- https://blog.hqcodeshop.fi/archives/93- … stemd.html

Is the default redis systemd configuration from remi repo intended or I have some misconfiguration at my CentOS? smile

Regards.

Re: Redis systemd problem

1/ never modify system distributed file (/usr/lib/systemd/system/redis.service), this is NOT a configuration file, and thus your change are lost on update

=> use "systemctl edit redis.service" to create a override configuration file

2/ /Var/run/redis is not used by the package, unneeded by default configuration, so not provided

3/ use /etc/tmpfiles.d/xxx.conf to configure needed directory / file, which will be created during boot process

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

3 (edited by KB7777 2017-05-29 10:07:26)

Re: Redis systemd problem

Thank you for clarification smile

/etc/tmpfiles.d/redis.conf works fine big_smile

Re: Redis systemd problem

FYI:

After upgrade to 4.0.1 there are new 2 lines at /etc/systemd/system/multi-user.target.wants/redis.service:
RuntimeDirectory=redis
RuntimeDirectoryMode=0755

so the trick with /etc/tmpfiles.d/redis.conf doesn't work and the redis server could not start after reboot but manually systemctl start redis works fine.
Solution is deleting /etc/tmpfiles.d/redis.conf cos it not needed anymore smile

Regards smile

Re: Redis systemd problem

The /etc/tmpfiles.d/redis.conf file is not part of the RPM wink

And the change have been applied to allow creation of the run directory on service startup, as requested by some user who want to use the unix socket

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Redis systemd problem

Excelent smile