LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

valkey-cli

Command-line client for Valkey data store

TLDR

Connect to server
$ valkey-cli
copy
Connect to host
$ valkey-cli -h [host] -p [6379]
copy
Execute command
$ valkey-cli SET [key] [value]
copy
With password
$ valkey-cli -a [password]
copy
Select database
$ valkey-cli -n [2]
copy
Cluster mode
$ valkey-cli -c
copy
Monitor live server latency
$ valkey-cli --latency
copy
Scan keys matching a pattern
$ valkey-cli --scan --pattern '[user:*]'
copy
Find large keys in the dataset
$ valkey-cli --bigkeys
copy

SYNOPSIS

valkey-cli [-h host] [-p port] [-a password] [options] [command]

DESCRIPTION

valkey-cli is the command-line interface for interacting with a Valkey server. It provides both an interactive REPL mode for exploring data and a non-interactive mode for scripting and automation. The client uses the same protocol as Redis, making it compatible with existing Redis workflows.Commands can be passed directly on the command line or piped from files and other programs. The client supports cluster mode for connecting to sharded deployments, database selection, authentication, and TLS connections.

PARAMETERS

-h HOST

Server hostname (default: 127.0.0.1).
-p PORT
Server port (default: 6379).
-s SOCKET
Unix socket path (overrides host and port).
-u URI
Connection URI (valkey://user:password@host:port/db).
-a PASSWORD
Password for authentication.
--user USERNAME
Username for ACL authentication.
--askpass
Prompt for a password without echoing.
-n DB
Database number to select on connect.
-c
Enable cluster mode with automatic redirects.
-r N
Run the command N times (use -1 for infinite).
-i SECONDS
Interval between repetitions when using -r.
-x
Read last argument from standard input.
--scan
Iterate keys using SCAN.
--pattern PATTERN
Filter keys by pattern (used with --scan/--bigkeys/--hotkeys).
--bigkeys
Sample the keyspace and report the largest keys.
--memkeys
Sample the keyspace and report the most memory-intensive keys.
--hotkeys
Report the most frequently accessed keys (requires LFU policy).
--latency
Measure server latency in real time.
--stat
Display continuous server statistics.
--rdb FILE
Transfer a remote RDB dump to a local file.
--pipe
Transfer raw RESP protocol from stdin for mass import.
--tls
Enable a TLS-encrypted connection.
--cluster CMD
Run cluster management subcommands (create, check, reshard, rebalance, add-node, del-node).

CAVEATS

Fork of Redis. Redis-cli compatible. Server must be running.

HISTORY

valkey-cli is the CLI for Valkey, a Redis fork maintained by the Linux Foundation.

SEE ALSO

Copied to clipboard
Kai