Mysql data replication

1,738 views
1,486 views

Published on

This is my first slide.

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

No Downloads
Views
Total views
1,738
On SlideShare
0
From Embeds
0
Number of Embeds
65
Actions
Shares
0
Downloads
63
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • Server-id = 0  master refuses connections from all slaves.Optimize for InnoDByou should use innodb_flush_log_at_trx_commit=1 and sync_binlog=1 in the master my.cnf file.Turn off firewall to make sure can connect mysql of other machine
  • In My.inimaster-connect-retry=60replicate-do-db=exampledb
  • Multi master for master overload
  • Mysql data replication

    1. 1. Ngô Anh TuấnDeveloper at Webtretho
    2. 2. » What is My SQL Data Replication?» Why we use?» Setup on Master» Setup on Slave» Code Example» Other Replication» Q&A
    3. 3. » Replication.» Asynchronous data from Master to Slave.» Master – Can Read and Write.» Slave – Only Read.
    4. 4. » Database server is overloaded.» Security.» A solution for backup.
    5. 5. » My.cnf (Linux) or My.ini (Windows)» Don’t use skip-networking param.» Enable binary log for mysql log-bin=mysql-bin binlog_format=mixed (recommend)» Set server ID server-id=1» Create user for replication (optional) CREATE USER replication_user@%; GRANT REPLICATION SLAVE , REPLICATION CLIENT ON * . * TO replication_user@%;
    6. 6. » My.cnf (Linux) or My.ini (Win)» Set server ID server-id=2» Go to mysql from command line CHANGE MASTER TO MASTER_HOST=’192.168.2.248′, MASTER_PORT=3306, MASTER_USER=’replication_user’, MASTER_PASSWORD=’PASSWORD’;» START SLAVE;» SHOW SLAVE STATUS G;
    7. 7. » Read more: http://dev.mysql.com/doc/refman/5.5/en/repli cation-howto.html http://www.jamiehurst.co.uk/mysql-tutorial- replication/
    8. 8. DEMO
    9. 9. » Config.php.» Example.php.» Using adodb.
    10. 10. » Multi Master Replication http://mysql-mmm.org/» My SQL proxy http://dev.mysql.com/downloads/mysql-proxy/» My SQL Cluster http://dev.mysql.com/doc/index-cluster.html
    11. 11. Q&A
    12. 12. Thank you!

    ×