In this post we'll review the most useful and used commands when working with redis-cli, with practical examples.
Without authentication/TLS
Let's assume that our Redis instance has this properties:
host : 10.20.30.40
port : 1234
Connect to Redis Instance:
redis-cli -p 1234 -h 10.20.30.40
Once connected you can:
Get all keys:
redis> keys *
delete all keys from all Redis databases:
redis> FLUSHALL
delete all keys of the current Redis database only:
redis> FLUSHDB
set a key with its value:
redis> SET mykey "hello"get mykey:
redis> GET mykey
set a key with expiration (in seconds):
redis> set secondkey "hey" EX 90
With authentication/TLS:
Let's assume that our Redis instance has this properties:
host : 10.20.30.40
port : 1234
auth-string: abdcefgh
ca-certificate: ca-cert.pem
Connect to Redis Instance using TLS:
export REDISCLI_AUTH=abcdefgh
redis-cli -p 1234 -h 10.20.30.40 --tls --cacert=ca-cert.pem
No comments:
Post a Comment