1.下载redis-faina
下载地址
https://github.com/facebookarchive/redis-faina
2.解压安装
# unzip redis-faina-master.zip
3.使用
[root@]# ./redis-faina.py -h usage: redis-faina.py [-h] [--prefix-delimiter PREFIX_DELIMITER] [--redis-version REDIS_VERSION] [input] positional arguments: input File to parse; will read from stdin otherwise optional arguments: -h, --help show this help message and exit --prefix-delimiter PREFIX_DELIMITER String to split on for delimiting prefix and rest of key --redis-version REDIS_VERSION Version of the redis server being monitored
4.分析monitor命令的输出日志
/usr/local/redis/bin/redis-cli -a test123 -p 6379 MONITOR>m.log
该命令会一直执行,需要手工中断,中断后对生成的日志进行分析
[root@cdc-henan-cdhworker02 redis-faina-master]# ./redis-faina.py ./m.log Overall Stats ======================================== Lines Processed 17586 Commands/Sec 41.47 Top Prefixes ======================================== YSD-USER 8594 (48.87%) LOCAL 3896 (22.15%) DIGITALCLINIC-QUEUEFLOW 3050 (17.34%) digitalclinic-hospitalbase 659 (3.75%) DIGITALCLINIC-PREPARATION 334 (1.90%) YSD-HM 108 (0.61%) YSD-POINT 36 (0.20%) YSD-OPEN 35 (0.20%) Top Keys ======================================== YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE 8430 (47.94%) LOCAL:digitalclinic-hospitalbase:dubbo:hospitalAuth:hospitalId:13342 510 (2.90%) LOCAL:DIGITALCLINIC-QUEUEFLOW:DUBBO:QUQUE_FLOW_SETTING_EXT:HOSPITAL:191:8:2021-12-02 450 (2.56%) LOCAL:digitalclinic-hospitalbase:dubbo:equipment:deviceId:DB7AFAE760E668E5 284 (1.61%) DIGITALCLINIC-PREPARATION:DUBBO:INO:VACC_STATION_38 275 (1.56%) LOCAL:digitalclinic-hospitalbase:dubbo:HospitalStation:ID:245 252 (1.43%) LOCAL:digitalclinic-hospitalbase:dubbo:HospitalStation:ID:244 246 (1.40%) LOCAL:DIGITALCLINIC-QUEUEFLOW:DUBBO:QUQUE_FLOW_SETTING_EXT:HOSPITAL:13342:6:2021-12-02 236 (1.34%) Top Commands ======================================== LPOP 8438 (47.98%) EXISTS 2657 (15.11%) GET 2542 (14.45%) LRANGE 2541 (14.45%) PSETEX 236 (1.34%) EVAL 126 (0.72%) PEXPIRE 72 (0.41%) PEXPIREAT 68 (0.39%) Command Time (microsecs) ======================================== Median 859.75 75% 35862.25 90% 100554.25 99% 100668.0 Heaviest Commands (microsecs) ======================================== LPOP 364552865.5 GET 27162500.5 EXISTS 12917789.5 LRANGE 10325320.25 PEXPIRE 2215738.75 EVAL 2143444.5 PSETEX 1837200.5 DEL 1420493.0 Slowest Calls ======================================== 104542.0 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE" 101845.0 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE" 101665.75 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE" 101457.25 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE" 101396.0 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE" 101373.0 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE" 101334.0 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE" 101279.75 "LPOP" "YSD-USER:DUBBO:NOTICE:DELAYED:QUEUE"