Carry の Blog Carry の Blog
首页
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • Python
  • Shell
  • MySQL8-SOP手册
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Carry の Blog

好记性不如烂键盘
首页
  • Nginx
  • Prometheus
  • Iptables
  • Systemd
  • Firewalld
  • Docker
  • Sshd
  • DBA工作笔记
  • MySQL
  • Redis
  • TiDB
  • Elasticsearch
  • Python
  • Shell
  • MySQL8-SOP手册
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • MySQL

  • Redis

    • 安装配置
    • Redis 集群部署
    • redis大key分析
    • Redis手动进行主从切换
    • Redis集群添加节点之后数据重新均匀分配
    • Redis槽位slot解读
    • redis新增节点slot迁移报错故障修复
    • Redis集群的创建、剔除节点与新增节点操作过程
    • redis抓包分析脚本
    • Redis配置文件解读
    • redis cluster压测
    • redis慢查询告警脚本
    • Redis 的可用内存过高时的自动驱逐 key 策略详解
  • Keydb

  • TiDB

  • MongoDB

  • Elasticsearch

  • Kafka

  • victoriametrics

  • BigData

  • Sqlserver

  • 数据库
  • Redis
Carry の Blog
2022-03-29

redis抓包分析脚本

# redis-faina.py 分析redis 一段时间的redis语句

redis-faina.py点击下载 (opens new window)

使用方法例子

[dba01@xxxtest-redis01 ~]$ redis-cli -h 172.16.9.126 -p 7001 -a xxxxxxxxxxxxxxx -c monitor |head -n 99999 >>/tmp/1201-redis.log
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
[dba01@xxxprod-redis01 ~]$ ls
redis-faina.py  result.md
[dba01@xxxprod-redis01 ~]$ python redis-faina.py /tmp/1201-redis.log 
Overall Stats
========================================
Lines Processed  	99999
Commands/Sec     	9302.46
[2021/12/1 17:15:57] 
Top Prefixes
========================================
spring         	26850	(26.85%)
blacklist      	21755	(21.76%)
agentstatus    	15040	(15.04%)
agentuser      	12378	(12.38%)
mq             	1812 	(1.81%)
collaboration  	1217 	(1.22%)
online         	374  	(0.37%)
system         	177  	(0.18%)
[2021/12/1 17:15:57] 
Top Keys
========================================
spring:session:expirations:1638353760000    	7075	(7.08%)
topic_agent                                 	3984	(3.98%)
blacklist:24ffb96385e7e7e2e96fc6ee9e5df65e  	1576	(1.58%)
blacklist:77e5ff35d8120ba85a420f231f5e3a32  	880 	(0.88%)
blacklist:3ae188e1c602ff18e55380edb5d49586  	700 	(0.70%)
blacklist:4727b116cae6da03fc8a10094dc175ad  	578 	(0.58%)
blacklist:a9effdc4c483c681ec9813d07b6883db  	464 	(0.46%)
blacklist:2321910b31946566bae7a8c384afddc3  	448 	(0.45%)
...
1
2
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
上次更新: 4/24/2025

← Redis集群的创建、剔除节点与新增节点操作过程 Redis配置文件解读→

最近更新
01
tidb fast ddl
04-04
02
TiDB配置文件调优 原创
04-03
03
如何移除TiDB中的表分区 原创
04-03
更多文章>
Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式