Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd service stop issues with redis instances #428

Open
jnguiot opened this issue Dec 2, 2021 · 2 comments
Open

Systemd service stop issues with redis instances #428

jnguiot opened this issue Dec 2, 2021 · 2 comments

Comments

@jnguiot
Copy link
Contributor

jnguiot commented Dec 2, 2021

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

ExecStop=<%= $bin_path %>/redis-cli -p <%= $port %> shutdown

@ekohl
Copy link
Member

ekohl commented Feb 25, 2022

I wonder if this is a duplicate of #386.

@root-expert
Copy link
Member

I think this is fixed by b7f7478
Can you confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants