K.E.
K.E.

Reputation: 838

How to stop Akka Cluster member gracefully from supervisord

I run an Akka Cluster (Version 2.5.0) what is controlled by supervisord (http://supervisord.org/). My problem is, when i stop one akka node with supervisorctl stop my-service the akka node stops, but does not have enough time to deregister himself from the akka cluster and furthermore the other nodes do not take control over (i.e.) singleton actors.

My supervisor config looks like this:

[program:my-service]
command=java -jar -Dconfig.file=application-1.conf -Dfile.encoding=UTF-8  my_service.jar
directory=/data/my-service
autorestart=true
autostart=true
user=lm-service
startsecs=3
startretries=3
stopsignal=KILL
stopwaitsecs=10
redirect_stderr=false
stdout_logfile=/data/my-service/logs/stdout
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/data/my-service/logs/stderr
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB

Do I have to add some shutdown hook in my akka application, or/and do I have to change the stopsignal parameter in my configuration?

Upvotes: 0

Views: 1140

Answers (1)

Frederic A.
Frederic A.

Reputation: 3514

The stop signal should be SIGTERM. SIGTERM will trigger the coordinated shutdown system of akka, your cluster node should correctly leave the cluster in this case. See:

Still, this won't guarantee that the other nodes will take control in time. See this quote from http://doc.akka.io/docs/akka/current/scala/cluster-singleton.html:

Be aware that there is a short time period when there is no active singleton during the hand-over process.

Upvotes: 2

Related Questions