Your SlideShare is downloading. ×
0
<ul><ul><li>MySql Replication </li></ul></ul><ul><ul><li>Abhijith.V </li></ul></ul><ul><ul><li>Poornam Info Vision </li></...
<ul><ul><li>This Session Includes </li></ul></ul><ul><ul><li>Basics of  Replcation  </li></ul></ul><ul><ul><li>Why Replica...
Replication Basics <ul><li>Master / Slave Structure . </li></ul><ul><li>Master records all write queries in the binary log...
Basics Contd ... <ul><li>Masters are mostly unaware of their slaves </li></ul><ul><li>Replication is asynchronous </li></ul>
Why Replication ? <ul><li>Need a hot spare </li></ul><ul><li>Make backups easier </li></ul><ul><li>Load balancing </li></u...
Types of Replication <ul><li>Synchronous Data Replication </li></ul><ul><li>Asynchronous Replication </li></ul>
Synchronous Replication <ul><li>Master Server waits for the data to have been recorded on the duplicated systems. </li></u...
Two-phase commit protocol <ul><li>Two Phases </li></ul><ul><li>Commit-request phase </li></ul><ul><li>Commit phase </li></...
 
 
Asynchronous Replication <ul><li>Write is considered complete as soon as local storage acknowledges.  </li></ul><ul><li>Pe...
Lets Go to Mysql
 
Replication Techniques In Mysql Mysql Clustering   --- Uses Synchronous  replication  Mysql Replication  --- Uses Asynchro...
Replication In Mysql <ul><li>Configure replication account on the master </li></ul><ul><li>Enable binary log on the master...
SetUp Mysql Replication
Creating a User for Replication <ul><li>Slave will connect to master using this user-password </li></ul><ul><li>Account sh...
Setting the  Master Configuration <ul><li>Enable binary logging on the master </li></ul><ul><li>Setup a server-id for the ...
See an Example
Setting the  Slave Configuration <ul><li>Master-host </li></ul><ul><li>Master-user </li></ul><ul><li>Master-password </li>...
Example Conf:
Lets Finish UP the Master Server <ul><li>Stop the Mysql Master server. </li></ul><ul><li>Get the current server status usi...
SHOW MASTER STATUS
Lets Finish UP the Slaves <ul><li>Restore the Mysql data from the Server. </li></ul><ul><li>You can use mysqldump or LOAD ...
SetUP Is Over !!! . Now Show me a Replicated System
Nothing is perfect. So “Me” too .. <ul><li>No Switching of Masters During Failover  </li></ul><ul><li>Your applications mu...
That’s it.  I’m done !!     IF  [ Any Questions ] then  Lets Discuss else  Thank You :)
Upcoming SlideShare
Loading in...5
×

Mysql

1,819

Published on

My replication Basics

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,819
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
68
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Transcript of "Mysql"

  1. 1. <ul><ul><li>MySql Replication </li></ul></ul><ul><ul><li>Abhijith.V </li></ul></ul><ul><ul><li>Poornam Info Vision </li></ul></ul><ul><ul><li>Date: 22-06-2008 </li></ul></ul>
  2. 2. <ul><ul><li>This Session Includes </li></ul></ul><ul><ul><li>Basics of Replcation </li></ul></ul><ul><ul><li>Why Replication </li></ul></ul><ul><ul><li>Types Of Replication </li></ul></ul><ul><ul><li>Replication For Mysql </li></ul></ul><ul><ul><li>Configuring Mysql Replication </li></ul></ul><ul><ul><li>Test a Replicated Mysql S/M </li></ul></ul><ul><ul><li>Discussion </li></ul></ul>
  3. 3. Replication Basics <ul><li>Master / Slave Structure . </li></ul><ul><li>Master records all write queries in the binary log. </li></ul><ul><li>Slaves read the binary log from the master and run the queries locally . </li></ul><ul><li>A master can have many slaves </li></ul><ul><li>A slave can have only one master </li></ul><ul><li>A server can be both a master and a slave </li></ul>
  4. 4. Basics Contd ... <ul><li>Masters are mostly unaware of their slaves </li></ul><ul><li>Replication is asynchronous </li></ul>
  5. 5. Why Replication ? <ul><li>Need a hot spare </li></ul><ul><li>Make backups easier </li></ul><ul><li>Load balancing </li></ul><ul><li>Put data closer to users </li></ul>
  6. 6. Types of Replication <ul><li>Synchronous Data Replication </li></ul><ul><li>Asynchronous Replication </li></ul>
  7. 7. Synchronous Replication <ul><li>Master Server waits for the data to have been recorded on the duplicated systems. </li></ul><ul><li>Uses the two-phase commit technology to protect data integrity </li></ul><ul><li>Atomic write operation </li></ul><ul><li>Write either completes on both sides or not at all </li></ul>
  8. 8. Two-phase commit protocol <ul><li>Two Phases </li></ul><ul><li>Commit-request phase </li></ul><ul><li>Commit phase </li></ul><ul><li>Used in mysql Clustering. </li></ul><ul><li>Disadvantage : Blocking protocol </li></ul>
  9. 11. Asynchronous Replication <ul><li>Write is considered complete as soon as local storage acknowledges. </li></ul><ul><li>Performance is greatly increased. No need for two-phase commit protocol. </li></ul><ul><li>In case of losing a local storage, the remote storage is not guaranteed to have the current copy of data </li></ul>
  10. 12. Lets Go to Mysql
  11. 14. Replication Techniques In Mysql Mysql Clustering --- Uses Synchronous replication Mysql Replication --- Uses Asynchronous replication
  12. 15. Replication In Mysql <ul><li>Configure replication account on the master </li></ul><ul><li>Enable binary log on the master -my.cnf file </li></ul><ul><li>Snapshot master and reset log </li></ul><ul><li>Install snapshot on the slave </li></ul><ul><li>Setup replication options on slave-my.cnf file </li></ul><ul><li>Restart the slave </li></ul>
  13. 16. SetUp Mysql Replication
  14. 17. Creating a User for Replication <ul><li>Slave will connect to master using this user-password </li></ul><ul><li>Account should have a REPLICATION SLAVE privilege </li></ul><ul><li>GRANT REPLICATION SLAVE ON *.* TO 'slave'@'%' IDENTIFIED BY 'matrix'; </li></ul>
  15. 18. Setting the Master Configuration <ul><li>Enable binary logging on the master </li></ul><ul><li>Setup a server-id for the master </li></ul><ul><li>Ensure that the skip-networking option has not been enabled. </li></ul><ul><li>You can also set maximum log size using max_binlog_size. </li></ul>
  16. 19. See an Example
  17. 20. Setting the Slave Configuration <ul><li>Master-host </li></ul><ul><li>Master-user </li></ul><ul><li>Master-password </li></ul><ul><li>Replicate-do-db </li></ul><ul><li>Master-connect-retry </li></ul><ul><li>Server-id (Should be unique) </li></ul>
  18. 21. Example Conf:
  19. 22. Lets Finish UP the Master Server <ul><li>Stop the Mysql Master server. </li></ul><ul><li>Get the current server status using 'SHOW MASTER STATUS ' </li></ul><ul><li>This will return masters current point within the master binary log . </li></ul><ul><li>Ship the current data (If any) to salves . </li></ul>
  20. 23. SHOW MASTER STATUS
  21. 24. Lets Finish UP the Slaves <ul><li>Restore the Mysql data from the Server. </li></ul><ul><li>You can use mysqldump or LOAD DATA FROM MASTER; </li></ul><ul><li>Stop the Slave. </li></ul><ul><li>CHANGE MASTER TO MASTER_HOST='192.168.1.38', MASTER_USER='slave',MASTER_PASSWORD='matrix', MASTER_LOG_FILE='mysql-bin.000004', MASTER_LOG_POS=79; </li></ul>
  22. 25. SetUP Is Over !!! . Now Show me a Replicated System
  23. 26. Nothing is perfect. So “Me” too .. <ul><li>No Switching of Masters During Failover </li></ul><ul><li>Your applications must be replication-aware, so that they will write on the master and read from the slaves. </li></ul><ul><li>The remote storage is not guaranteed to have the current copy of data . </li></ul>
  24. 27. That’s it. I’m done !! IF [ Any Questions ] then Lets Discuss else Thank You :)
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×