In case your Mysql or Mariadb replication crashed with following error, here are steps we do to recover replication:
Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'mysql-bin.006270' at 357275228, the last event read from 'mysql-bin.006270' at 4, the last byte read from 'mysql-bin.006270' at 4.'In our case was the root of problem crash of master server, therefore the slave didn't finish reading of binary log and stopped replicating.
This was the state in our slave, when on master was corrupted mysql-bin.006270:
MariaDB [(none)]> show slave status\G *************************** 1. row *************************** Slave_IO_State: Master_Host: xxx.xxx.xxx.xxx Master_User: replicator Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.006270 Read_Master_Log_Pos: 357275228 Relay_Log_File: 2_db_la-relay-bin.009230 Relay_Log_Pos: 196732452 Relay_Master_Log_File: mysql-bin.006270 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: 357275190 Relay_Log_Space: 666929161 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 'mysql-bin.006270' at 357275228, the last event read from 'mysql-bin.006270' at 4, the last byte read from 'mysql-bin.006270' at 4.' Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 11 Master_SSL_Crl: Master_SSL_Crlpath: Using_Gtid: No Gtid_IO_Pos: Replicate_Do_Domain_Ids: Replicate_Ignore_Domain_Ids: Parallel_Mode: conservative 1 row in set (0.00 sec)Solution in our case was to change master log file to next bin log file mysql-bin.006271 from position 4 and start slave again:
stop slave; CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.006271', MASTER_LOG_POS=4; start slave;