mysql , mariadb 리플리케이션 이용중에 에러가 발생 즉 리플리케이션이 진행되고 있지 않음
1. master 서버에서 현재 상태 값 확인
1 2 3 4 5 6 7 8 9 |
MariaDB [(none)]> show master status; +--------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +--------------------+----------+--------------+------------------+ | master1-bin.000007 | 2641389 | | | +--------------------+----------+--------------+------------------+ 1 row in set (0.000 sec) MariaDB [(none)]> |
2. slave 서버에서 현재
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
MariaDB [(none)]> SHOW SLAVE STATUS \G; *************************** 1. row *************************** Slave_IO_State: Master_Host: 192.168.1.1 Master_User: replication_user Master_Port: 3306 Connect_Retry: 10 Master_Log_File: master1-bin.000004 Read_Master_Log_Pos: 254364159 Relay_Log_File: master1-relay-bin.000037 Relay_Log_Pos: 127229201 Relay_Master_Log_File: master1-bin.000004 Slave_IO_Running: No 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: 254364159 Relay_Log_Space: 139395562 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: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 1236 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'master1-bin.000004' at 254364159, the last event read from 'master1-bin.000004' at 4, the last byte read from 'master1-bin.000004' at 4.' 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: conservative 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 Slave_DDL_Groups: 255 Slave_Non_Transactional_Groups: 2564493 Slave_Transactional_Groups: 20 1 row in set (0.000 sec) ERROR: No query specified |
slave 에서 확인해보면 Slave_IO_Running 값이 No로 표시되어 있다 즉 정상적으로 리플리케이션이 진행되고 있지 않은 상태
3. slave 서버에서 우선 slave을 stop 한 다음에 다시 위에서 확인된 file 과 position값으로 업데이트
1 2 3 4 5 6 7 8 9 10 11 |
MariaDB [(none)]> stop slave; Query OK, 0 rows affected (0.002 sec) MariaDB [(none)]> change master to master_log_file='master1-bin.000007', master_log_pos=2641389, master_connect_retry=10; Query OK, 0 rows affected (0.041 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> start slave; Query OK, 0 rows affected (0.001 sec) |
4. 다시 상태값을 확인해보면 정상적으로 돌아가는것을 확인 할 수 있다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
MariaDB [(none)]> SHOW SLAVE STATUS \G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.1.1 Master_User: replication_user Master_Port: 3306 Connect_Retry: 10 Master_Log_File: master1-bin.000007 Read_Master_Log_Pos: 2643457 Relay_Log_File: master1-relay-bin.000002 Relay_Log_Pos: 2625 Relay_Master_Log_File: master1-bin.000007 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: 2643457 Relay_Log_Space: 2936 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: conservative 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 Slave_DDL_Groups: 255 Slave_Non_Transactional_Groups: 2564500 Slave_Transactional_Groups: 20 1 row in set (0.000 sec) ERROR: No query specified MariaDB [(none)]> |