FS#50259 - [consul] consul agent should be gracefully stopped by SIGINT not SIGTERM
Attached to Project:
Community Packages
Opened by Konstantin Gribov (gross) - Thursday, 04 August 2016, 15:30 GMT
Last edited by Thore Bödecker (foxxx0) - Tuesday, 16 January 2018, 12:01 GMT
Opened by Konstantin Gribov (gross) - Thursday, 04 August 2016, 15:30 GMT
Last edited by Thore Bödecker (foxxx0) - Tuesday, 16 January 2018, 12:01 GMT
|
Details
Description:
`consul agent` should be gracefully stopped by SIGINT not SIGTERM, see [1]. I suggest to add `ExecStop=/usr/bin/kill -INT $MAINPID` to `/usr/lib/systemd/system/consul.service`. Additional info: * community/consul 0.6.4-1 Steps to reproduce: * create config at `/etc/consul.d` with `{"data_dir":"/tmp/consul-test","server":true,"bootstrap_expect":1,"bind_addr":"10.0.3.1"}` * `systemctl start consul` * `systemctl stop consul` * see `journalctl -u consul -o short-iso | grep -A6 terminated`: ``` 2016-08-04T18:08:58+0300 unterwelt consul[14836]: ==> Caught signal: terminated 2016-08-04T18:08:58+0300 unterwelt consul[14836]: 2016/08/04 18:08:58 [INFO] agent: requesting shutdown 2016-08-04T18:08:58+0300 unterwelt consul[14836]: 2016/08/04 18:08:58 [INFO] consul: shutting down server 2016-08-04T18:08:58+0300 unterwelt consul[14836]: 2016/08/04 18:08:58 [WARN] serf: Shutdown without a Leave 2016-08-04T18:08:58+0300 unterwelt consul[14836]: 2016/08/04 18:08:58 [ERR] dns: error starting tcp server: accept tcp 127.0.0.1:8600: use of closed network connection 2016-08-04T18:08:58+0300 unterwelt consul[14836]: 2016/08/04 18:08:58 [WARN] serf: Shutdown without a Leave 2016-08-04T18:08:58+0300 unterwelt consul[14836]: 2016/08/04 18:08:58 [INFO] agent: shutdown complete ``` * Add suggested `ExecStop` directive to `/etc/systemd/system/consul.service.d/stop.conf` * `systemctl daemon-reload` * `systemctl start consul` * `systemctl stop consul` * `journalctl -u consul -o short-iso | grep -A9 interrupt`: ``` 2016-08-04T18:11:07+0300 unterwelt consul[15075]: ==> Caught signal: interrupt 2016-08-04T18:11:07+0300 unterwelt consul[15075]: ==> Gracefully shutting down agent... 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [INFO] consul: server starting leave 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [INFO] serf: EventMemberLeave: unterwelt.dc1 10.0.3.1 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [INFO] agent: requesting shutdown 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [INFO] consul: shutting down server 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [WARN] serf: Shutdown without a Leave 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [INFO] serf: EventMemberLeave: unterwelt 10.0.3.1 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [ERR] dns: error starting tcp server: accept tcp 127.0.0.1:8600: use of closed network connection 2016-08-04T18:11:07+0300 unterwelt consul[15075]: 2016/08/04 18:11:07 [INFO] agent: shutdown complete ``` * ensure that `EventMemberLeave` is present in log |
This task depends upon
They should only leave if you want to decomission the server.
Source: https://github.com/hashicorp/consul/issues/3764#issuecomment-353263493