basho / riak

Riak is a decentralized datastore from Basho Technologies.
http://docs.basho.com
Apache License 2.0
3.93k stars 534 forks source link

riak systemd service does not exit after crash because epmd still hangs around #969

Closed asyncmind0 closed 4 years ago

asyncmind0 commented 5 years ago
● riak.service - Distributed key/value store from Basho Technologies
   Loaded: loaded (/etc/systemd/system/riak.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-04-09 22:18:04 AEST; 2 weeks 4 days ago
 Main PID: 2906
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/riak.service
           └─2693 /usr/lib/riak/erts-5.10.3/bin/epmd -daemon

After a crash epmd keeps the service state as active hence preventing any notifications or restart triggers setup on systemd

asyncmind0 commented 4 years ago

https://stackoverflow.com/questions/2013368/why-an-epmd-process-doesnt-exit

asyncmind0 commented 4 years ago

Creating a epmd service solved the isssue

[Unit]
Description = Erlang epmd
After = network.target

[Service]
LimitNOFILE = 20000500
User = riak
Type = simple
Restart = always
TimeoutStartSec = 1m
RestartSec = 1m
ExecStart = /usr/lib/riak/erts-5.10.3/bin/epmd
ExecStop = -/usr/lib/riak/erts-5.10.3/bin/epmd -kill
SyslogIdentifier = riak-epmd
PermissionsStartOnly = True

[Install]
WantedBy = multi-user.target

and a riak service like

[Unit]
Description = Distributed key/value store from Basho Technologies
After = network.target riak-epmd
Wants = riak-epmd
OnFailure = slack-notify-fail@%n

[Service]
LimitNOFILE = 20000500
User = riak
Type = forking
Restart = always
TimeoutStartSec = 10m
RestartSec = 1m
ExecStartPre = /bin/mkdir -p /var/run/riak/ ; /bin/chown -R riak:riak /var/run/riak
ExecStart = /usr/sbin/riak start
ExecStop = -/usr/sbin/riak stop
PIDFile = /var/run/riak/riak.pid
SyslogIdentifier = riak
PermissionsStartOnly = True

[Install]
WantedBy = multi-user.target