reconnecting after a failed master event read.

So the error came due my MASTER HOST get changed and given the error: slave_io_state reconnecting after a failed master event read.

When we have checked the parameterSeconds_Behind_Masteron the slave status of the MySQL is showing more than 8 hours behind in seconds.

mysql> show slave status\G;

You can check the error you will get like “Reconnecting after a failed master event read” at the parameter SLAVE_IO_STATE.

So now we have to change the host into the slave, Let’s look at the step after we change the MASTER HOST.

STEP 1: Stop the MySQL server on Slave Environment.

tastethelinux-ashish@tla:~$sudo service mysql stop

STEP 2: Go to the directory /var/lib/mysql and check the master.info file

tastethelinux-ashish@tla:~$cd /var/lib/mysql
tastethelinux-ashish@tla:~$ls master.info

So, the master.info file contains important information like MASTER_UUID, MASTER_HOST, MASTER_USER, Master_Port, Master_Retry_Count, and many other entries has been there in this.

reconnecting after a failed master event read.
screenshot of the master.info file in MySQL.

STEP 3: Take the Back of master.info File

This is the most important part, if you make any changes in the file, please take the backup first.

tastethelinux-ashish@tla:~$cp master.info master.info.bak

STEP 4: Check the lines and make the changes in master.info

So, we have to check the line in the master.info for the safer side

tastethelinux-ashish@tla:~$sudo wc -l < master.info

You guys can see I got the output as 22, Means I have 22 lines in the master.info file.

NOTE: It can be different in your case.

Now, Let’s change the Domain name or the IP address.

tastethelinux-ashish@tla:~$sudo vim master.info

In my case, the old IP Address is 172.152.0.1 and my new address is 172.155.0.14.

I have done with my changes and it’s time to save and quit the file.

You have to again check the line number by using the command wc -l < master.info and that should be the same as the previous output that is 22.

STEP 5: Start the server without replication

tastethelinux-ashish@tla:~$service mysql start --skip-slave-start

After that login to the MySQL slave server and check the status of the MySQL.

mysql>SHOW SLAVE STATUS\G;

You will see that the IP Address that you have changed is the same in the MASTER_HOST parameter.

Then we have to start the slave and check the status

mysql>START SLAVE;SHOW SLAVE STATUS\G;

Just have a look that the Seconds_Behind_Master has been decreasing.

Check out the error regarding error 1062 mysql duplicate entry and mysql incorrect timezone, Mysql Install on Linux(CentOS/Ubuntu)

change master host mysql replication, change master host, change master host ip, mysql change master host ip, mysql slave change master host, mysql replication slave_io_state connecting to master, mysql slave error connecting to master

Give your valuable time