MySQL High Availability Sprint:      Launch the Pacemaker!                      Florian Haas                           has...
MySQL HA Sprint: Get Prepared!●   Please grab a DVD from your table!    ●   We have 12 in total – please share if needed!●...
Florian HaasCEO & Principal Consultant, hastexo http://www.hastexo.com/who/florian               florian@hastexo.com
Visual Cues & CluesHow to follow this talk easily
This layout means:                   Would you treat meto the courtesy of your kind attention?
This layout means:●   Id ask you to do this,●   and this,●   and this.
Our virtual environment
An Overviewof the Linux HA stack           (for MySQL)
Application Interface   MySQL RACluster Resource Mgmt   PacemakerCluster Messaging       CorosyncStorage Replication      ...
Physical   DRBD     Physical          Host                Host         MySQL         MasterMySQL    MySQL      MySQL     A...
Physical   DRBD     Physical          Host                Host                             MySQL                          ...
DRBDhttp://www.hastexo.com/knowledge/drbd                    http://www.drbd.org      DRBD & the DRBD logo are registered ...
Create a DRBD resource!●   Name:            mysql●   Device name:     /dev/drbd0●   Backing disk:    /dev/sdb1●   Meta dat...
Corosynchttp://www.hastexo.com/knowledge/corosync                    http://www.corosync.org
Create a Corosync Cluster!●   Enable secauth●   2 rings, RRP mode: active●   Multicast addresses: 239.255.42.0 and .1●   N...
Pacemakerhttp://www.hastexo.com/knowledge/pacemaker                    http://www.clusterlabs.org
Create a Pacemaker Cluster●   Add the “pacemaker” service to /etc/corosync.d●   Use ver: 1●   Restart corosync●   Start pa...
STONITH/Fencing
Set up your cluster●   Open the shell with crm configure●   Set no-quorum-policy to ignore●   Disable STONITH    ●   Kids,...
Pacemaker Resources
Set up a floating IP address●   Add an IPaddr2 resource    ●   Name: p_ip_mysql    ●   IP: 192.168.122.110    ●   CIDR Net...
Resource monitoring
Add resource monitoring●   Add a monitor operation to p_ip_mysql    ●   Interval: 10s●   Commit the configuration●   Manua...
Master/Slave Sets
Startedstart             stop        Stopped
Started                  Startedstart             stop   start             stop        Stopped                  Stopped
Master                         promote            demote         Slave                     Slavestart             stop    ...
Add a DRBD Master/Slave Set●   Create the DRBD primitive p_drbd_mysql    ●   Use the ocf:linbit:drbd RA    ●   Add 2 monit...
Constraints
Create a Filesystem●   Run mkfs -t ext3 on whichever node is the Master●   Add the Filesystem resource    ●   Name:       ...
Groups
Add a Group●   Create the g_mysql resource group●   Add p_fs_mysql and p_ip_mysql●   Watch the constraints update automagi...
And Finally: MySQL!
Add the MySQL resource●   Run mysql_install_db●   Create an ocf:heartbeat:mysql primitive p_mysql●   Set additional_parame...
One more thing...
Physical   DRBD     Physical          Host                Host                             MySQL                          ...
Physical   DRBD     Physical          Host                Host                             MySQL                          ...
Physical                 Physical             Host                     Host            MySQL                        InnoDB...
Physical            Physical          Host                Host         MySQL         MasterMySQL    MySQL      MySQL     A...
Further Information  http://www.hastexo.comhttp://twitter.com/hastexo
Liked this talk?●   Go to www.hastexo.com/shoutbox●   Log in    (you can just use your OpenID from Wordpress,    Blogger, ...
Upcoming SlideShare
Loading in …5
×

MySQL High Availability Sprint: Launch the Pacemaker

2,535 views

Published on

Tutorial presented at Percona Live UK 2011

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

No Downloads
Views
Total views
2,535
On SlideShare
0
From Embeds
0
Number of Embeds
212
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

MySQL High Availability Sprint: Launch the Pacemaker

  1. 1. MySQL High Availability Sprint: Launch the Pacemaker! Florian Haas hastexo
  2. 2. MySQL HA Sprint: Get Prepared!● Please grab a DVD from your table! ● We have 12 in total – please share if needed!● Follow instructions in README.pdf.● If your laptop does not have a DVD drive, please see me for a USB stick.● For any questions, Im the guy in the blue shirt who answers to “Florian”. When in doubt, just holler.
  3. 3. Florian HaasCEO & Principal Consultant, hastexo http://www.hastexo.com/who/florian florian@hastexo.com
  4. 4. Visual Cues & CluesHow to follow this talk easily
  5. 5. This layout means: Would you treat meto the courtesy of your kind attention?
  6. 6. This layout means:● Id ask you to do this,● and this,● and this.
  7. 7. Our virtual environment
  8. 8. An Overviewof the Linux HA stack (for MySQL)
  9. 9. Application Interface MySQL RACluster Resource Mgmt PacemakerCluster Messaging CorosyncStorage Replication DRBD(optional)
  10. 10. Physical DRBD Physical Host Host MySQL MasterMySQL MySQL MySQL App App Slave Slave Slave Server Server
  11. 11. Physical DRBD Physical Host Host MySQL MasterMySQL MySQL MySQL App App Slave Slave Slave Server Server
  12. 12. DRBDhttp://www.hastexo.com/knowledge/drbd http://www.drbd.org DRBD & the DRBD logo are registered trademarks of Linbit Information Technologies
  13. 13. Create a DRBD resource!● Name: mysql● Device name: /dev/drbd0● Backing disk: /dev/sdb1● Meta data: internal● Replication: 192.168.133.111 ↔ 112 Port 7788Hint: use “legacy” (pre-8.4) DRBD Users Guide
  14. 14. Corosynchttp://www.hastexo.com/knowledge/corosync http://www.corosync.org
  15. 15. Create a Corosync Cluster!● Enable secauth● 2 rings, RRP mode: active● Multicast addresses: 239.255.42.0 and .1● Network addresses: 192.168.122.0 and .133.0● No logging to files, syslog only● Start Corosync● Check connectivity (corosync-cfgtool -s)
  16. 16. Pacemakerhttp://www.hastexo.com/knowledge/pacemaker http://www.clusterlabs.org
  17. 17. Create a Pacemaker Cluster● Add the “pacemaker” service to /etc/corosync.d● Use ver: 1● Restart corosync● Start pacemakerd● Verify both nodes have joined the cluster (crm_mon)
  18. 18. STONITH/Fencing
  19. 19. Set up your cluster● Open the shell with crm configure● Set no-quorum-policy to ignore● Disable STONITH ● Kids, dont do this at home!● Commit the configuration
  20. 20. Pacemaker Resources
  21. 21. Set up a floating IP address● Add an IPaddr2 resource ● Name: p_ip_mysql ● IP: 192.168.122.110 ● CIDR Netmask: 24 ● NIC: eth0● Commit the configuration
  22. 22. Resource monitoring
  23. 23. Add resource monitoring● Add a monitor operation to p_ip_mysql ● Interval: 10s● Commit the configuration● Manually delete the IP address● Watch with crm_mon -rf● Observe resource recovery
  24. 24. Master/Slave Sets
  25. 25. Startedstart stop Stopped
  26. 26. Started Startedstart stop start stop Stopped Stopped
  27. 27. Master promote demote Slave Slavestart stop start stop Stopped Stopped
  28. 28. Add a DRBD Master/Slave Set● Create the DRBD primitive p_drbd_mysql ● Use the ocf:linbit:drbd RA ● Add 2 monitor operations (role=Master, role=Slave) with non-equal intervals● Wrap it in a master/slave set ● notify=true, clone-max=2, master-max=1● Commit the configuration● Watch the cluster promote
  29. 29. Constraints
  30. 30. Create a Filesystem● Run mkfs -t ext3 on whichever node is the Master● Add the Filesystem resource ● Name: p_fs_mysql ● Device: /dev/drbd0 ● Directory: /var/lib/mysql ● File system type: ext3● Add required order & colocation constraints
  31. 31. Groups
  32. 32. Add a Group● Create the g_mysql resource group● Add p_fs_mysql and p_ip_mysql● Watch the constraints update automagically
  33. 33. And Finally: MySQL!
  34. 34. Add the MySQL resource● Run mysql_install_db● Create an ocf:heartbeat:mysql primitive p_mysql● Set additional_parameters: --bind-address 192.168.122.110● Add resource level monitoring● Add it to the g_mysql group● Commit, Rejoice!
  35. 35. One more thing...
  36. 36. Physical DRBD Physical Host Host MySQL MasterMySQL MySQL MySQL App App Slave Slave Slave Server Server
  37. 37. Physical DRBD Physical Host Host MySQL MasterMySQL MySQL MySQL App App Slave Slave Slave Server Server
  38. 38. Physical Physical Host Host MySQL InnoDB Recovery Master Umm.. WTF? Hurry up!MySQL MySQL MySQL App App Slave Slave Slave Server Server Booooring
  39. 39. Physical Physical Host Host MySQL MasterMySQL MySQL MySQL App App Slave Slave Slave Server Server
  40. 40. Further Information http://www.hastexo.comhttp://twitter.com/hastexo
  41. 41. Liked this talk?● Go to www.hastexo.com/shoutbox● Log in (you can just use your OpenID from Wordpress, Blogger, Yahoo, Google Apps, Google Profile)● Leave us a message!

×