Your SlideShare is downloading. ×
0
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Oreilly Webcast Jan 09, 2009

1,025

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
1,025
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MySQL Replication: Audit, Test & Verify Presented by Sean Hull, a business and technology consultant, author & speaker
  • 2. MySQL Relication - How
    • Master records changes to binlog
    • Slave copies master’s binlog to relaylog via it’s IO thread
    • Slave replays sql from relaylog via it’s SQL thread (5.0 statement-based rep)
  • 3. MySQL Replication - Limitations
    • Mixing transactional + non-transactional tables
    • Non-deterministic app code
      • Sysdate, current_user, load_file, uuid, user, found_rows, version
      • Session variables
        • Set max_join_size=1000
        • Insert into mytable values (@@max_join_size)
      • Locking functions - get_lock, release_lock
  • 4. Audit - Application Code
    • dev.mysql.com/doc/refman/5.0/en/
      • “ Replication Features And Issues”
    • Look for problem functions
    • Look for non-transactional tables
  • 5. Test - Replication Setup
    • Use Nagios
    • Look for:
      • Slave_IO_Running: Yes
      • Slave_SQL_Running: Yes
    • Monitor slave error log
  • 6. Verify - Use Maatkit
    • http://code.google.com/p/maatkit/
    • mk-table-checksum
      • Checksums - compare mathematically
      • Checksum table
      • Checksum timestamps
      • Propogate through replication
  • 7. Demo
    • Install Maatkit, DBI & DBD-mysql
    • Install MySQL Sandbox
    • Perform Initial Checksums
    • Add Bad Row & Verify
    • Fix Bad Row & Verify
  • 8. Install Maatkit
    • http://www.maatkit.org/
    • Relevant tools:
      • mk-table-checksum
      • mk-checksum-filter
      • mk-slave-prefetch
      • mk-slave-restart
      • mk-slave-delay
  • 9. Install MySQL Sandbox
    • Giuseppe Maxia
    • http://launchpad.net/mysql-sandbox
    • ./make_replication_sandbox mysql-linux-5.0.67.tar.gz
  • 10. Perform Initial Checksums
    • Connect to master
    • Create checksum table
    • Create sean_test table
    • Insert one row
    • Use mk-table-checksum on master
  • 11. Add Bad Row & Verify
    • Add incorrect row
    • Verify with mk-table-checksum on slave
    • Redo mk-table-checksum on master
    • Redo mk-table-checksum on slave
  • 12. Fix Bad Row & Verify
    • Use mk-table-sync
    • Use mk-table-checksum on slave
    • Show fix on slave
    • Redo mk-table-checksum on master
    • Redo mk-table-checksum on slave
  • 13. Attendee Questions
    • Moving db?
      • datadir & innodb_data_home_dir
  • 14. Attendee Questions
    • Transaction intensive updates
      • Problem of serialized writes on slave
      • Distribute schemas on multiple slaves
        • replicate_do_db
        • replicate_ignore_db
      • Prime the cache - mk-slave-prefetch
      • Row-based replication in 5.1
      • Use MyISAM storage engine on slave
      • Lag on slaves is normal - what are your app’s expectations?
      • Data archiving - do writes outside of replication
      • Trade safety for speed - disable binlog etc
  • 15. Further Reading - Books
    • High Performance MySQL 2nd Ed. - Schwartz,Zaitsev, Tkachenko, Zawodny, Lentz, Balling - O’Reilly
    • Pro MySQL - Kruckenberg & Pipes - Apress
  • 16. Further Reading - Web
    • http://www.xaprb.com
    • http://datacharmer.blogspot.com
    • http://planetmysql.com
    • http://www.mysqlperformanceblog.com
  • 17. Conclusion
    • Reliability is not automatic
    • Consistency is not automatic
    • Replication can fail without error
    • Vigilance will bear fruit
    • Use the right tools for the job
    • 5.1 row-based replication may mitigate some of these issues
  • 18. Thank You
    • Sean Hull <hullsean@gmail.com>
      • Founder, Senior Consultant
      • Heavyweight Internet Group
      • www.iheavy.com
      • Ph: +1-866-268-9448
      • Blog: www.oracleopensource.com
      • www.linkedin.com/in/hullsean

×