Skip to main content

Server Management

COMMAND​

Syntax​

COMMAND

Return an array with details about every Garnet command.

Resp Reply​

Array reply: a nested list of command details.


COMMAND COUNT​

Syntax​

COMMAND COUNT

Returns Integer reply of number of total commands in this Garnet server.

Resp Reply​

Integer reply: the number of commands returned by COMMAND.


COMMAND DOCS​

Syntax​

COMMAND DOCS [command-name [command-name ...]]

Return documentary information about commands.

By default, the reply includes all of the server's commands. You can use the optional command-name argument to specify the names of one or more commands.

Resp Reply​

Array reply: a map, as a flattened array, where each key is a command name, and each value is the documentary information.


COMMAND GETKEYS​

Syntax​

COMMAND GETKEYS command-name [arg [arg ...]]

Returns an array of keys that would be accessed by the given command.

  • command-name: The name of the command to analyze
  • arg: The arguments that would be passed to the command

Resp Reply​

Array reply: a list of keys that the command would access.


COMMAND GETKEYSANDFLAGS​

Syntax​

COMMAND GETKEYSANDFLAGS command-name [arg [arg ...]]

Returns an array of key names and access flags for keys that would be accessed by the given command.

  • command-name: The name of the command to analyze
  • arg: The arguments that would be passed to the command

Resp Reply​

Array reply: a nested array where each item contains:

  1. The key name
  2. An array of access flag strings that apply to that key

COMMAND INFO​

Syntax​

COMMAND INFO [command-name [command-name ...]]

Returns Array reply of details about multiple Garnet commands.

Same result format as COMMAND except you can specify which commands get returned.

If you request details about non-existing commands, their return position will be nil.

Resp Reply​

Array reply: a nested list of command details.


COMMITAOF​

Syntax​

COMMITAOF

This command manually issues a commit to write ahead logging (append-only file)

Resp Reply​

Simple string reply: AOF file committed


CONFIG GET​

Syntax​

CONFIG GET parameter [parameter ...]

The CONFIG GET command is used to read the configuration parameters of a running Garnet server.

Resp Reply​

Array reply: a list of configuration parameters matching the provided arguments.


CONFIG SET​

Syntax​

CONFIG SET parameter value [parameter value ...]

The CONFIG SET command is used in order to reconfigure the server at run time without the need to restart Garnet.

Resp Reply​

Simple string reply: OK when the configuration was set properly. Otherwise an error is returned.


DBSIZE​

Syntax​

DBSIZE

Return the number of keys in the currently-selected database.

Resp Reply​

Integer reply: the number of keys in the currently-selected database.


DEBUG​

Syntax​

DEBUG <subcommand> [<arg> ...]

The DEBUG command is an internal command meant for developing and testing the server and its clients. It is disabled by default; enable it with the EnableDebugCommand option or the --enable-debug-command command line option.

Subcommands:

  • ERROR <string>: Return a RESP error reply with <string> as the message.
  • LOG <message>: Write <message> to the server log.
  • FLUSHANDEVICT: Flush the store's in-memory log to disk and evict it (shifts HeadAddress to TailAddress) so subsequent reads are served from disk.
  • FORCEGC [generation]: Force a blocking garbage collection of the given generation (default: max). See GC.Collect.
  • PURGEBP <manager-type>: Purge the network buffer pool held by the given manager (MigrationManager, ReplicationManager, or ServerListener) and force a blocking GC, returning freed memory to the OS.
  • PANIC: Crash the server, simulating a panic.
  • HELP: Print the subcommand list.

FLUSHALL​

Syntax​

FLUSHALL [ASYNC | SYNC]

Delete all the keys of all the existing databases, not just the currently selected one. This command never fails.

Resp Reply​

Simple string reply: OK.


FLUSHDB​

Syntax​

FLUSHDB [ASYNC | SYNC]

Delete all the keys of the currently selected DB. This command never fails.

Resp Reply​

Simple string reply: OK.


INFO​

Syntax​

INFO [section [section ...]]

Returns information and statistics about the server, organized into sections. Each section is introduced by a # <Section> header line, followed by field:value lines. With no argument, a default set of sections is returned. One or more section names may be supplied to return only those sections. The pseudo-section keywords DEFAULT and EVERYTHING select the default set, ALL selects the default set excluding MODULES, RESET resets the statistics counters, and HELP returns the list of supported section names.

The more expensive sections — STOREHASHTABLE, STOREREVIV, HLOGSCAN, COMMANDSTATS, and KEYSPACE — are not part of the default (nor the ALL/EVERYTHING) set and must be requested explicitly by name.

Sections:

  • SERVER: General server information such as version, mode, and uptime.
  • MEMORY: Process and store memory-usage metrics.
  • CLUSTER: Cluster-mode status.
  • REPLICATION: Replication role and per-link status.
  • STATS: General statistics such as commands processed, keyspace hits/misses, and network I/O.
  • STORE: Per-database store details, including the current and last-checkpointed version, system state, hash-index bucket counts and sizes, and the hybrid-log and read-cache page/memory/heap sizes together with the key log addresses (Log.BeginAddress, Log.HeadAddress, Log.SafeReadOnlyAddress, Log.FlushedUntilAddress, Log.TailAddress, and the corresponding ReadCache.* addresses).
  • STOREHASHTABLE: Per-database dump of the hash-table bucket distribution (how records are spread across the index bucket chains); useful for diagnosing index sizing.
  • STOREREVIV: Per-database revivification (deleted-record free list) statistics.
  • PERSISTENCE: Checkpoint and append-only-file persistence information. rdb_last_bgsave_status reports whether the last checkpoint attempt for the database succeeded (ok) or failed (err); the append-only-file addresses are reported as N/A when the append-only file is disabled.
  • CLIENTS: Connected-client statistics.
  • KEYSPACE: Per-database key counts. Requested explicitly only, since it requires a full log scan.
  • MODULES: Loaded module information.
  • BPSTATS: Shared network buffer-pool statistics.
  • CINFO: Cluster checkpoint information.
  • HLOGSCAN: Scan-based size distribution of the in-memory portion of the hybrid log.
  • COMMANDSTATS: Per-command usage statistics (calls, failures, rejections). Requires the CommandStatsMonitor (--commandstats-monitor) option to be enabled.

Resp Reply​

One of the following:

  • For a section query (or no argument): Verbatim string reply (RESP3) / Bulk string reply (RESP2) with the requested sections and their fields.
  • For HELP: Array reply listing the supported section names.
  • For RESET: Simple string reply OK.

LATENCY HELP​

Syntax​

LATENCY HELP

Returns all the supported LATENCY sub-commands

Resp Reply​

Array reply: a list of LATENCY supported sub-command details.


LATENCY HISTOGRAM​

Syntax​

LATENCY HISTOGRAM [event [event ...]]

Return latency histogram of or more <event> classes.
If no commands are specified then all histograms are replied

Resp Reply​

Array reply


LATENCY RESET​

Syntax​

LATENCY RESET [event [event ...]]

Reset latency data of one or more <event> (default: reset all data for all event classes).

Resp Reply​

Simple string reply: OK.


SLOWLOG GET​

Syntax​

SLOWLOG GET [count]

Returns entries in the slow log. The default is to return the latest 10 entries. Use a negative count to return all entries.


SLOWLOG LEN​

Syntax​

SLOWLOG LEN

Returns the length of the slow queries log.


SLOWLOG RESET​

Syntax​

SLOWLOG RESET

Reset the slow log (discard all existing entries).


SLOWLOG HELP​

Syntax​

SLOWLOG HELP

Returns a list of supported SLOWLOG sub-commands.


MEMORY USAGE​

Syntax​

MEMORY USAGE key [SAMPLES count]

The MEMORY USAGE command reports the number of bytes that a key and its value require to be stored in RAM.

Resp Reply​

One of the following:

  • Integer reply: the memory usage in bytes.
  • Null reply: if the key does not exist.

REPLICAOF​

Syntax​

REPLICAOF <host port | NO ONE>

The REPLICAOF command can change the replication settings of a replica on the fly.

Resp Reply​

Simple string reply: OK.


ROLE​

Syntax​

ROLE

Provide information on the role of a Redis instance in the context of replication, by returning if the instance is currently a master, slave, or sentinel. The command also returns additional information about the state of the replication (if the role is master or slave) or the list of monitored master names (if the role is sentinel).

Resp Reply​

The command returns an array of elements. The elements of the array depends on the role.

Master output​

The master output is composed of the following parts:

  1. The string master.
  2. The current master replication offset, which is an offset that masters and replicas share to understand, in partial resynchronizations, the part of the replication stream the replicas needs to fetch to continue.
  3. An array composed of three elements array representing the connected replicas. Every sub-array contains the replica IP, port, and the last acknowledged replication offset.

Output of the command on replicas​

The replica output is composed of the following parts:

  1. The string slave, because of backward compatibility (see note at the end of this page).
  2. The IP of the master.
  3. The port number of the master.
  4. The state of the replication from the point of view of the master, that can be connect (the instance needs to connect to its master), connecting (the master-replica connection is in progress), sync (the master and replica are trying to perform the synchronization), connected (the replica is online).
  5. The amount of data received from the replica so far in terms of master replication offset.

SLAVEOF​

Syntax​

SLAVEOF <host port | NO ONE>

The SLAVEOF command can change the replication settings of a slave on the fly.

Resp Reply​

Simple string reply: OK.


SWAPDB​

Syntax​

SWAPDB index1 index2

This command swaps two Garnet databases, so that immediately all the clients connected to a given database will see the data of the other database, and the other way around.

Resp Reply​

Simple string reply: OK.


TIME​

Syntax​

TIME

The TIME command returns the current server time as a two items lists: a Unix timestamp and the amount of microseconds already elapsed in the current second. Basically the interface is very similar to the one of the gettimeofday system call.

Resp Reply​

Array reply: specifically, a two-element array consisting of the Unix timestamp in seconds and the microseconds' count.


MONITOR​

Syntax​

MONITOR

MONITOR is a debugging command that streams back every command processed by the Redis server. It can help in understanding what is happening to the database.

Resp Reply​

Non-standard return value. Dumps the received commands in an infinite flow.