puppet-redis
puppet-redis copied to clipboard
Systemd service stop issues with redis instances
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 6.24.0
- Ruby:
- Distribution: Ubuntu 18.04
- Module version: 8.2.0
How to reproduce (e.g Puppet code you use)
redis::instance{"prodXXX-redis":
service_name => "redis@prodXXX",
bind => "172.3.0.1",
port => 9999,
requirepass => "foobar123",
}
What are you seeing
The service doesn't stop properly:
root@xxxx:~# service redis@prodXXX status
● [email protected] - Redis Advanced key-value store for instance prodXXX-redis
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-12-02 10:18:15 CET; 16min ago
Process: 51032 ExecStop=/usr/bin/redis-cli -p 9999 shutdown (code=exited, status=1/FAILURE)
Main PID: 60128 (redis-server)
Status: "MASTER <-> REPLICA sync: Finished with success. Ready to accept connections in read-write mode."
CGroup: /system.slice/system-redis.slice/[email protected]
└─60128 /usr/bin/redis-server 172.3.0.1:9999
Dec 02 10:18:15 xxxx systemd[1]: Starting Redis Advanced key-value store for instance prodXXX-redis...
Dec 02 10:18:15 xxxx systemd[1]: Started Redis Advanced key-value store for instance prodXXX-redis.
The ExecStop
did not not stop the service and returns a failure.
What behaviour did you expect instead
The ExecStop should stop the service without error
Output log
Any additional information you'd like to impart
The redis-cli
in the ExecStop
does not connect to the right binding address. Thus, it fails.
However, since redis is password protected (requirepass
) , it will also fails. And I am not sure we should insert the password into the service file.
My recommendation would be to be closer to the original redis-server
systemd file and use ExecStop=/bin/kill -s TERM $MAINPID
in https://github.com/voxpupuli/puppet-redis/blob/4a8d7811da5fd610b60c4b67f195f759e59f851c/templates/service_templates/redis.service.epp#L22