Learned today: redis-cli command line options


So, it’s just info you can find with redis-cli –help 🙂 but I didn’t find it in the official documentation.

Usage: redis-cli [OPTIONS] [cmd [arg [arg …]]]

  • -h <hostname> Server hostname (default: 127.0.0.1)
  • -p <port> Server port (default: 6379)
  • -s <socket> Server socket (overrides hostname and port)
  • -a <password> Password to use when connecting to the server
  • -r <repeat> Execute specified command N times
  • -i <interval> When -r is used,  waits <interval> seconds per command. It is possible to specify sub-second times like -i 0.1
  • -n <db> Database number
  • -x Read last argument from STDIN
  • -d <delimiter> Multi-bulk delimiter in for raw formatting (default: \n)
  • –raw Use raw formatting for replies (default when STDOUT is not a tty)
  • –help Output this help and exit
  • –version Output version and exit

Examples:
cat /etc/passwd | redis-cli -x set mypasswd
redis-cli get mypasswd
redis-cli -r 100 lpush mylist x
redis-cli -r 100 -i 1 info | grep used_memory_human:

When no command is given, redis-cli starts in interactive mode.
Type “help” in interactive mode for information on available commands.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s