Skip to content

Instantly share code, notes, and snippets.

@marsyang1
Last active May 17, 2019 07:39
Show Gist options
  • Save marsyang1/457c4348138a03676dc02ef43786c08e to your computer and use it in GitHub Desktop.
Save marsyang1/457c4348138a03676dc02ef43786c08e to your computer and use it in GitHub Desktop.
redis-cli basic command
# https://hub.docker.com/r/rediscommander/redis-commander
docker run --rm --name redis-commander -d \
--env REDIS_HOSTS=10.10.20.30 \
-p 8081:8081 \
rediscommander/redis-commander:latest
# https://redis.io/topics/rediscli
# https://stackoverflow.com/questions/5252099/redis-command-to-get-all-available-keys
# login
$ redis-cli -h redis15.localnet.org -p 6390 ping
PONG
$ redis-cli -a myUnguessablePazzzzzword123 ping
redis-cli -h 127.0.0.1 -p 6379 -a mysupersecretpassword
PONG
# list all key
-->Get all keys from redis-cli
-redis 127.0.0.1:6379> keys *
-->Get list of patterns
-redis 127.0.0.1:6379> keys d??
This will produce keys which start by 'd' with three characters.
-redis 127.0.0.1:6379> keys *t*
This wil get keys with matches 't' character in key
-->Count keys from command line by
-redis-cli keys * |wc -l
-->Or you can use dbsize
-redis-cli dbsize
-redis 127.0.0.1:6379> get xxxKey
-- check health info
redis-cli -h 127.0.0.1 -p 1234 -a xxxx info
-- check client config
redis-cli -h 127.0.0.1 -p 1234 -a xxxx config get *client*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment