SlideShare una empresa de Scribd logo
1 de 36
High Availability != High-cost
   Building low-cost Master / Slave Clusters on a
Linux based Operating Systems to provide mission
                  critical services
                   Norman Maurer

                 ApacheCon EU 2009
                   March 27, 2009
Norman Maurer
     Member of the Apache Software Foundation
 

     Apache Software Foundation Infrastructure Team
 

     PMC Apache JAMES
 

     Senior Unix System Engineer
 




                                   norman@apache.org
                                   norman.maurer@heagmedianet.de
                                   http://www.heagmedianet.com
                                   http://myblog.kicks-ass.org


                                                                   2
The question should be:
“Why should you not use Linux-HA?“.. ENOCLUE!

          It's flexible
      



          It's opensource
      



          It has a very active community
      



          It's known to work for high-volume
      

          servers

          It's just freakin' cool!
      




                                                3
Components for building the
        Cluster



                              4
The Linux-HA Cluster uses two base components
that make up the Cluster..

      Heartbeat*
  



      DRBD**
  




                          * - http://www.linux-ha.org
                          **- http://www.drbd.org
                                                        5
Putting stuff together for an
  Apache HTTPD Cluster
         The magic glue




                                6
Brief overview of how the whole Cluster works

               Webserver01                    Webserver02
  Heartbeat        NIC            HA              NIC       Heartbeat

   DRBD                           Data                       DRBD
                   NIC                            NIC

  Services

  Virtual-IP



                         Master           Slave



                                                        Failover!!!
                                                                        7
                                  Users
DRBD a.k.a network raid1
  Mirror your data across the network




                                        8
Benefits when using DRBD

      Synchronous and asynchronous replication
  



      Works at the block level
  



      Many Distributions ship with pre-build DRBD
  

      modules / utils

      Works with every filesystem on-top while in
  

      Master / Slave-Cluster

      Master / Slave Cluster and Master / Master-
  

      Cluster possible
                                                    9
Limitations when using DRBD

      I/O throughput heavily depends on network
  

      throughput

      Only Master / Slave Cluster supported when
  

      using traditional filesystems (ext3, xfs, reiserfs)

      Master / Master Cluster only works with shared
  

      cluster file system (GFS, OCFS2)

      Data access is only possible from the Master
  

      Node in a Master / Slave Cluster

                                                            10
Brief overview on how DRBD works

             Webserver01              Webserver02
Filesystem                                            Filesystem


DRBD-Layer                                           DRBD-Layer
               NIC                        NIC


 Device /                                              Device /
  Disk                                                  Disk



                           Ethernet

                                            Sync data across network


                                                                       11
Installation

       Ubuntu
   

       # apt-get install drbd8-utils drbd8-module-source build-
       essential module-assistant && module-assistant auto-
       install drbd8

       Debian
   

       # apt-get install drbd8-utils drbd8-modules

       SLES
   

       # yast -i drbd

       Others
   

       Check if there are prebuild packages / build it yourself
       from source!
                                                                  12
Configuration of DRBD-Nodes
      Set correct config parameters on both Nodes
  

      /etc/drbd.conf:
                                                  Synchron write-operations
      global {
               usage-count yes;
      }
      common {
               protocol C;
                                                  Specify resource
      }
      resource r0 {
                                                  You can have more then one!
               on node01 {
                        device /dev/drbd0;
                        disk   /dev/sda7;
                        address 10.0.0.2:7789;
                                                   Configuration of DRBD-
                        meta-disk internal;
               }
                                                   Nodes
               on node02 {
                        device /dev/drbd0;
                        disk   /dev/sda7;
                         address 10.0.0.3:7789;
                        meta-disk internal;
               }
      }
                                                                                13
Create the device and up it

       Create device metadata
   

       # drbdadm create-md r0

       Attach to backing device,set synchronization
   

       parameters and connect to peer
       # drbdadm up r0

       Check state
   

       # cat /proc/drbd
       version: 8.0.11 (api:86/proto:86)
       GIT-hash: b3fe2bdfd3b9f7c2f923186883eb9e2a0d3a5b1b build by
            phil@mescal, 2008-02-12 11:56:43
       1: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C
       r---
            …
            …
                                                                               14
Initial device synchronization

       Set Primary
   

       # drbdadm -- --overwrite-data-of-peer primary r0

       Check state again
   

       # cat /proc/drbd
       version: 8.0.11 (api:86/proto:86)
       GIT-hash: b3fe2bdfd3b9f7c2f923186883eb9e2a0d3a5b1b build by
       phil@mescal, 2008-02-12 11:56:43
       0: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
       ….
       ….




                                                                          15
File system layout and data migration

       Put filesystem on-top
   

       # mkfs.ext3 /dev/drbd0

       Temporarily mount the filesystem to generate
   

       folder structure
       # mount /dev/drbd0 /drbd

       Create required folders and copy content
   

       # mkdir -p /drbd/etc /drbd/usr/lib /drbd/var
       # rsync -az /etc/apache2 /drbd/etc/
       # rsync -az /var/www /drbd/var/
       # rsync -az /usr/lib/cgi-bin /drbd/usr/lib/


                                                      16
Heartbeat
Failover on error / panic




                            17
Main features of Heartbeat

       Heartbeat packets via ICMP / UDP / Serial
   



       Works with “every“ unix daemon
   



       Be able to execute scripts on failover
   



       Automatic failback
   



       Support of “STONITH*“ devices
   



                                 *shoot the other node in the head


                                                                     18
Brief overview on how Heartbeat works

                                 Heartbeats
               Webserver01                       Webserver02

 Heartbeat                                                       Heartbeat
                 Checks                               Checks

                                  TCP/IP
                       NIC                            NIC
  Scripts                                                          Scripts
                       COM         Serial         COM

Start   Stop                                                    Start   Stop




                        Master                Slave
Called when becoming                             Called when becoming
Master-Node                                      Slave-Node


                                                                               19
Installation of Heartbeat

       Ubuntu / Debian
   

       # apt-get install heartbeat


       SLES
   

       # yast -i heartbeat

       Other Distributions
   

       Check for prebuild packages / build it yourself from
       source !




                                                              20
Installation of extra-scripts

       Ubuntu / Debian
   

       # apt-get install drbdlinks


       Other Distributions
   

       Check for prebuild packages / build it your from source!




                                                                  21
Configuration of extra-scripts

       Set correct config parameters for drbdlinks on
   

       both nodes
       /etc/drbdlinks.conf:

       link('/etc/apache2', '/drbd/etc/apache2')
       link('/var/www', '/drbd/var/www')
       link('/usr/lib/cgi-bin', '/drbd/usr/lib/cgi-bin')




                                                           Specify all directories which
                                                           needs to be “linked“ from the
                                                           mounted DRBD device to the
                                                           correct location.

                                                                                           22
Configuration of Heartbeat – Part I

       Set correct config parameters on both nodes
   


       /etc/heartbeat/ha.cf:

       debugfile         /var/log/ha-debug
       logfile           /var/log/ha-log
                                             Don't fallback when the
       Logfacility       local0
       keepalive         2
                                             primary node comes up
       deadtime          60
                                             again
       warntime          30
       initdead          120
       udpport           697
       auto_failback     off
       node              node01
       node              node02
       debug             0
                                             Nodes need to be
                                             resolvable


                                                                       23
Configuration of Heartbeat – Part II

       Configure script execution on failover
   

        /etc/heartbeat/haresources:

        node01 xxx.xxx.xxx.xxx drbddisk::r0 Filesystem::/dev/drbd0::/drbd::ext3 drbdlinks apache2




       Primary                        DRBD             Mount FS                Link Start
                       Virtual
                                      →
       Node                                                                    dirs Apache2
                       IP
                                      Primary

       Scripts needs to be located under:
   

         /etc/init.d/

         /etc/heartbeat/resources.d/
                                                                                                    24
Configuration of Heartbeat – Part III

       Setup encryption and passphrase
   


           /etc/heartbeat/authkeys:

                                               File needs to have
           auth 1
           1 sha1 your_super_secure_password
                                               perms 600!



           Supported encryption
       

             md5

             sha1
                                               Not really an
             crc
                                               encryption. Just
                                               packet corruption
                                               prevention
                                                                    25
Final Steps..

       Disable startup scripts for daemons started by
   

       Heartbeat!

       Reboot both servers to see if all services will
   

       be started on the next reboot

       Test failover to see if all works as aspected
   




                                                         26
Clustering in production
     What is known to work




                             27
What services are known to work ?
       Mail
   

       Ubuntu,Qmail,Vpopmail

       Webserver
   

       Ubuntu, Apache HTTPD 1.3.x / 2.0.x/ 2.2.x

       Database
   

       Ubuntu, MySQL 4.1 / 5.0 / 5.1

       Radius
   

       Ubuntu, Freeradius
       ......
                 ..... and thousands of happy
                 customers                         28
Best Practices – Part 1
       Set the heartbeat and DRBD utils/modules to
   

       “hold“ in package-management

       Disable Heartbeat on the Slave-Node while
   

       performing upgrades

       Use dedicated NIC
   



       Use decent NIC (like intel)
   



       Use gigabit ethernet
   




                                                     29
Best Practices – Part 2
       Use different UDP Ports (for heartbeats) per
   

       Linux-HA Cluster

       Test failover before putting the Cluster in
   

       production

       Keep the Heartbeat and DRBD config files in-
   

       sync

       Use „just“ an crossover-cable to connect the
   

       nodes if possible



                                                      30
Known problems
What problems often show up and how to
               fix them




                                         31
DRBD – Part I
      Split brain scenario
  



      Crappy throughput
  



      Version mismatch
  



      Kernel panic on both nodes
  



      UID/GID not match on both Nodes
  




                                        32
Heartbeat
      Split brain scenario
  



      Heartbeats get dropped
  



      Nodes not „see“ each other
  




                                   33
Useful resources
       Linux-HA
   
       http://www.linux-ha.org

       DRBD
   
       http://www.drbd.org


       DRBDLinks
   

       http://www.tummy.com/Community/software/drbdlinks/


       DRBD and MySQL
   

       http://dev.mysql.com/doc/refman/5.1/en/faqs-mysql-drbd-heartbeat.html




                                                                               34
Questions ?




              35
Thank you for your attention!




                                36

Más contenido relacionado

La actualidad más candente

Disaster recovery of OpenStack Cinder using DRBD
Disaster recovery of OpenStack Cinder using DRBDDisaster recovery of OpenStack Cinder using DRBD
Disaster recovery of OpenStack Cinder using DRBDViswesuwara Nathan
 
Disruptive IP Networking with Intel DPDK on Linux
Disruptive IP Networking with Intel DPDK on LinuxDisruptive IP Networking with Intel DPDK on Linux
Disruptive IP Networking with Intel DPDK on LinuxNaoto MATSUMOTO
 
イマドキなNetwork/IO
イマドキなNetwork/IOイマドキなNetwork/IO
イマドキなNetwork/IOTakuya ASADA
 
CASPUR Staging System II
CASPUR Staging System IICASPUR Staging System II
CASPUR Staging System IIAndrea PETRUCCI
 
Rh202 q&a-demo-cert magic
Rh202 q&a-demo-cert magicRh202 q&a-demo-cert magic
Rh202 q&a-demo-cert magicEllina Beckman
 
DLM knowledge-sharing
DLM knowledge-sharingDLM knowledge-sharing
DLM knowledge-sharingEric Ren
 
Building a Two Node SLES 11 SP2 Linux Cluster with VMware
Building a Two Node SLES 11 SP2 Linux Cluster with VMwareBuilding a Two Node SLES 11 SP2 Linux Cluster with VMware
Building a Two Node SLES 11 SP2 Linux Cluster with VMwaregeekswing
 
Enable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zunEnable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zunheut2008
 
Building a Virtualized Continuum with Intel(r) Clear Containers
Building a Virtualized Continuum with Intel(r) Clear ContainersBuilding a Virtualized Continuum with Intel(r) Clear Containers
Building a Virtualized Continuum with Intel(r) Clear ContainersMichelle Holley
 
DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabMichelle Holley
 
Easy backup & restore with Clonezilla - Tips form Basic to Advanced
Easy backup & restore with Clonezilla - Tips form Basic to AdvancedEasy backup & restore with Clonezilla - Tips form Basic to Advanced
Easy backup & restore with Clonezilla - Tips form Basic to AdvancedChenkai Sun
 
Gluster Cloud Night in Tokyo 2013 -- Tips for getting started
Gluster Cloud Night in Tokyo 2013 -- Tips for getting startedGluster Cloud Night in Tokyo 2013 -- Tips for getting started
Gluster Cloud Night in Tokyo 2013 -- Tips for getting startedKeisuke Takahashi
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1sprdd
 
GlusterFS CTDB Integration
GlusterFS CTDB IntegrationGlusterFS CTDB Integration
GlusterFS CTDB IntegrationEtsuji Nakai
 
Building android for the Cloud: Android as a Server (AnDevConBoston 2014)
Building android for the Cloud: Android as a Server (AnDevConBoston 2014)Building android for the Cloud: Android as a Server (AnDevConBoston 2014)
Building android for the Cloud: Android as a Server (AnDevConBoston 2014)Ron Munitz
 
Loadays managing my sql with percona toolkit
Loadays managing my sql with percona toolkitLoadays managing my sql with percona toolkit
Loadays managing my sql with percona toolkitFrederic Descamps
 
いろいろ引き出し作って見ました
いろいろ引き出し作って見ましたいろいろ引き出し作って見ました
いろいろ引き出し作って見ましたMutsumi IWAISHI
 

La actualidad más candente (20)

Disaster recovery of OpenStack Cinder using DRBD
Disaster recovery of OpenStack Cinder using DRBDDisaster recovery of OpenStack Cinder using DRBD
Disaster recovery of OpenStack Cinder using DRBD
 
Disruptive IP Networking with Intel DPDK on Linux
Disruptive IP Networking with Intel DPDK on LinuxDisruptive IP Networking with Intel DPDK on Linux
Disruptive IP Networking with Intel DPDK on Linux
 
イマドキなNetwork/IO
イマドキなNetwork/IOイマドキなNetwork/IO
イマドキなNetwork/IO
 
CASPUR Staging System II
CASPUR Staging System IICASPUR Staging System II
CASPUR Staging System II
 
Rh202 q&a-demo-cert magic
Rh202 q&a-demo-cert magicRh202 q&a-demo-cert magic
Rh202 q&a-demo-cert magic
 
DLM knowledge-sharing
DLM knowledge-sharingDLM knowledge-sharing
DLM knowledge-sharing
 
Building a Two Node SLES 11 SP2 Linux Cluster with VMware
Building a Two Node SLES 11 SP2 Linux Cluster with VMwareBuilding a Two Node SLES 11 SP2 Linux Cluster with VMware
Building a Two Node SLES 11 SP2 Linux Cluster with VMware
 
Enable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zunEnable DPDK and SR-IOV for containerized virtual network functions with zun
Enable DPDK and SR-IOV for containerized virtual network functions with zun
 
100 M pps on PC.
100 M pps on PC.100 M pps on PC.
100 M pps on PC.
 
Introduction to UNIX
Introduction to UNIXIntroduction to UNIX
Introduction to UNIX
 
Building a Virtualized Continuum with Intel(r) Clear Containers
Building a Virtualized Continuum with Intel(r) Clear ContainersBuilding a Virtualized Continuum with Intel(r) Clear Containers
Building a Virtualized Continuum with Intel(r) Clear Containers
 
DPDK in Containers Hands-on Lab
DPDK in Containers Hands-on LabDPDK in Containers Hands-on Lab
DPDK in Containers Hands-on Lab
 
Easy backup & restore with Clonezilla - Tips form Basic to Advanced
Easy backup & restore with Clonezilla - Tips form Basic to AdvancedEasy backup & restore with Clonezilla - Tips form Basic to Advanced
Easy backup & restore with Clonezilla - Tips form Basic to Advanced
 
Gluster Cloud Night in Tokyo 2013 -- Tips for getting started
Gluster Cloud Night in Tokyo 2013 -- Tips for getting startedGluster Cloud Night in Tokyo 2013 -- Tips for getting started
Gluster Cloud Night in Tokyo 2013 -- Tips for getting started
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
 
GlusterFS CTDB Integration
GlusterFS CTDB IntegrationGlusterFS CTDB Integration
GlusterFS CTDB Integration
 
Building android for the Cloud: Android as a Server (AnDevConBoston 2014)
Building android for the Cloud: Android as a Server (AnDevConBoston 2014)Building android for the Cloud: Android as a Server (AnDevConBoston 2014)
Building android for the Cloud: Android as a Server (AnDevConBoston 2014)
 
Loadays managing my sql with percona toolkit
Loadays managing my sql with percona toolkitLoadays managing my sql with percona toolkit
Loadays managing my sql with percona toolkit
 
いろいろ引き出し作って見ました
いろいろ引き出し作って見ましたいろいろ引き出し作って見ました
いろいろ引き出し作って見ました
 
(Free and Net) BSD Xen Roadmap
(Free and Net) BSD Xen Roadmap(Free and Net) BSD Xen Roadmap
(Free and Net) BSD Xen Roadmap
 

Similar a High Availability != High-cost

drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015Alexandre Huynh
 
Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Sean Hull
 
brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2Nick Wang
 
OpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBIT
OpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBITOpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBIT
OpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBITOpenNebula Project
 
State of Containers and the Convergence of HPC and BigData
State of Containers and the Convergence of HPC and BigDataState of Containers and the Convergence of HPC and BigData
State of Containers and the Convergence of HPC and BigDatainside-BigData.com
 
DRBD é um amigo!
DRBD é um amigo!DRBD é um amigo!
DRBD é um amigo!eiichi2009
 
Practice and challenges from building IaaS
Practice and challenges from building IaaSPractice and challenges from building IaaS
Practice and challenges from building IaaSShawn Zhu
 
Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...
Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...
Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...Nagios
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementKenny (netman)
 
Coredns nodecache - A highly-available Node-cache DNS server
Coredns nodecache - A highly-available Node-cache DNS serverCoredns nodecache - A highly-available Node-cache DNS server
Coredns nodecache - A highly-available Node-cache DNS serverYann Hamon
 
Hands on Virtualization with Ganeti
Hands on Virtualization with GanetiHands on Virtualization with Ganeti
Hands on Virtualization with GanetiOSCON Byrum
 
Romanticos com drbd 2
Romanticos com drbd 2Romanticos com drbd 2
Romanticos com drbd 2eiichi2009
 
MySQL High Availability Sprint: Launch the Pacemaker
MySQL High Availability Sprint: Launch the PacemakerMySQL High Availability Sprint: Launch the Pacemaker
MySQL High Availability Sprint: Launch the Pacemakerhastexo
 
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE
 
The Forefront of the Development for NVDIMM on Linux Kernel
The Forefront of the Development for NVDIMM on Linux KernelThe Forefront of the Development for NVDIMM on Linux Kernel
The Forefront of the Development for NVDIMM on Linux KernelYasunori Goto
 
Big Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and MesosBig Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and MesosHeiko Loewe
 
Docker and coreos20141020b
Docker and coreos20141020bDocker and coreos20141020b
Docker and coreos20141020bRichard Kuo
 

Similar a High Availability != High-cost (20)

drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015
 
Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10
 
brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2
 
OpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBIT
OpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBITOpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBIT
OpenNebulaConf 2016 - The DRBD SDS for OpenNebula by Philipp Reisner, LINBIT
 
State of Containers and the Convergence of HPC and BigData
State of Containers and the Convergence of HPC and BigDataState of Containers and the Convergence of HPC and BigData
State of Containers and the Convergence of HPC and BigData
 
DRBD é um amigo!
DRBD é um amigo!DRBD é um amigo!
DRBD é um amigo!
 
Practice and challenges from building IaaS
Practice and challenges from building IaaSPractice and challenges from building IaaS
Practice and challenges from building IaaS
 
Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...
Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...
Nagios Conference 2012 - Andrew Widdersheim - Nagios is down boss wants to se...
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware Management
 
MySQL Cluster Basics
MySQL Cluster BasicsMySQL Cluster Basics
MySQL Cluster Basics
 
Coredns nodecache - A highly-available Node-cache DNS server
Coredns nodecache - A highly-available Node-cache DNS serverCoredns nodecache - A highly-available Node-cache DNS server
Coredns nodecache - A highly-available Node-cache DNS server
 
7.pptx
7.pptx7.pptx
7.pptx
 
Hands on Virtualization with Ganeti
Hands on Virtualization with GanetiHands on Virtualization with Ganeti
Hands on Virtualization with Ganeti
 
Romanticos com drbd 2
Romanticos com drbd 2Romanticos com drbd 2
Romanticos com drbd 2
 
MySQL High Availability Sprint: Launch the Pacemaker
MySQL High Availability Sprint: Launch the PacemakerMySQL High Availability Sprint: Launch the Pacemaker
MySQL High Availability Sprint: Launch the Pacemaker
 
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-DeviceSUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
SUSE Expert Days Paris 2018 - SUSE HA Cluster Multi-Device
 
The Forefront of the Development for NVDIMM on Linux Kernel
The Forefront of the Development for NVDIMM on Linux KernelThe Forefront of the Development for NVDIMM on Linux Kernel
The Forefront of the Development for NVDIMM on Linux Kernel
 
Big Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and MesosBig Data in Container; Hadoop Spark in Docker and Mesos
Big Data in Container; Hadoop Spark in Docker and Mesos
 
Docker and coreos20141020b
Docker and coreos20141020bDocker and coreos20141020b
Docker and coreos20141020b
 
Web Server Free Bsd
Web Server Free BsdWeb Server Free Bsd
Web Server Free Bsd
 

Último

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Último (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

High Availability != High-cost

  • 1. High Availability != High-cost Building low-cost Master / Slave Clusters on a Linux based Operating Systems to provide mission critical services Norman Maurer ApacheCon EU 2009 March 27, 2009
  • 2. Norman Maurer Member of the Apache Software Foundation  Apache Software Foundation Infrastructure Team  PMC Apache JAMES  Senior Unix System Engineer  norman@apache.org norman.maurer@heagmedianet.de http://www.heagmedianet.com http://myblog.kicks-ass.org 2
  • 3. The question should be: “Why should you not use Linux-HA?“.. ENOCLUE! It's flexible  It's opensource  It has a very active community  It's known to work for high-volume  servers It's just freakin' cool!  3
  • 4. Components for building the Cluster 4
  • 5. The Linux-HA Cluster uses two base components that make up the Cluster.. Heartbeat*  DRBD**  * - http://www.linux-ha.org **- http://www.drbd.org 5
  • 6. Putting stuff together for an Apache HTTPD Cluster The magic glue 6
  • 7. Brief overview of how the whole Cluster works Webserver01 Webserver02 Heartbeat NIC HA NIC Heartbeat DRBD Data DRBD NIC NIC Services Virtual-IP Master Slave Failover!!! 7 Users
  • 8. DRBD a.k.a network raid1 Mirror your data across the network 8
  • 9. Benefits when using DRBD Synchronous and asynchronous replication  Works at the block level  Many Distributions ship with pre-build DRBD  modules / utils Works with every filesystem on-top while in  Master / Slave-Cluster Master / Slave Cluster and Master / Master-  Cluster possible 9
  • 10. Limitations when using DRBD I/O throughput heavily depends on network  throughput Only Master / Slave Cluster supported when  using traditional filesystems (ext3, xfs, reiserfs) Master / Master Cluster only works with shared  cluster file system (GFS, OCFS2) Data access is only possible from the Master  Node in a Master / Slave Cluster 10
  • 11. Brief overview on how DRBD works Webserver01 Webserver02 Filesystem Filesystem DRBD-Layer DRBD-Layer NIC NIC Device / Device / Disk Disk Ethernet Sync data across network 11
  • 12. Installation Ubuntu  # apt-get install drbd8-utils drbd8-module-source build- essential module-assistant && module-assistant auto- install drbd8 Debian  # apt-get install drbd8-utils drbd8-modules SLES  # yast -i drbd Others  Check if there are prebuild packages / build it yourself from source! 12
  • 13. Configuration of DRBD-Nodes Set correct config parameters on both Nodes  /etc/drbd.conf: Synchron write-operations global { usage-count yes; } common { protocol C; Specify resource } resource r0 { You can have more then one! on node01 { device /dev/drbd0; disk /dev/sda7; address 10.0.0.2:7789; Configuration of DRBD- meta-disk internal; } Nodes on node02 { device /dev/drbd0; disk /dev/sda7; address 10.0.0.3:7789; meta-disk internal; } } 13
  • 14. Create the device and up it Create device metadata  # drbdadm create-md r0 Attach to backing device,set synchronization  parameters and connect to peer # drbdadm up r0 Check state  # cat /proc/drbd version: 8.0.11 (api:86/proto:86) GIT-hash: b3fe2bdfd3b9f7c2f923186883eb9e2a0d3a5b1b build by phil@mescal, 2008-02-12 11:56:43 1: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r--- … … 14
  • 15. Initial device synchronization Set Primary  # drbdadm -- --overwrite-data-of-peer primary r0 Check state again  # cat /proc/drbd version: 8.0.11 (api:86/proto:86) GIT-hash: b3fe2bdfd3b9f7c2f923186883eb9e2a0d3a5b1b build by phil@mescal, 2008-02-12 11:56:43 0: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r--- …. …. 15
  • 16. File system layout and data migration Put filesystem on-top  # mkfs.ext3 /dev/drbd0 Temporarily mount the filesystem to generate  folder structure # mount /dev/drbd0 /drbd Create required folders and copy content  # mkdir -p /drbd/etc /drbd/usr/lib /drbd/var # rsync -az /etc/apache2 /drbd/etc/ # rsync -az /var/www /drbd/var/ # rsync -az /usr/lib/cgi-bin /drbd/usr/lib/ 16
  • 18. Main features of Heartbeat Heartbeat packets via ICMP / UDP / Serial  Works with “every“ unix daemon  Be able to execute scripts on failover  Automatic failback  Support of “STONITH*“ devices  *shoot the other node in the head 18
  • 19. Brief overview on how Heartbeat works Heartbeats Webserver01 Webserver02 Heartbeat Heartbeat Checks Checks TCP/IP NIC NIC Scripts Scripts COM Serial COM Start Stop Start Stop Master Slave Called when becoming Called when becoming Master-Node Slave-Node 19
  • 20. Installation of Heartbeat Ubuntu / Debian  # apt-get install heartbeat SLES  # yast -i heartbeat Other Distributions  Check for prebuild packages / build it yourself from source ! 20
  • 21. Installation of extra-scripts Ubuntu / Debian  # apt-get install drbdlinks Other Distributions  Check for prebuild packages / build it your from source! 21
  • 22. Configuration of extra-scripts Set correct config parameters for drbdlinks on  both nodes /etc/drbdlinks.conf: link('/etc/apache2', '/drbd/etc/apache2') link('/var/www', '/drbd/var/www') link('/usr/lib/cgi-bin', '/drbd/usr/lib/cgi-bin') Specify all directories which needs to be “linked“ from the mounted DRBD device to the correct location. 22
  • 23. Configuration of Heartbeat – Part I Set correct config parameters on both nodes  /etc/heartbeat/ha.cf: debugfile /var/log/ha-debug logfile /var/log/ha-log Don't fallback when the Logfacility local0 keepalive 2 primary node comes up deadtime 60 again warntime 30 initdead 120 udpport 697 auto_failback off node node01 node node02 debug 0 Nodes need to be resolvable 23
  • 24. Configuration of Heartbeat – Part II Configure script execution on failover  /etc/heartbeat/haresources: node01 xxx.xxx.xxx.xxx drbddisk::r0 Filesystem::/dev/drbd0::/drbd::ext3 drbdlinks apache2 Primary DRBD Mount FS Link Start Virtual → Node dirs Apache2 IP Primary Scripts needs to be located under:   /etc/init.d/  /etc/heartbeat/resources.d/ 24
  • 25. Configuration of Heartbeat – Part III Setup encryption and passphrase  /etc/heartbeat/authkeys: File needs to have auth 1 1 sha1 your_super_secure_password perms 600! Supported encryption   md5  sha1 Not really an  crc encryption. Just packet corruption prevention 25
  • 26. Final Steps.. Disable startup scripts for daemons started by  Heartbeat! Reboot both servers to see if all services will  be started on the next reboot Test failover to see if all works as aspected  26
  • 27. Clustering in production What is known to work 27
  • 28. What services are known to work ? Mail  Ubuntu,Qmail,Vpopmail Webserver  Ubuntu, Apache HTTPD 1.3.x / 2.0.x/ 2.2.x Database  Ubuntu, MySQL 4.1 / 5.0 / 5.1 Radius  Ubuntu, Freeradius ...... ..... and thousands of happy customers 28
  • 29. Best Practices – Part 1 Set the heartbeat and DRBD utils/modules to  “hold“ in package-management Disable Heartbeat on the Slave-Node while  performing upgrades Use dedicated NIC  Use decent NIC (like intel)  Use gigabit ethernet  29
  • 30. Best Practices – Part 2 Use different UDP Ports (for heartbeats) per  Linux-HA Cluster Test failover before putting the Cluster in  production Keep the Heartbeat and DRBD config files in-  sync Use „just“ an crossover-cable to connect the  nodes if possible 30
  • 31. Known problems What problems often show up and how to fix them 31
  • 32. DRBD – Part I Split brain scenario  Crappy throughput  Version mismatch  Kernel panic on both nodes  UID/GID not match on both Nodes  32
  • 33. Heartbeat Split brain scenario  Heartbeats get dropped  Nodes not „see“ each other  33
  • 34. Useful resources Linux-HA  http://www.linux-ha.org DRBD  http://www.drbd.org DRBDLinks  http://www.tummy.com/Community/software/drbdlinks/ DRBD and MySQL  http://dev.mysql.com/doc/refman/5.1/en/faqs-mysql-drbd-heartbeat.html 34
  • 36. Thank you for your attention! 36