【问题标题】:MariaDB Replication stopped over New Year 2021/2022 - all seems fine, but no data flowsMariaDB 复制在 2021/2022 年新年停止 - 一切似乎都很好,但没有数据流
【发布时间】:2022-01-06 09:12:36
【问题描述】:

我正在从 Windows 上的 MariaDb 10.6 复制到 Ubuntu 20.04 LTS 上的 MariaDB(服务器版本:10.5.13-MariaDB-log MariaDB Server) 它已经工作了几个星期,但它已经停止工作,并且在新年前夕收到了最后一个数据。

在 Master 上我有以下日志:

MariaDB [stdws]> SHOW BINARY LOGS;
+----------+-----------+
| Log_name | File_size |
+----------+-----------+
| .000098  | 104857723 |
| .000099  | 104857700 |
| .000100  | 104857730 |
| .000101  | 104858096 |
| .000102  | 104857886 |
| .000103  | 104857729 |
| .000104  | 104858105 |
| .000105  | 104857803 |
| .000106  | 104857785 |
| .000107  | 104857906 |
| .000108  | 104857886 |
| .000109  | 104857790 |
| .000110  | 104857826 |
| .000111  | 104858473 |
| .000112  | 104857653 |
| .000113  |   9040227 |
+----------+-----------+

以及大师地位

MariaDB [stdws]> SHOW MASTER STATUS;
+---------+----------+--------------+------------------+
| File    | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+---------+----------+--------------+------------------+
| .000113 |  9445790 | stdws        |                  |
+---------+----------+--------------+------------------+

在客户端我的状态如下

MariaDB [stdws]> show replica status\G
*************************** 1. row ***************************
                Slave_IO_State: Waiting for master to send event
                   Master_Host: 172.29.3.10
                   Master_User: repl_client
                   Master_Port: 3306
                 Connect_Retry: 10
               Master_Log_File: .000106
           Read_Master_Log_Pos: 84917475
                Relay_Log_File: mysqld-relay-bin.000001
                 Relay_Log_Pos: 4
         Relay_Master_Log_File: .000106
              Slave_IO_Running: Yes
             Slave_SQL_Running: Yes
               Replicate_Do_DB:
           Replicate_Ignore_DB:
            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: 84917475
               Relay_Log_Space: 256
               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: 1
                Master_SSL_Crl:
            Master_SSL_Crlpath:
                    Using_Gtid: No
                   Gtid_IO_Pos:
       Replicate_Do_Domain_Ids:
   Replicate_Ignore_Domain_Ids:
                 Parallel_Mode: optimistic
                     SQL_Delay: 0
           SQL_Remaining_Delay: NULL
       Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
              Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
    Slave_Transactional_Groups: 0
1 row in set (0.001 sec)

我可以轻松地在两台机器之间 ping,但我在副本中看不到 2022 年的数据。 两台机器有1小时的时差。 (冰岛对丹麦)。

2021-12-20 10:44:44 3962 [Warning] Aborted connection 3962 to db: 'stdws' user: 'root' host: 'grafana.docker_default' (Got timeout reading communication packets)
2021-12-28 17:59:49 68303 [Warning] Aborted connection 68303 to db: 'stdws' user: 'root' host: 'grafana.docker_default' (Got timeout reading communication packets)
2021-12-31 12:16:39 5 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log '.000106' at position 84917475
2021-12-31 12:16:57 5 [ERROR] Slave I/O: error reconnecting to master 'repl_client@172.29.3.10:3306' - retry-time: 10  maximum-retries: 86400  message: Can't connect to server on '172.29.3.10' (113 "Host is unreachable"), Internal MariaDB error code: 2003
2021-12-31 12:23:40 5 [Note] Slave: connected to master 'repl_client@172.29.3.10:3306',replication resumed in log '.000106' at position 84917475

这是日志中的最后一条消息。

【问题讨论】:

  • 您的一台服务器(客户端或主服务器)找不到另一台......您是否检查了它们是否都正常且可访问(彼此)?如果他们可以相互连接,也许尝试重新启动客户端? (从显示的日志来看,这应该与“新年”有关)
  • >我可以在两台机器之间轻松 ping 通,但是我在副本中看不到 2022 年的数据。两台机器有1小时的时差。 (冰岛对丹麦)。所以网络问题似乎是短暂的?现在 IP 连接很好。
  • @AndreasM_DK 需要重建药膏。

标签: mariadb replication


【解决方案1】:

在从机上,运行:

STOP SLAVE;
START SLAVE;

如果没有唤醒它,重新初始化连接点:

STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='.000106', MASTER_LOG_POS=84917475;
START SLAVE;

如果仍然无法正常工作,请完全重新初始化从属连接:

STOP SLAVE;
RESET SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='.000106',
    MASTER_LOG_POS=84917475,
    MASTER_USER='repl_client',
    MASTER_PASSWORD='your_password',
    MASTER_HOST='172.29.3.10';
START SLAVE;

【讨论】:

  • 谢谢戈丹·博比克!我试过这个,但它没有帮助。它显示与以前相同的副本状态。
  • 当时是否会因特定交易而窒息?从机上的 CPU 是否在一个线程上达到极限?
猜你喜欢
  • 2014-06-14
  • 1970-01-01
  • 2011-12-01
  • 1970-01-01
  • 2021-02-27
相关资源
最近更新 更多