当前位置:网站首页>MySQL data loss, analyze binlog log file
MySQL data loss, analyze binlog log file
2022-07-07 04:02:00 【Little snail's way】
scene : A part of the business data that should exist is found missing in the test environment
a Table related b Table business data includes 28 The data of , however a The watch doesn't , late mysql Log view reason !
Belonging to account general_log The directory where the files are stored
mysql> SHOW VARIABLES LIKE 'gen%';
+----------------------------------+----------------------------+
| Variable_name | Value |
+----------------------------------+----------------------------+
| general_log | OFF |
| general_log_file | /var/lib/mysql/server6.log |
| generated_random_password_length | 20 |
+----------------------------------+----------------------------+
3 rows in set (0.01 sec)
Then you can go to the corresponding general_log Go to the directory to see the execution log .
see binlog
Command line login database :mysql -uroot -p123456
show binary logs;
mysql> show binary logs
-> ;
+---------------+-----------+-----------+
| Log_name | File_size | Encrypted |
+---------------+-----------+-----------+
| binlog.000001 | 385141819 | No |
+---------------+-----------+-----------+
If you need to query 2022-06-28 00:00:00 To 2022-06-28 23:59:50 The database for test Operation log of , Enter the following command to write the data to a standby txt that will do
mysqlbinlog --no-defaults --database=test --base64-output=decode-rows -v --start-datetime="2022-06-28 00:00:00" --stop-datetime="2022-06-28 23:59:50" binlog.000001 > test.txt;
--base64-output=decode-rows -v
Parameters :
- base64-output, You can control the output of the output statement base64 Coded BINLOG sentence ;
- decode-rows: Option will decode the row based event into a SQL sentence
adopt vi command ,/ keyword Query correlation sql
Pictured :
Check the log , It turns out that the table is in 29 Japan 9:55:41 Seconds were deleted and recreated , All business data is lost !!!
Binlog Analytical skills
- Try to parse from the library , Avoid affecting the main library
- First, roughly locate the related library table operations binlog, Then analyze the corresponding binlog Data in
- In parsing DDL There is no need to add
-v
Output details ( Speed up parsing ) - If it's on
binlog_rows_query_log_events
Parameters , Need to use-vv
Parameters can display specific SQL sentence
边栏推荐
- Que savez - vous de la sérialisation et de l'anti - séquence?
- web服务性能监控方案
- Redis源码学习(30),字典学习,dict.h
- How to manage the expiration of enterprise distribution certificates- How to manage Enterprise Distribution certificate expiration?
- Web service performance monitoring scheme
- 23. (ArcGIS API for JS) ArcGIS API for JS ellipse collection (sketchviewmodel)
- Calculation of time and space complexity (notes of runners)
- 红米k40s root玩机笔记
- ggplot 分面的细节调整汇总
- golang 根据生日计算星座和属相
猜你喜欢
【mysql】mysql中行排序
web服务性能监控方案
GPT-3当一作自己研究自己,已投稿,在线蹲一个同行评议
QT opens a file and uses QFileDialog to obtain the file name, content, etc
【knife-4j 快速搭建swagger】
Summer 2022 daily question 1 (1)
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
Gpt-3 is a peer review online when it has been submitted for its own research
Tflite model transformation and quantification
Kotlin Android environment construction
随机推荐
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
接口数据安全保证的10种方式
SQL injection -day15
A 股指数成分数据 API 数据接口
Hisilicon 3559 universal platform construction: RTSP real-time playback support
Kalman filter-1
[MySQL] row sorting in MySQL
cuda编程
QT 打开文件 使用 QFileDialog 获取文件名称、内容等
ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly
Introduction to opensea platform developed by NFT trading platform (I)
再AD 的 界面顶部(菜单栏)创建常用的快捷图标
MySQL storage engine
Clock in during winter vacation
C task expansion method
Simple implementation of AVL tree insertion and verification operations
使用 Dumpling 备份 TiDB 集群数据到 GCS
It's too convenient. You can complete the code release and approval by nailing it!
1.19.11.SQL客户端、启动SQL客户端、执行SQL查询、环境配置文件、重启策略、自定义函数(User-defined Functions)、构造函数参数
Implementation of map and set