LinuxCommandLibrary

valkey-cli

Execute commands on Valkey server

TLDR

Connect to the local server

$ valkey-cli
copy

Connect to a remote server on the default port (6379)
$ valkey-cli -h [host]
copy

Connect to a remote server specifying a port number
$ valkey-cli -h [host] -p [port]
copy

Connect to a remote server specifying a URI
$ valkey-cli -u [uri]
copy

Specify a password
$ valkey-cli -a [password]
copy

Execute valkey command
$ valkey-cli [valkey_command]
copy

Connect to the local cluster
$ valkey-cli -c
copy

SYNOPSIS

valkey-cli [OPTIONS] [COMMAND [ARGUMENT ...]]

PARAMETERS

-h
    Connect to the specified server hostname (default: 127.0.0.1).

-p
    Connect to the specified server port (default: 6379).

-a
    Authenticate using the given password.

-u
    Connect to Valkey using a URI string (e.g., valkey://user:password@host:port/db).

-n
    Select the specified database number (default: 0).

--raw
    Use raw formatting for replies (no pretty printing).

--latency
    Enter latency monitoring mode, showing real-time latency statistics.

--stat
    Enter statistics monitoring mode, displaying a summary of server stats every second.

--rdb
    Transfer an RDB dump file from the server to the client.

--pipe
    Send commands from stdin to the server using the Valkey protocol for efficient bulk operations.

--cluster
    Perform cluster-related operations (e.g., check, fix, create, add-node, del-node, reshard).

--eval