格式:(待补充)
/redis-6.2.4/src/redis-cli -h $ip -p $port -a $password [command] #以下ip/port/password根据实际情况替换
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 dbsize #查看key数量
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 info #查看信息
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 scan 0 count 1000 #扫描从坐标x开始一次y条
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 ttl name1715 | awk '{print $1}' #查看key的ttl
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 scan 0 match name20* count 1000 #扫描key同时支持模糊查询
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 del name1000 #删除key
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 unlink name1000 #异步删除key
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 unlink name1001 #异步删除key
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 type name1002 #查询key类型
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 get name1002 #查询key值(String类型)
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 mget name1003 name1004 #查询多个key值(String类型)
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 lrange k1 0 -1 #查询key值(List类型-列表)
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 smembers k1 #查询key值(Set类型-集合)
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 hget user:1001 field #查询key值(Hash类型)
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 hkeys user:1002 #查看所有field(Hash类型)
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 hvals user:1002 #查看所有value(Hash类型)
./redis-6.2.4/src/redis-cli -h 192.168.37.8 -p 6379 -a 123 zrange k1 0 -1 [withscores] #返回value(Zset-有序集合),[]可以返回评分