| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 
 | 1. 查看db大小
 redis-cli -h host -p port -a password dbsize
 
 
 
 2. cat a.txt | redis-cli 从文件读入redis
 
 
 
 3. redis-cli -a password
 从redis中快速读取一些key
 
 
 
 4. n command 重复执行n次command
 
 
 
 5. help @
 @generic  @list  @hash  @set  @sorted_set @string  @hyperloglog、@server、@connection、@scripting、@pubsub、@transactions
 
 help <command>
 
 
 
 6. redis-cli
 redis-cli monitor
 
 
 
 7. redis-cli
 
 
 
 8. redis-cli
 redis-cli
 
 
 
 
 9.  redis-cli -h host
 备份远程redis数据到本地文件
 
 
 
 10. maxmemory size 设置redis使用的最大内存
 超过最大内存时、key过期策略
 
 
 
 
 
 
 
 
 
 
 11. 使用客户端查看redis配置
 redis-cli -h host config get key
 redis-cli -h host config get slowlog-log-slower-than 单位 微秒
 redis-cli -h host config get slowlog-log-slower-than 慢操作日志队列大小
 redis-cli -h host slowlog get 10 查看最近10条慢日志
 hash-max-ziplist-entries 配置使用hashmap编码的最大字节数
 redis-cli -h host get client-output-buffer-limit 客户端buffer控制、在server与client的交互中、
 
 每个连接都会有一个buffer关联、此buffer用来队列化等待被client接受的响应信息、若client不及时响应、
 buffer中积压的数据达到阈值、将会导致连接失败、buffer被移除
 
 
 12. redis以指定配置文件启动
 redis-server redis.conf &
 
 
 13. redis-cli
 在maxmemory无限制的情况下、测试时无意义的、因为内存无限制、命中率会是100%、计算机的ram会被耗尽
 记得配置key的过期策略
 
 |