Monday, January 21, 2019

MYSQL and New IP for Master in Replication

There comes a time you might need to change the IP of a Master in a MySQL Replication setup. The steps are fairly simple.

You will need to know the IP of the Master.

Important!
When you’re using CHANGE MASTER TO to set start position for the slave you’re specifying the position for SQL thread and so you should use Relay_Master_Log_File:Exec_Master_Log_Pos. 
Otherwise, you’re going to ruin your replication.

SSH into the MYSQL SLAVE and run SHOW SLAVE STATUS
Slave_IO_State: Reconnecting after a failed master event read
Master_Host: 10.0.0.1
Master_User: replicate
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.002933
Read_Master_Log_Pos: 832187423
Relay_Log_File: mysql-relay-bin.000230
Relay_Log_Pos: 832187707
Relay_Master_Log_File: binlog.002933
Slave_IO_Running: Connecting
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: 832187423
Relay_Log_Space: 832188044
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: 2003
Last_IO_Error: error reconnecting to master 'replicate@10.0.0.1:3306' - retry-time: 60  maximum-retries: 86400  message: Can't connect to MySQL server on '10.0.0.1' (110 "Connection timed out")
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:
Look for the values

  • Read_Master_Log_Pos:
  • Exec_Master_Log_Pos:
These should be the same, note them and note Relay_Master_Log_File

  • Exec_Master_Log_Pos: 832187423
  • Relay_Master_Log_File: binlog.002933
SSH into SLAVE and run SHOW SLAVE STATUS
STOP SLAVE
CHANGE MASTER TO MASTER_HOST='xxx.xxx.xxx.xxx', MASTER_LOG_FILE='binlog.002933', MASTER_LOG_POS=832187423;
START SLAVE
SHOW SLAVE STATUS
Reference

Audio Noise Removal

Many times in record clips we end up with unwanted background noise. Recently faced with the situation, I  needed to clean up some audio and...