redis 日常使用
每隔1秒ping3次 [redis@redis01 ~]$ redis-cli -h 192.168.20.201 -p 7003 -i 1 -r 3 ping PONG PONG PONG
模拟复制进程 [redis@redis01 7001]$ redis-cli -h 192.168.20.201 -p 7002 --slave SYNC with master, discarding 176 bytes of bulk transfer... SYNC done. Logging commands from master. "PING" "PING" "SELECT","0" "set","a","haitian" "PING" "PING" "PING" "PING" 别的回话执行的命令在窗口输出就可以显示出来
查找大的键值,可能是系统瓶颈 [redis@redis01 7001]$ redis-cli -h 192.168.20.201 -p 7002 --bigkeys # Scanning the entire keyspace to find biggest keys as well as # average sizes per key type. You can use -i 0.1 to sleep 0.1 sec # per 100 SCAN commands (not usually needed). [00.00%] Biggest string found so far 'a' with 7 bytes -------- summary ------- Sampled 1 keys in the keyspace! Total key length in bytes is 1 (avg len 1.00) Biggest string found 'a' has 7 bytes 1 strings with 7 bytes (100.00% of keys, avg size 7.00) 0 lists with 0 items (00.00% of keys, avg size 0.00) 0 hashs with 0 fields (00.00% of keys, avg size 0.00) 0 streams with 0 entries (00.00% of keys, avg size 0.00) 0 sets with 0 members (00.00% of keys, avg size 0.00) 0 zsets with 0 members (00.00% of keys, avg size 0.00)
测试网络延迟 [redis@redis01 7001]$ redis-cli -h 192.168.20.202 -p 7001 --latency min: 0, max: 30, avg: 0.62 (621 samples)^C [redis@redis01 7001]$ redis-cli -h 192.168.20.202 -p 7001 --latency min: 0, max: 109, avg: 0.92 (2791 samples)^C 实时获取Redis的重要统计信 [redis@redis01 7001]$ redis-cli -h 192.168.20.202 -p 7001 --stat ------- data ------ --------------------- load -------------------- - child - keys mem clients blocked requests connections 0 2.01M 1 0 6259 (+0) 55 0 2.01M 1 0 6261 (+2) 55 0 2.01M 1 0 6263 (+2) 55 0 2.01M 1 0 6265 (+2) 55 0 2.01M 1 0 6267 (+2) 55
查看内存使用 192.168.20.202:7001> set c haitian OK 192.168.20.202:7001> memory usage c (integer) 52