I've configured a master-slave structure for my database by following this tutorial. It works well and all is fine. I mean, any new change that happens in the master, will be applied to the slave in a few secs.
Just I have 5 questions about how it works.
In the master server MySQL config file, I replaced the
bind-address
value from127.0.0.1
to the server IP itself. Why? The localhost and the server's IP aren't the same? Don't get me wrong, I'm saying the IP of the server itself, not the IP of the slave server.I want to know, either does the master send new logs to the slave (using a cron job or something) in a specific interval or the slave is keep calling the master (using a cron job or something) to see if there is any new change in the binlog file to apply on the replicated database?
What's the
mysql-relay-bin
file? I saw it on the slave server. I know there is amysql-bin
file on the master that contains the database-write-changes and the slave server uses it to update itself. But, what's the usage ofmysql-relay-bin
?There are lots of
mysql-bin
files created also in the slave server. Why? I think just those files should be in the master server. Can I delete them all from the slave server? Also, the last file ismysql-bin.000043
on the slave and the last file ismysql-bin.000004
on the master server. So, why 43 binlog files on the slave and just 4 binlog files on the master?Is there any approach to delete binlog files from the master server that have been applied to the slave server? Since they have been successfully replicated/copied to the slave server and generally we don't need them anymore.