redis常用性能分析命令

一、连接

src/redis-cli -h 10.20.137.141 -p 6379
>auth 123456789

src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789
src/redis-cli -h {ip} -p {port} -a {password} monitor

二、常用性能分析命令

src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 monitor 
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789  info clients|grep connected_clients 查看客户端已连接个数
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info memory|egrep '(used_memory_human|used_memory_peak_human)'  
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info memory|grep  -e "used_memory_human" -e "used_memory_peak_human"  查看当前使用内存量和历史最高峰值
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info stats | grep total_commands 查看启动到当前处理命令总数
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info stats | grep instantaneous_ops_per_sec 每秒操作数
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info stats | grep expired_keys 已过期的key数量
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info stats | grep instantaneous_input_kbps 每秒进出流量(70444byte)0.07M
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info stats | grep rejected_connections拒绝的连接请求量
src/redis-cli -h 10.20.137.141 -p 6379 -a 123456789 info memory|grep mem_fragmentation_ratio
内存碎片比例(如果超过1,表示存在内存碎片;如果小于1,说明内存被交换到swap里面去了。计算公式为:used_memory_rss/used_memory) 
src/redis-cli -h IP -p 26379 -a 123456 info|grep process_id
src/redis-cli info clients|grep connected_clients 查看客户端已连接个数

三、动态修改保存方式

config set save ""  不持久化
config rewrite
config get save

 四、latency命令报告

   latency latest记录最后的延迟事件记录,每个事件包含以下几个变量(事件名、事件延迟状态时间戳、延迟时间ms、此时间最大延迟)

 注意:Unix时间戳转换方式为:

date -d@'1466059344' "+ %Y-%m-%d %H:%M:%S"
date -d"2016-06-16 16:50:50" '+%s'

 

127.0.0.1:6379>latency latest
1)"command"                    事件类型
2)(integer) 1466059344    发生时间
3)(integer) 250                 延迟时间0.25ms
4)(integer)1000               事件延迟最大时间为1s


127.0.0.1:6379>history events 此命令可以打印相应延迟事件相关的时间和耗时
127.0.0.1:6379>latency  reset command重置事件的相关延迟操作,清空记录
127.0.0.1:6379>latency  graph command  
127.0.0.1:6379>slowlog get 获取慢查询日志
127.0.0.1:6379>slowlog len 获取慢查询日志条数
127.0.0.1:6379>slowlog reset 清空慢查询
127.0.0.1:6379>config get maxclients查看最大连接数配置

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值