All of them know how does the MySQL replication works.But here I gave a diagrammatic representation of MySQL Replication It looks something different to you at first sight.
Replication is a process that allows you to easily maintain multiple
copies of a MySQL data by having them copied automatically from a master
to a slave database.In replication two logs are used to read the events in master server and in slave server.
In master server the changes happen in every database will be recorded in binlog file if it is enabled and by default it is disable.The binary log file stores the data that replication slave will read when its get connected to master server.
Relay log :
The relay log is like the binary log, consists of a set of
numbered files containing events that describe database changes,
and an index file that contains the names of all used relay log
files.It records the events from master using a slave thread called IO thread.
Threads :
Threads are use to connect master to slave and do changes in slave databases.There are two types of slave threads at here,
I) IO Thread
II) SQL Thread
IO Thread :
It use to read the binlog events from master to slave relay log when it gets connected to master server.We can see that which file is reading from master to slave by seeing variables like Master_Log_File and Read_Master_Log_Pos.
It reads the events from relay log to do the changes in slave databases and keep it up to date the databases like master databases.Once the event processed by the SQL thread the relay log will delete the processed event.We can read the currents process in sql thread by seeing Relay_Master_Log_File and Exec_Master_Log_Pos.
Master_Slave :
Master_Slave :
Here In the above figure the arrows indicates the process step by step in replication process.
Thanks...
thank u soo much sir .........
ReplyDeletemore useful for me
ReplyDelete