Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

SHUTDOWN

Last updated
SHUTDOWN [NOSAVE | SAVE] [NOW] [FORCE] [ABORT | SAFE | FAILOVER]
Group
Server
Arity
-1 (at least 1 words, counting the command name)
Flags
admin
HotKV Cloud
All plans
On-Premise
no license needed

SHUTDOWN stops the server cleanly. Replies to commands sent before it are delivered, nothing sent after it runs, and the server writes a snapshot once every other command has stopped, so the snapshot holds the last write. On success there is no reply: the connection closes when the process exits.

A primary with replicas waits, up to shutdown-timeout seconds (default 10), until every replica has acknowledged every write, so the replicas lose nothing. The log says Shutting down once every replica has acknowledged every write (waiting up to 10 s). Writes are held while it waits, so that the replicas can catch up; reads are still answered and new connections are accepted. NOW skips the wait.

Without SAVE or NOSAVE, a snapshot is written if save points are configured. If the snapshot cannot be written (for example the directory is not writable), the shutdown is refused so that no data is lost, unless you add FORCE.

A process that gets SIGTERM or SIGINT shuts down the same way. shutdown-on-sigterm and shutdown-on-sigint take the options to use for the signal (default, save, nosave, now, force, safe or failover, and several together).

Option Effect
SAVE Write a snapshot even if no save points are configured.
NOSAVE Do not write a snapshot.
NOW Do not wait for the replicas to catch up.
FORCE Shut down even if the snapshot cannot be written, or, with SAFE, even though the node is a primary that serves slots.
ABORT Cancel a shutdown that is waiting for replicas, from any connection. The client that sent the SHUTDOWN gets ERR Errors trying to SHUTDOWN. Check logs. and the held writes go on. Cannot be combined with other options.
SAFE In cluster mode, refuse to stop a primary that serves slots, because its slots would be down until a replica took them over. Replicas and primaries without slots stop. Outside cluster mode it changes nothing.
FAILOVER In cluster mode, hand the primary’s slots to a replica that has every write, then stop. Refused outside cluster mode.
Case Reply (RESP2 and RESP3)
Shutting down No reply; the connection closes
The snapshot cannot be written (without FORCE) Error ERR Errors trying to SHUTDOWN. Check logs.
SAFE on a primary that serves slots (without FORCE) Error ERR Errors trying to SHUTDOWN. Check logs. and the server keeps running
ABORT with no shutdown waiting Error ERR No shutdown in progress.
FAILOVER outside cluster mode Error ERR SHUTDOWN FAILOVER is only supported in cluster mode.
SAVE with NOSAVE, ABORT with another option, or an unknown option Error ERR syntax error
127.0.0.1:6379> SHUTDOWN SAVE
not connected>

In a cluster:

127.0.0.1:7000> SHUTDOWN SAFE
(error) ERR Errors trying to SHUTDOWN. Check logs.
127.0.0.1:7000> SHUTDOWN FAILOVER
not connected>

SHUTDOWN FAILOVER hands the primary’s slots to a replica that has every write, then stops the primary.

Outside a cluster, the options FAILOVER and ABORT reply:

127.0.0.1:6379> SHUTDOWN FAILOVER
(error) ERR SHUTDOWN FAILOVER is only supported in cluster mode.
127.0.0.1:6379> SHUTDOWN ABORT
(error) ERR No shutdown in progress.

In HotKV Cloud, the CLI tab of the panel does not run SHUTDOWN. Restart or stop a Cloud instance from the panel instead.

Same options and errors as Redis 7, including the wait for replicas (shutdown-timeout, NOW, ABORT), and the SAFE and FAILOVER options of Valkey 9. Replicas and failover shows how to use SHUTDOWN FAILOVER and shutdown-on-sigterm failover for planned restarts.

SAVE, BGSAVE, DEBUG (RESTART), CLUSTER FAILOVER, persistence