文章目录

1.错误日志(log_error)

1.1 作用

  1. 记录启动\关\日常运行过程中,状态信息,警告,错误

1.2 错误日志配置

  1. 默认就是开启的: /数据路径下/hostname.err
  2. 手工设定:
  3. Master [(none)]>select @@log_error;
  4. vim /etc/my.cnf
  5. log_error=/var/log/mysql.log
  6. log_timestamps=system
  7. 重启生效
  8. show variables like 'log_error';

1.3 日志内容查看

  1. 主要关注[ERROR],看上下文

2. binlog(binary logs):二进制日志 *****

2.1 作用

  1. (1)备份恢复必须依赖二进制日志
  2. (2)主从环境必须依赖二进制日志

2.2 binlog配置 (5.7必须加server_id)

  1. 注意:MySQL默认是没有开启二进制日志的。
  2. 基础参数查看:
  3. 开关:
  4. [(none)]>select @@log_bin;
  5. 日志路径及名字
  6. [(none)]>select @@log_bin_basename;
  7. 服务ID号:
  8. [(none)]>select @@server_id;
  9. 二进制日志格式:
  10. [(none)]>select @@binlog_format;
  11. 双一标准之二:
  12. [(none)]>select @@sync_binlog;

2.2.1 创建日志目录

  1. mkdir /data/binlog
  2. chown -R mysql.mysql /data/binlog

2.2.2 修改配置文件

  1. vim /etc/my.cnf
  2. server_id=6 ----->5.6中,单机可以不需要此参数
  3. log_bin=/data/binlog/mysql-bin
  4. binlog_format=row

2.2.3 重启数据库生效

  1. [root@db01 mysql]# /etc/init.d/mysqld restart

2.2.4 参数说明

  1. server_id=3306
  2. 主要是在主从复制过程中必须要加的,但是在5.7版本中,要用以下参数(log_bin),开启binlog日志,即使是单机也是必加的
  3. log_bin=/data/binlog/mysql-bin
  4. (1)开启二进制日志功能
  5. (2)设置二进制日志目录及名称前缀
  6. binlog_format=row
  7. binlog的记录格式??

2.3 binlog记录了什么?

2.3.0 引入

  1. binlogSQL层的功能。记录的是变更SQL语句,不记录查询语句。

2.3.1 记录SQL语句种类

  1. DDL :原封不动的记录当前DDL(statement语句方式)。
  2. DCL :原封不动的记录当前DCL(statement语句方式)。
  3. DML :只记录已经提交的事务DML

2.3.2 DML三种记录方式

  1. binlog_formatbinlog的记录格式)参数影响
  2. 1statement5.6默认)SBR(statement based replication) :语句模式原封不动的记录当前DML
  3. 2ROW(5.7 默认值) RBR(ROW based replication) :记录数据行的变化(用户看不懂,需要工具分析)
  4. 3mixed(混合)MBR(mixed based replication)模式 :以上两种模式的混合

2.3.3 面试题

  1. SBRRBR模式的对比
  2. STATEMENT:可读性较高,日志量少,但是不够严谨
  3. ROW :可读性很低,日志量大,足够严谨
  4. update t1 set xxx=xxx where id>1000 ? -->一共500w行,row模式怎么记录的日志
  5. 为什么row模式严谨?
  6. id name intime
  7. insert into t1 values(1,'zs',now())
  8. 我们建议使用:row记录模式

2.4 event(事件)是什么?

2.4.1 事件的简介

  1. 二进制日志的最小记录单元
  2. 对于DDL,DCL,一个语句就是一个event
  3. 对于DML语句来讲:只记录已提交的事务。
  4. 例如以下列子,就被分为了4event
  5. begin; 120 - 340
  6. DML1 340 - 460
  7. DML2 460 - 550
  8. commit; 550 - 760

2.4.2 event的组成

  1. 三部分构成:
  2. (1) 事件的开始标识
  3. (2) 事件内容
  4. (3) 事件的结束标识
  5. Position:
  6. 开始标识: at 194
  7. 结束标识: end_log_pos 254
  8. 194? 254?
  9. 某个事件在binlog中的相对位置号
  10. 位置号的作用是什么?
  11. 为了方便我们截取事件

2.5 日志文件查看

2.5.1 查看日志的开启情况

log_bin参数设置的路径,可以找到二进制日志

  1. Master [(none)]>show variables like '%log_bin%';
  2. +---------------------------------+------------------------------+
  3. | Variable_name | Value |
  4. +---------------------------------+------------------------------+
  5. | log_bin | ON |
  6. | log_bin_basename | /data/binlog/mysql-bin |
  7. | log_bin_index | /data/binlog/mysql-bin.index |
  8. | log_bin_trust_function_creators | OFF |
  9. | log_bin_use_v1_row_events | OFF |
  10. | sql_log_bin | ON |
  11. +---------------------------------+------------------------------+
  12. 6 rows in set (0.01 sec)

2.5.2 查看一共多少个binlog

  1. Master [(none)]>show binary logs;
  2. +------------------+-----------+
  3. | Log_name | File_size |
  4. +------------------+-----------+
  5. | mysql-bin.000001 | 154 |
  6. +------------------+-----------+
  7. 1 row in set (0.01 sec)
  8. Master [(none)]>flush logs;
  9. Query OK, 0 rows affected (0.03 sec)
  10. Master [(none)]>flush logs;
  11. Query OK, 0 rows affected (0.01 sec)
  12. Master [(none)]>show binary logs;
  13. +------------------+-----------+
  14. | Log_name | File_size |
  15. +------------------+-----------+
  16. | mysql-bin.000001 | 201 |
  17. | mysql-bin.000002 | 201 |
  18. | mysql-bin.000003 | 154 |
  19. +------------------+-----------+
  20. 3 rows in set (0.00 sec)
  21. Master [(none)]>

2.5.3 查看mysql正在使用的日志文件

  1. Master [(none)]>show master status;
  2. +------------------+----------+--------------+------------------+-------------------+
  3. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  4. +------------------+----------+--------------+------------------+-------------------+
  5. | mysql-bin.000003 | 154 | | | |
  6. +------------------+----------+--------------+------------------+-------------------+
  7. Master [(none)]>

file:当前MySQL正在使用的文件名 Position:最后一个事件的结束位置号

2.6 日志内容查看

2.6.1 event查看

  1. Master [binlog]>show binlog events in 'mysql-bin.000003';
  2. +------------------+-----+----------------+-----------+-------------+----------------------------------------+
  3. | Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
  4. +------------------+-----+----------------+-----------+-------------+----------------------------------------+
  5. | mysql-bin.000003 | 4 | Format_desc | 6 | 123 | Server ver: 5.7.20-log, Binlog ver: 4 |
  6. | mysql-bin.000003 | 123 | Previous_gtids | 6 | 154 | |
  7. | mysql-bin.000003 | 154 | Anonymous_Gtid | 6 | 219 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
  8. | mysql-bin.000003 | 219 | Query | 6 | 319 | create database binlog |
  9. | mysql-bin.000003 | 319 | Anonymous_Gtid | 6 | 384 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
  10. | mysql-bin.000003 | 384 | Query | 6 | 486 | use `binlog`; create table t1 (id int) |
  11. +------------------+-----+----------------+-----------+-------------+----------------------------------------+
  12. Log_namebinlog文件名
  13. Pos:开始的position *****
  14. Event_type:事件类型
  15. Format_desc:格式描述,每一个日志文件的第一个事件,多用户没有意义,MySQL识别binlog必要信息
  16. Server_idmysql服务号标识
  17. End_log_pos:事件的结束位置号 *****
  18. Info:事件内容*****
  19. 补充:
  20. SHOW BINLOG EVENTS
  21. [IN 'log_name']
  22. [FROM pos]
  23. [LIMIT [offset,] row_count]
  24. [root@db01 binlog]# mysql -e "show binlog events in 'mysql-bin.000004'" |grep drop

2.6.2 binlog文件内容详细查看

  1. mysqlbinlog /data/mysql/mysql-bin.000006
  2. mysqlbinlog --base64-output=decode-rows -vvv /data/binlog/mysql-bin.000003
  3. mysqlbinlog -d binlog /data/binlog/mysql-bin.000003
  4. [root@db01 binlog]# mysqlbinlog --start-datetime='2019-05-06 17:00:00' --stop-datetime='2019-05-06 17:01:00' /data/binlog/mysql-bin.000004

2.7 基于Position号进行日志截取

  1. 核心就是找截取的起点和终点
  2. --start-position=321
  3. --stop-position=513
  4. mysqlbinlog --start-position=219 --stop-position=1347 /data/binlog/mysql-bin.000003 >/tmp/bin.sql
  5. 案例: 使用binlog日志进行数据恢复
  6. 模拟:
  7. 1.
  8. [(none)]>create database binlog charset utf8;
  9. 2.
  10. [(none)]>use binlog;
  11. [binlog]>create table t1(id int);
  12. 3.
  13. [binlog]>insert into t1 values(1);
  14. [binlog]>commit;
  15. [binlog]>insert into t1 values(2);
  16. [binlog]>commit;
  17. [binlog]>insert into t1 values(3);
  18. [binlog]>commit;
  19. 4.
  20. [binlog]>drop database binlog;
  21. 恢复:
  22. [(none)]>show master status ;
  23. [(none)]>show binlog events in 'mysql-bin.000004';
  24. [root@db01 binlog]# mysqlbinlog --start-position=1227 --stop-position=2342 /data/binlog/mysql-bin.000004 >/tmp/bin.sql
  25. [(none)]>set sql_Log_bin=0;
  26. [(none)]>source /tmp/bin.sql
  27. 面试案例:
  28. 1. 备份策略每天全备,有全量的二进制日志
  29. 2.业务中一共10个库,其中一个被误drop
  30. 3. 需要在其他9个库正常工作过程中进行数据恢复

2.8 binlog日志的GTID新特性

2.8.1 GTID 介绍

  1. 5.6 版本新加的特性,5.7中做了加强
  2. 5.6 中不开启,没有这个功能.
  3. 5.7 中的GTID,即使不开也会有自动生成
  4. SET @@SESSION.GTID_NEXT= 'ANONYMOUS'

2.8.2. GTID(Global Transaction ID)

  1. 是对于一个已提交事务的编号,并且是一个全局唯一的编号。
  2. 它的官方定义如下:
  3. GTID = source_id transaction_id
  4. 7E11FA47-31CA-19E1-9E56-C43AA21293967:29

重要参数介绍:

  1. vim /etc/my.cnf
  2. gtid-mode=on
  3. enforce-gtid-consistency=true
  4. systemctl restart mysqld
  5. Master [(none)]>create database gtid charset utf8;
  6. Query OK, 1 row affected (0.01 sec)
  7. Master [(none)]>show master status ;
  8. +------------------+----------+--------------+------------------+----------------------------------------+
  9. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  10. +------------------+----------+--------------+------------------+----------------------------------------+
  11. | mysql-bin.000004 | 326 | | | dff98809-55c3-11e9-a58b-000c2928f5dd:1 |
  12. +------------------+----------+--------------+------------------+----------------------------------------+
  13. 1 row in set (0.00 sec)
  14. Master [(none)]>use gtid
  15. Database changed
  16. Master [gtid]>create table t1 (id int);
  17. Query OK, 0 rows affected (0.01 sec)
  18. Master [gtid]>show master status ;
  19. +------------------+----------+--------------+------------------+------------------------------------------+
  20. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  21. +------------------+----------+--------------+------------------+------------------------------------------+
  22. | mysql-bin.000004 | 489 | | | dff98809-55c3-11e9-a58b-000c2928f5dd:1-2 |
  23. +------------------+----------+--------------+------------------+------------------------------------------+
  24. 1 row in set (0.00 sec)
  25. Master [gtid]>create table t2 (id int);
  26. Query OK, 0 rows affected (0.01 sec)
  27. Master [gtid]>create table t3 (id int);
  28. Query OK, 0 rows affected (0.02 sec)
  29. Master [gtid]>show master status ;
  30. +------------------+----------+--------------+------------------+------------------------------------------+
  31. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  32. +------------------+----------+--------------+------------------+------------------------------------------+
  33. | mysql-bin.000004 | 815 | | | dff98809-55c3-11e9-a58b-000c2928f5dd:1-4 |
  34. +------------------+----------+--------------+------------------+------------------------------------------+
  35. 1 row in set (0.00 sec)
  36. Master [gtid]>begin;
  37. Query OK, 0 rows affected (0.00 sec)
  38. Master [gtid]>insert into t1 values(1);
  39. Query OK, 1 row affected (0.00 sec)
  40. Master [gtid]>commit;
  41. Query OK, 0 rows affected (0.00 sec)
  42. Master [gtid]>show master status ;
  43. +------------------+----------+--------------+------------------+------------------------------------------+
  44. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  45. +------------------+----------+--------------+------------------+------------------------------------------+
  46. | mysql-bin.000004 | 1068 | | | dff98809-55c3-11e9-a58b-000c2928f5dd:1-5 |
  47. +------------------+----------+--------------+------------------+------------------------------------------+
  48. 1 row in set (0.00 sec)
  49. Master [gtid]>begin;
  50. Query OK, 0 rows affected (0.00 sec)
  51. Master [gtid]>insert into t2 values(1);
  52. Query OK, 1 row affected (0.00 sec)
  53. Master [gtid]>commit;
  54. Query OK, 0 rows affected (0.01 sec)
  55. Master [gtid]>show master status ;
  56. +------------------+----------+--------------+------------------+------------------------------------------+
  57. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  58. +------------------+----------+--------------+------------------+------------------------------------------+
  59. | mysql-bin.000004 | 1321 | | | dff98809-55c3-11e9-a58b-000c2928f5dd:1-6 |
  60. +------------------+----------+--------------+------------------+------------------------------------------+
  61. 1 row in set (0.00 sec)

2.8.3. 基于GTID进行查看binlog

  1. 具备GTID后,截取查看某些事务日志:
  2. --include-gtids
  3. --exclude-gtids
  4. mysqlbinlog --include-gtids='dff98809-55c3-11e9-a58b-000c2928f5dd:1-6' --exclude-gtids='dff98809-55c3-11e9-a58b-000c2928f5dd:4' /data/binlog/mysql-bin.000004

2.8.4 GTID的幂等性

  1. 开启GTID后,MySQL恢复Binlog时,重复GTID的事务不会再执行了
  2. 就想恢复?怎么办?
  3. --skip-gtids
  4. mysqlbinlog --include-gtids='3ca79ab5-3e4d-11e9-a709-000c293b577e:4' /data/binlog/mysql-bin.000004 /data/binlog/mysql-bin.000004
  5. set sql_log_bin=0;
  6. source /tmp/binlog.sql
  7. set sql_log_bin=1;

2.9 使用二进制日志恢复数据案例

2.9.1 故障环境介绍

  1. 创建了一个库 db, 导入了表t1 ,t1表中录入了很多数据
  2. 一个开发人员,drop database db;
  3. 没有备份,日志都在.怎么恢复?
  4. 思路:找到建库语句到删库之前所有的日志,进行恢复.(开启了GTID模式)
  5. 故障案例模拟:
  6. (0) drop database if exists db ;
  7. (1) create database db charset utf8;
  8. (2) use db;
  9. (3) create table t1 (id int);
  10. (4) insert into t1 values(1),(2),(3);
  11. (5) insert into t1 values(4),(5),(6);
  12. (6) commit
  13. (7) update t1 set id=30 where id=3;
  14. (8) commit;
  15. (9) delete from t1 where id=4;
  16. (10)commit;
  17. (11)insert into t1 values(7),(8),(9);
  18. (12)commit;
  19. (13)drop database db;
  20. ========================
  21. drop database if exists db ;
  22. create database db charset utf8;
  23. use db;
  24. create table t1 (id int);
  25. insert into t1 values(1),(2),(3);
  26. insert into t1 values(4),(5),(6);
  27. commit;
  28. update t1 set id=30 where id=3;
  29. commit;
  30. delete from t1 where id=4;
  31. commit;
  32. insert into t1 values(7),(8),(9);
  33. commit;
  34. drop database db;
  35. =======
  36. 运行以上语句,模拟故障场景
  37. 需求:将数据库恢复到以下状态(提示第9步和第13步是误操作,其他都是正常操作)

2.9.2 恢复过程(无GTID时的恢复)

  1. 查看当前使用的 binlog文件
  1. oldguo [db]>show master status ;
  2. +------------------+----------+--------------+------------------+-------------------+
  3. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  4. +------------------+----------+--------------+------------------+-------------------+
  5. | mysql-bin.000006 | 1873 | | | |
  6. +------------------+----------+--------------+------------------+-------------------+
  7. 2.查看事件:
  8. 第一段:
  9. | mysql-bin.000006 | 813 | Query | 1 | 907 | use `db`; create table t1 (id int) |
  10. | mysql-bin.000006 | 907 | Query | 1 | 977 | BEGIN |
  11. | mysql-bin.000006 | 977 | Table_map | 1 | 1020 | table_id: 77 (db.t1) |
  12. | mysql-bin.000006 | 1020 | Write_rows | 1 | 1070 | table_id: 77 flags: STMT_END_F |
  13. | mysql-bin.000006 | 1070 | Table_map | 1 | 1113 | table_id: 77 (db.t1) |
  14. | mysql-bin.000006 | 1113 | Write_rows | 1 | 1163 | table_id: 77 flags: STMT_END_F |
  15. | mysql-bin.000006 | 1163 | Xid | 1 | 1194 | COMMIT /* xid=74 */ |
  16. | mysql-bin.000006 | 1194 | Query | 1 | 1264 | BEGIN |
  17. | mysql-bin.000006 | 1264 | Table_map | 1 | 1307 | table_id: 77 (db.t1) |
  18. | mysql-bin.000006 | 1307 | Update_rows | 1 | 1353 | table_id: 77 flags: STMT_END_F |
  19. | mysql-bin.000006 | 1353 | Xid | 1 | 1384 | COMMIT /* xid=77 */
  20. mysqlbinlog --start-position=813 --stop-position=1384 /data/mysql/mysql-bin.000006 >/tmp/bin1.sql

第二段:

  1. | mysql-bin.000006 | 1568 | Query | 1 | 1638 | BEGIN |
  2. | mysql-bin.000006 | 1638 | Table_map | 1 | 1681 | table_id: 77 (db.t1) |
  3. | mysql-bin.000006 | 1681 | Write_rows | 1 | 1731 | table_id: 77 flags: STMT_END_F |
  4. | mysql-bin.000006 | 1731 | Xid | 1 | 1762 | COMMIT /* xid=81 */
  5. mysqlbinlog --start-position=1568 --stop-position=1762 /data/mysql/mysql-bin.000006 >/tmp/bin2.sql

3.恢复

  1. set sql_log_bin=0;
  2. source /tmp/bin1.sql
  3. source /tmp/bin2.sql
  4. set sql_log_bin=1;
  5. oldguo [db]>select * from t1;
  6. +------+
  7. | id |
  8. +------+
  9. | 1 |
  10. | 2 |
  11. | 30 |
  12. | 4 |
  13. | 5 |
  14. | 6 |
  15. | 7 |
  16. | 8 |
  17. | 9 |

2.9.3 有GTID的恢复:

(1)截取

  1. mysqlbinlog --skip-gtids --include-gtids='3ca79ab5-3e4d-11e9-a709-000c293b577e:7-12' mysql-bin.000004> /tmp/bin.sql

(2)恢复

  1. set sql_log_bin=0;
  2. source /tmp/bin.sql

2.10二进制日志其他操作

2.10.1 自动清理日志

  1. show variables like '%expire%';
  2. expire_logs_days 0
  3. 自动清理时间,是要按照全备周期+1
  4. set global expire_logs_days=8;
  5. 永久生效:
  6. my.cnf
  7. expire_logs_days=15;
  8. 企业建议,至少保留两个全备周期+1binlog

2.10.2 手工清理

  1. PURGE BINARY LOGS BEFORE now() - INTERVAL 3 day;
  2. PURGE BINARY LOGS TO 'mysql-bin.000010';
  3. 注意:不要手工 rm binlog文件
  4. 1. my.cnf binlog关闭掉,启动数据库
  5. 2.把数据库关闭,开启binlog,启动数据库
  6. 删除所有binlog,并从000001开始重新记录日志

*reset master; 主从关系中,主库执行此操作,主从环境必崩

2.10.3 日志是怎么滚动

  1. flush logs;
  2. 重启mysql也会自动滚动一个新的
  3. 日志文件达到1G大小(max_binlog_size)
  4. | max_binlog_size | 1073741824
  5. 备份时,加入参数也可以自动滚动

3.slow_log 慢日志

3.1 作用:

  1. 记录慢SQL语句的日志,定位低效SQL语句的工具日志

3.2 开启慢日志(默认没开启)

  1. 开关:
  2. slow_query_log=1
  3. 文件位置及名字
  4. slow_query_log_file=/data/mysql/slow.log
  5. 设定慢查询时间:
  6. long_query_time=0.1
  7. 没走索引的语句也记录:
  8. log_queries_not_using_indexes
  9. vim /etc/my.cnf
  10. slow_query_log=1
  11. slow_query_log_file=/data/mysql/slow.log
  12. long_query_time=0.1
  13. log_queries_not_using_indexes
  14. systemctl restart mysqld

3.3 mysqldumpslow 分析慢日志

  1. mysqldumpslow -s c -t 10 /data/mysql/slow.log
  2. # 第三方工具(自己扩展)
  3. https://www.percona.com/downloads/percona-toolkit/LATEST/
  4. yum install perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-IO-Socket-SSL perl-Digest-MD5
  5. toolkit工具包中的命令:
  6. ./pt-query-diagest /data/mysql/slow.log
  7. Anemometer基于pt-query-digestMySQL慢查询可视化

作者:wwwoldguocom链接:https://www.jianshu.com/p/00c54d2832ed来源:简书著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
e=/data/mysql/slow.log
long_query_time=0.1
log_queries_not_using_indexes
systemctl restart mysqld


  1. ## 3.3 mysqldumpslow 分析慢日志
  2. ```cpp
  3. mysqldumpslow -s c -t 10 /data/mysql/slow.log
  4. # 第三方工具(自己扩展)
  5. https://www.percona.com/downloads/percona-toolkit/LATEST/
  6. yum install perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-IO-Socket-SSL perl-Digest-MD5
  7. toolkit工具包中的命令:
  8. ./pt-query-diagest /data/mysql/slow.log
  9. Anemometer基于pt-query-digest将MySQL慢查询可视化

作者:wwwoldguocom链接:https://www.jianshu.com/p/00c54d2832ed来源:简书著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

MySQL系列之——错误日志(log_error)、二进制日志(binary logs)、慢日志(slow_log)的更多相关文章

  1. 日志记录:MySQL系列之十一

    一.SQL命令历史 ~/.mysql_history 记录了在mysql中执行的命令历史 二.事务日志 transaction log:事务型存储引擎自行管理和使用 在一个事务提交后还没有存到磁盘的情 ...

  2. mysql之 日志体系(错误日志、查询日志、二进制日志、事务日志、中继日志)

    一. mysql错误日志:错误日志记录的事件:a).服务器启动关闭过程中的信息b).服务器运行过程中的错误信息c).事件调试器运行一个事件时间生的信息d).在从服务器上启动从服务器进程时产生的信息lo ...

  3. mysql基础之日志管理(查询日志、慢查询日志、错误日志、二进制日志、中继日志、事务日志)

    日志文件记录了MySQL数据库的各种类型的活动,MySQL数据库中常见的日志文件有 查询日志,慢查询日志,错误日志,二进制日志,中继日志 ,事务日志. 修改配置或者想要使配置永久生效需将内容写入配置文 ...

  4. mysql 开发进阶篇系列 39 mysql日志之二进制日志(binlog)

    一.概述 二进制日志(binlog)记录了所有的DDL(数据定义语言)语句和DML(数据操纵语言)语句,但是不包括数据查询语句, 语句以"事件"的形式保存,它描述了数据的更改过程, ...

  5. MySQL系列(五)--二进制日志对主从复制的影响

    MySQL复制是基于主库上的二进制日志来完成,复制是异步的,可能存在延迟 MySQL日志分为: 1.服务层日志:二进制日志.通用日志.慢查日志 2.存储引擎层日志:innodb中重做日志和回滚日志 二 ...

  6. MySQL系列详解三:MySQL中各类日志详解-技术流ken

    前言 日志文件记录了MySQL数据库的各种类型的活动,MySQL数据库中常见的日志文件有 查询日志,慢查询日志,错误日志,二进制日志,中继日志 .下面分别对他们进行介绍. 查询日志 1.查看查询日志变 ...

  7. 实战:mysql检查物理磁盘中的二进制日志文件是否有丢失

    版权声明:日常札记,乐于分享 https://blog.csdn.net/yangzhawen/article/details/32103555 场景:有时候由于磁盘损坏或人为原因错误删除了磁盘中的二 ...

  8. MySQL-五种日志(查询日志、慢查询日志、更新日志、二进制日志、错误日志)、备份及主从复制配置

    开启查询日志: 配置文件my.cnf: log=/usr/local/mysql/var/log.log 开启慢查询: 配置文件my.cnf: log-slow-queries=/usr/local/ ...

  9. Mysql 系列 | 日志模块

    了解了 SQL 执行的流程,知道每一条语句都经过连接器.查询存储.分析器.优化器.执行器最后到存储引擎的过程.查询语句是如此,更新语句也不例外. 不同的是,更新语句会修改表数据,这里就涉及到两个重要的 ...

  10. day43 mysql 基本管理,[破解密码以及用户权限设置]以及慢日志查询配置

    配置文件:详细步骤, 1,找到mysql的安装包,然后打开后会看到一个my.ini命名的程序,把它拖拽到notepad++里面来打开,(应该是其他文本形式也可以打开,可以试一下),直接拖拽即可打开该文 ...

随机推荐

  1. CKS 考试题整理 (15)-镜像扫描ImagePolicyWebhook

    Context cluster 上设置了容器镜像扫描器,但尚未完全集成到cluster 的配置中. 完成后,容器镜像扫描器应扫描并拒绝易受攻击的镜像的使用. Task 注意:你必须在 cluster ...

  2. 4. SpringMVC获取请求参数

    1. 通过 ServletAPI 获取 ‍ 将 HttpServletRequest 作为控制器方法的形参 , 此时 HttpServletRequest 类型的参数表示封装了当前请求的请求报文的对象 ...

  3. Dlang 并行化

    Dlang 并行化 好难受,dlang 生态太差,没办法,学了半天才明白. 我尽量以精炼的语言解释. 采用 定义,例子(代码),解释 的步骤讲解. 所以你可能看到很多代码,一点解释-- 我会省略一些 ...

  4. 龙芯电脑编译redis (loongarch)

    1.获取源码 源码地址:https://redis.io/download/#redis-downloads 最新版本是7.2,这里用redis5测试,最后一个版本是5.0.14 wget https ...

  5. Dubbo 我手写几行代码,就把通信模式给你解释清楚!

    作者:小傅哥 博客:https://bugstack.cn 原文:https://bugstack.cn/md/road-map/road-map.html 沉淀.分享.成长,让自己和他人都能有所收获 ...

  6. UI自动化打开游览器失败 elenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 90

    原因是: 驱动和当前游览器版本不一致 查看游览器版本: 下载对应驱动: http://npm.taobao.org/mirrors/chromedriver/ 在自己电脑上 找到原来驱动的存放位置 将 ...

  7. 通过ssh远程执行kubectl命令报错问题

    在使用Jenkins链接Kubernetes集群,如果Jenkins安装机器与Kubernetes Master节点不在同一台机器上面,需要使用ssh远程执行部署命令,如下: ssh root@10. ...

  8. Hive安装与启动

    一.mysql安装 在配置Hive之前一般都需要安装和配置MySQL,因为Hive为了能操作HDFS上的数据集,那么他需要知道数据的切分格式,如行列分隔符,存储类型,是否压缩,数据的存储地址等信息. ...

  9. 获取Rtx用户状态方法

    背景:企业OA系统需要与Rtx集成,且高权限身份用户需要获取符合某一条下的所有员工rtx状态... 方案:以此背景,基于rtx sdk做二次开发, 1.后台调用RootObj.QueryUserSta ...

  10. 如何用 ModelScope 实现 “AI 换脸” 视频

    前言 当下,视频内容火爆,带有争议性或反差大的换脸视频总能吸引人视线.虽然 AI 换脸在市面上已经流行了许久,相关制作工具或移动应用也是数不胜数.但是多数制作工具多数情况下不是会员就是收费,而且替换模 ...