17.2.2 Replication Relay and Status Logs 复制Relay 和状态日志;

17.2.2 Replication Relay and Status Logs  复制Relay 和状态日志;

17.2.2.1 The Slave Relay Log
17.2.2.2 Slave Status Logs


在复制过程中,一个slave server 创建几个logs 持有binary log events 中继从master 到slave,


记录信息关于当前的状态和位置 在relay log里, 有3种类型的日志 如下:

1.relay log 包含events 从master的binary log 读取 通过slave I/O thread写入。


Events 在relay log 是在slave上呗执行作为SQL thread 的一部分

2. master info log 包含了状态和当前配置信息 对于slave连接到master.

log 持有的信息关于master host name, login credentials, coordinates  表明slave 已经从master的binary log读取多远



在MySQL 5.6之前,这个log总是一个文件(master.info),但是在MySQL 5.6和以后版本,

这个日志可以写入到mysql.slave_master_info代替文件,通过--master-info-repository=TABLE

mysql> select * from mysql.slave_master_infoG;
*************************** 1. row ***************************
       Number_of_lines: 23
       Master_log_name: mysql-bin.000017
        Master_log_pos: 234940920
                  Host: 192.168.11.186
             User_name: backup
         User_password: kjk7787czcb
                  Port: 3306
         Connect_retry: 60
           Enabled_ssl: 0
                Ssl_ca: 
            Ssl_capath: 
              Ssl_cert: 
            Ssl_cipher: 
               Ssl_key: 
Ssl_verify_server_cert: 0
             Heartbeat: 1800
                  Bind: 
    Ignored_server_ids: 0
                  Uuid: d6881046-9be4-11e6-8b6a-0050568a6b1d
           Retry_count: 86400
               Ssl_crl: 
           Ssl_crlpath: 
 Enabled_auto_position: 0
1 row in set (0.00 sec)

ERROR: 
No query specified



relay log info log 持有状态信息关于在slave的relay log的执行点


在MySQL 5.6之前,日志总是一个文件(relay-log.info),但是在MySQL 5.6和以后版本,

日志可以写入到mysql.slave_relay_log_info 表带人体文件通过with --relay-log-info-repository=TABLE. 

mysql> select * from mysql.slave_relay_log_infoG;
*************************** 1. row ***************************
  Number_of_lines: 7
   Relay_log_name: ./mysqld-relay-bin.000007
    Relay_log_pos: 235865893
  Master_log_name: mysql-bin.000017
   Master_log_pos: 235865730
        Sql_delay: 0
Number_of_workers: 0
               Id: 1
1 row in set (0.00 sec)

ERROR: 
No query specified



在MySQL 5.6中,设置relay_log_info_repository and master_info_repository to 为TABLE 可以改善意外Hash的恢复能力。


从5.6.6开始,那些表是使用InnoDB表


在MySQL 5.6.5和早期版本,slave_master_info and slave_relay_log_info tables 默认是使用MyISAM 

这以为这你需要在启动复制前改变存储引擎通过执行ALTER TABLE ... ENGINE=InnoDB


ALTER TABLE mysql.slave_master_info ENGINE=InnoDB;
ALTER TABLE mysql.slave_relay_log_info ENGINE=InnoDB;



注意:

不要尝试更新或者插入lave_master_info or slave_relay_log_info table 表手动的,

这么做会导致未定义的行为,是不支持的

原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6198993.html