Relocate binary logs and relay logs in MySQL server manually
- Posted by Gayan
- Posted in Uncategorized
Objective: Relocating binary logs and relay logs in MySQL slave database to another location.
Operating System: Ubuntu 12.10
Database : MySQL 5.6.
First of all, let’s check if the replication is active or not.
Identify current location of binary logs and relay logs
Since we haven’t specified a location for relay logs and relay log index file, the data directory path will be chosen by default. In this case we have to determine datadir path as well.
Let’s create a new directory to store binary logs and relay logs.
Next step is to stop MySQL and copy binlogs and relay logs to the new location.
Copy binary logs to the new location; along with the index file.
Copy relay logs to new location along with the index file.
Next step is to modify relay-log.info file which is located in datadir and specify the absolute path to the relay logs.
Also modify binary log index file and slave log index files so that those contain absolute path to the logs(New path)
Add new location variables to my.cnf file
Grant necessary permission to mysql user to the new location.
Modify apparmor configurations so that mysql user has necessary permission
And finally we can check if the status of the replication