Working with Server Administration
1. Getting Server Time
| Command | Returns |
|---|---|
TIME | [unix-seconds, microseconds] |
2. Getting Role Information
| Command | Returns |
|---|---|
ROLE | master/slave/sentinel + replication detail |
3. Saving Database
| Command | Description |
|---|---|
SAVE | Synchronous snapshot BLOCKS |
BGSAVE [SCHEDULE] | Background snapshot |
4. Getting Last Save Time
| Command | Returns |
|---|---|
LASTSAVE | Unix timestamp of last successful save |
5. Rewriting AOF
| Command | Description |
|---|---|
BGREWRITEAOF | Compact AOF in background |
6. Syncing Data to Disk
| Command | Description |
|---|---|
WAITAOF 1 0 5000 | Force local AOF fsync, wait up to 5s 7.2+ |
CONFIG SET appendfsync always | Per-write fsync |
7. Shutting Down Server
| Command | Description |
|---|---|
SHUTDOWN [NOSAVE|SAVE] [NOW] [FORCE] [ABORT] | Graceful stop with optional snapshot |
SHUTDOWN ABORT | Cancel in-progress shutdown 7.0+ |
8. Debugging Objects
| Command | Returns |
|---|---|
DEBUG OBJECT key | refcount, encoding, serializedlength, lru |
OBJECT ENCODING key | Internal encoding (listpack/skiplist/...) |
OBJECT REFCOUNT key | Shared object ref count |
9. Setting Server Verbosity
| Directive | Levels |
|---|---|
loglevel | debug, verbose, notice, warning, nothing |
logfile | Path; "" for stdout |
10. Resetting Statistics
| Command | Description |
|---|---|
CONFIG RESETSTAT | Reset counters in INFO |
RESET | Reset connection state (MULTI, SUB, tracking) 6.2+ |
11. Getting Command Info
| Command | Description |
|---|---|
COMMAND | Metadata for all commands |
COMMAND INFO name [name ...] | Specific command details |
COMMAND DOCS [name ...] | Documentation 7.0+ |
COMMAND COUNT | Total registered commands |
COMMAND GETKEYS cmd args | Extract key names from a command |
12. Using MODULE LOAD for Extensions
| Command | Description |
|---|---|
MODULE LOAD /path/to/mod.so [arg ...] | Load shared library |
MODULE LOADEX path [CONFIG k v]* [ARGS a]* | Load with config 7.0+ |
MODULE LIST | Loaded modules |
MODULE UNLOAD name | Unload module |