Disable killing the server by systemd (that may lead to data loss for Buffer)

Default systemd's timeout for sending SIGKILL after SIGTERM is 1m30s
(TimeoutStopSec), which is can be not enough to wait for queries or
shutdown the storages.

And besides in this case shutdown_wait_unfinished server settings are
ignored.

So let's just disable this systemd logic and rely on
shutdown_wait_unfinished instead.

But note shutting down the storages can take a while, but it is better
to give it time instead of killing the process, since killing may lead
to data loss.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-09-18 12:56:15 +02:00
parent dde0a88067
commit 4c30156595

View File

@ -17,6 +17,10 @@ User=clickhouse
Group=clickhouse
Restart=always
RestartSec=30
# The following ClickHouse directives should be used instead of forcing SIGKILL by systemd:
# - shutdown_wait_unfinished_queries
# - shutdown_wait_unfinished
TimeoutStopSec=infinity
# Since ClickHouse is systemd aware default 1m30sec may not be enough
TimeoutStartSec=0
# %p is resolved to the systemd unit name