Working with Server Administration

1. Getting Server Time

CommandReturns
TIME[unix-seconds, microseconds]

2. Getting Role Information

CommandReturns
ROLEmaster/slave/sentinel + replication detail

3. Saving Database

CommandDescription
SAVESynchronous snapshot BLOCKS
BGSAVE [SCHEDULE]Background snapshot

4. Getting Last Save Time

CommandReturns
LASTSAVEUnix timestamp of last successful save

5. Rewriting AOF

CommandDescription
BGREWRITEAOFCompact AOF in background

6. Syncing Data to Disk

CommandDescription
WAITAOF 1 0 5000Force local AOF fsync, wait up to 5s 7.2+
CONFIG SET appendfsync alwaysPer-write fsync

7. Shutting Down Server

CommandDescription
SHUTDOWN [NOSAVE|SAVE] [NOW] [FORCE] [ABORT]Graceful stop with optional snapshot
SHUTDOWN ABORTCancel in-progress shutdown 7.0+

8. Debugging Objects

CommandReturns
DEBUG OBJECT keyrefcount, encoding, serializedlength, lru
OBJECT ENCODING keyInternal encoding (listpack/skiplist/...)
OBJECT REFCOUNT keyShared object ref count

9. Setting Server Verbosity

DirectiveLevels
logleveldebug, verbose, notice, warning, nothing
logfilePath; "" for stdout

10. Resetting Statistics

CommandDescription
CONFIG RESETSTATReset counters in INFO
RESETReset connection state (MULTI, SUB, tracking) 6.2+

11. Getting Command Info

CommandDescription
COMMANDMetadata for all commands
COMMAND INFO name [name ...]Specific command details
COMMAND DOCS [name ...]Documentation 7.0+
COMMAND COUNTTotal registered commands
COMMAND GETKEYS cmd argsExtract key names from a command

12. Using MODULE LOAD for Extensions

CommandDescription
MODULE LOAD /path/to/mod.so [arg ...]Load shared library
MODULE LOADEX path [CONFIG k v]* [ARGS a]*Load with config 7.0+
MODULE LISTLoaded modules
MODULE UNLOAD nameUnload module