mysql 5.1升级到5.611

2022-04-23 12:46:05 浏览数 (1)

同步一段时间过后

代码语言:javascript复制
mysql> show slave statusG
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.100.123
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000900
          Read_Master_Log_Pos: 766875783
               Relay_Log_File: relay-bin.000004
                Relay_Log_Pos: 766875942
        Relay_Master_Log_File: mysql-bin.000900
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: mysql,feeddb,mytempdb
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 766875783
              Relay_Log_Space: 766876148
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 3
                  Master_UUID: 
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
1 row in set (0.00 sec)

mysql> 

检查数据一致性

同步完成后,检查一致性,抽查一个关键表

代码语言:javascript复制
[root@upgrade-slave ~]# pt-table-checksum --nocheck-replication-filters --nocheck-binlog-format --replicate=test.checksum --tables key_db.users  h=upgrade-master,u=root --ask-pass 
Enter MySQL password: 
Checksumming key_db.users:   8% 05:38 remain
Checksumming key_db.users:  16% 05:13 remain
Checksumming key_db.users:  25% 04:29 remain
Checksumming key_db.users:  35% 03:48 remain
Checksumming key_db.users:  43% 03:20 remain
Checksumming key_db.users:  50% 03:02 remain
Checksumming key_db.users:  55% 02:55 remain
Checksumming key_db.users:  59% 02:45 remain
Checksumming key_db.users:  63% 02:37 remain
Checksumming key_db.users:  68% 02:23 remain
Checksumming key_db.users:  73% 02:04 remain
Checksumming key_db.users:  78% 01:40 remain
Checksumming key_db.users:  84% 01:14 remain
Checksumming key_db.users:  90% 00:48 remain
Checksumming key_db.users:  95% 00:22 remain
            TS ERRORS  DIFFS     ROWS  CHUNKS SKIPPED    TIME TABLE
11-26T22:56:42      0     11 14940167     153       0 562.858 key_db.users
[root@upgrade-slave ~]#
[root@upgrade-slave ~]# pt-table-sync --replicate test.checksum  h=upgrade-slave,u=root --ask-pass  --sync-to-master --databases=key_db  --tables=users  --print > /tmp/users.sql
Enter password for upgrade-slave: 
[root@upgrade-slave ~]# 
[root@upgrade-slave ~]# wc -l /tmp/users.sql 
1 /tmp/users.sql
[root@upgrade-slave ~]# cat /tmp/users.sql 

[root@upgrade-slave ~]#

没有发现不一致数据,一致性检查通过

然后找一个业务低点进行业务切换


原文地址

0 人点赞