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 parameter “Seconds_Behind_Master” on 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.
[email protected]:~$sudo service mysql stop
STEP 2: Go to the directory /var/lib/mysql and check the master.info file
[email protected]:~$cd /var/lib/mysql
[email protected]:~$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.
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.
[email protected]:~$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
[email protected]:~$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.
[email protected]:~$sudo vim master.info
In my case, the old IP Address is 188.8.131.52 and my new address is 184.108.40.206.
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
t[email protected]:~$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