SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
High Availability with
DRBD & Heartbeat
      Chris Barber
    http://www.cb1inc.com
What is DRBD?
●   Distributed Replicated Block Device
●   RAID 1 mirror across network
●   Realtime replications
●   Linux-only kernel module
●   2 nodes – Primary/Secondary
●   Single/Dual primary mode
●   Open source, free
Visual Overview
          Primary Server                                                          Secondary Server
      Service (MySQL, Apache, etc)                                              Service (MySQL, Apache, etc)



File system                                                                                             File system
                                          OS                          OS

Buffer cache                                                                                           Buffer cache



  DRBD                                                                                                    DRBD



   Disk                            TCP/IP                                  TCP/IP                         Disk
 Scheduler                                                                                              Scheduler



Disk Driver                      NIC Driver                              NIC Driver                     Disk Driver



                        Network Card                            Network Card
   Disk                                                                                                    Disk

                                      Network Card                            Network Card


                        Original chart: http://www.drbd.org/users-guide/ch-fundamentals.html
Uses
●   Database Server( MySQL)
●   Web Server (Apache)
●   File Server (Samba)
●   FTP
●   DNS
●   Email (Postfix)
●   Source Repository (Subversion)
My Setup
●   App 1              ●   App 2
●   AMD Opteron 180    ●   AMD Sempron 2800+
    2.4GHz dual-core   ●   3GB RAM
●   4GB RAM            ●   1 x 250 IDE Hard
●   2 x 250GB SATA         Drive
    Software RAID 1    ●   2 x Gigabit NICs
●   2 x Gigabit NICs
My Setup




App 1                 App 2

   File Server
My Setup




Gigabit
Crossover
Cable
Partitions
●   250GB total
●   20GB Operating system (/)
●   4GB swap
●   226GB DRBD (/mnt/data)
/mnt/data
●   /mnt/data/apache2 – Apache conf, SSL certs,
    htpasswd
●   /mnt/data/mail – Mail directory
    (Postfix/CourierIMAP)
●   /mnt/data/mysql – MySQL conf, database files,
    binlog
●   /mnt/data/svn – Subversion repository
●   /mnt/data/www - Websites
DRBD Install Overview
●   Download source
●   Compile driver
●   modprobe drbd
●   Create /etc/drbd.conf
●   Create meta disk - drbdadm create-md r0
●   Bring up device - drbdadm up r0
●   Become primary
    –   drbdadm -- --overwrite-data-of-peer primary r0
●   mkfs.ext3 /dev/drbd0
●   mount /dev/drbd0 /mnt/data
/etc/drbd.conf
                                         net {
                                           sndbuf-size 512k;
                                           timeout     60; # 6 seconds (unit = 0.1 seconds)
                                           connect-int 10; # 10 seconds (unit = 1 second)
global {
                                           ping-int   10; # 10 seconds (unit = 1 second)
  usage-count no;
                                           ping-timeout 5; # 500 ms (unit = 0.1 seconds)
}
                                           max-buffers 8000;
                                           max-epoch-size 8000;
common {
                                           cram-hmac-alg quot;sha1quot;;
 protocol C;
                                           shared-secret quot;secretquot;;
                                         }
 syncer {
                                     }
   rate 30M;
   al-extents 1801;
                                     resource r0 {
 }
                                      on app1 {
                                        disk    /dev/md2;
 startup {
                                        address 10.10.10.21:7788;
   wfc-timeout 0;
                                        device /dev/drbd0;
   degr-wfc-timeout 15;
                                        meta-disk internal;
 }
                                      }
 disk {
                                         on app2 {
   on-io-error detach;
                                           disk   /dev/sda3;
   # fencing resource-and-stonith;
                                           address 10.10.10.31:7788;
 }
                                           device /dev/drbd0;
                                           meta-disk internal;
                                         }
                                     }
Checking DRBD
 ●   cat /proc/drbd

root@app1:/mnt/data# 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---
   ns:237740648 nr:7160 dw:19725440 dr:242166751 al:2274 bm:17504 lo:0 pe:0 ua:0 ap:0
      resync: used:0/31 hits:13841287 misses:13628 starving:0 dirty:0 changed:13628
      act_log: used:0/1801 hits:4927296 misses:2427 starving:0 dirty:153 changed:2274
Heartbeat
●   Exchange heartbeats
●   When the heartbeat fails, other begins takeover
●   Use 2 NICs (try to prevent split brain)
●   Uses LSB init scripts
●   Version 1
    –   Simple as cake
●   Version 2
    –   GUI, allows more complex situations
Heartbeat Installation Overview
  ●   Install heartbeat (apt-get install heartbeat)
  ●   3 conf files
                                                          /etc/ha.d/ha.cf
                                                                keepalive 2
/etc/ha.d/haresources                                           deadtime 15
      app1                                                     warntime 5
              IPaddr::192.168.1.211/24/eth0                    initdead 30
              IPaddr::192.168.1.212/24/eth0                    autojoin none
              drbddisk::r0                                     bcast eth1
              Filesystem::/dev/drbd0::/mnt/data::ext3          mcast eth0 239.0.0.42 694 1 0
              bind9                                            auto_failback off
              postfix                                          node app1 app2
              courier-imap                                     logfacility local0
              courier-imap-ssl 
              mysql 
              apache2                                    /etc/ha.d/authkeys
              samba                                             auth 1
                                                                1 sha1 secret
Finalizing Heartbeat Install
●   Stop services
    –   /etc/init.d/apache2 stop
●   Disable services (Ubuntu/Debian)
    –   update-rc.d -f apache2 remove
●   Disable mounting of DRBD drive (/etc/fstab)
    –   /dev/drbd0    /mnt/data    ext3 noauto 0 0
Running Heartbeat
●   /etc/init.d/heartbeat start
●   /usr/lib/heartbeat/hb_takeover
●   /usr/lib/heartbeat/hb_standby
Samba

[global]
      log file = /var/log/samba/log.%m
      passwd chat = *EntersnewsUNIXspassword:*
%nn *RetypesnewsUNIXspassword:* %nn                [data]
*passwd:*passwordsupdatedssuccessfully* .                      writeable = yes
      socket options = TCP_NODELAY                               path = /mnt/data
      obey pam restrictions = yes                                force group = root
      encrypt passwords = true                                   force user = root
      passwd program = /usr/bin/passwd %u                        create mode = 664
      passdb backend = tdbsam                                    directory mode = 775
      dns proxy = no
      server string = %h server (Samba, Ubuntu)         [www]
      invalid users = root                                  force user = www-data
      workgroup = WORKGROUP                                 writeable = yes
      os level = 20                                         create mode = 664
      auto services = data                                  path = /mnt/data/www
      security = user                                       directory mode = 775
      syslog = 0                                            force group = www-data
      panic action = /usr/share/samba/panic-action %d
      max log size = 1000
# guest account = nobody
Split Brain
●   Both servers are primary
●   Which one is up-to-date?
●   How do you prevent split brain?
Stonith
            apt-get install stonith

Shoot
The
Other
Node
In
The
Head
        ●   Home made stonith device
        ●   Connects serial port to other server's reset switch
        ●   ~$40 in Radio Shack parts to build 2 of them
        ●   http://www.scl.co.uk/rcd_serial/README.rcd_serial
MySQL
●   For maximum performance, use RAID 10 with
    battery backed cache RAID controller
●   Write transactions to disk so they get replicated
    –   innodb_flush_log_at_trx_commit=1
    –   sync_binlog=1
●   More info:
    –   http://www.mysqlperformanceblog.com/2008/06/02/how-much-overhead-drdb-could-cause/
Demo
●   Reboot app1
●   App2 become primary
●   App1 comes online, re-syncs
●   Turn off app1's network
●   DRBD on app2 loses connection with app1
●   Run home and enable app1's networking :)
More Info
●   http://www.drbd.org/
●   http://www.cb1inc.com/taxonomy/term/70
Questions?




 Thank you!

Mais conteúdo relacionado

Mais procurados

Linux command ppt
Linux command pptLinux command ppt
Linux command pptkalyanineve
 
Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...
Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...
Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...Vietnam Open Infrastructure User Group
 
Introduction to Apache Flink
Introduction to Apache FlinkIntroduction to Apache Flink
Introduction to Apache Flinkmxmxm
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internalsKostas Tzoumas
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchysritolia
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersSATOSHI TAGOMORI
 
Building an Activity Feed with Cassandra
Building an Activity Feed with CassandraBuilding an Activity Feed with Cassandra
Building an Activity Feed with CassandraMark Dunphy
 
IBM Notes Traveler administration and Log troubleshooting tips
IBM Notes Traveler administration and Log troubleshooting tipsIBM Notes Traveler administration and Log troubleshooting tips
IBM Notes Traveler administration and Log troubleshooting tipsjayeshpar2006
 
Alles was Sie über HCL Notes 14 wissen müssen
Alles was Sie über HCL Notes 14 wissen müssenAlles was Sie über HCL Notes 14 wissen müssen
Alles was Sie über HCL Notes 14 wissen müssenpanagenda
 
Using eBPF for High-Performance Networking in Cilium
Using eBPF for High-Performance Networking in CiliumUsing eBPF for High-Performance Networking in Cilium
Using eBPF for High-Performance Networking in CiliumScyllaDB
 
Evening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkEvening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkFlink Forward
 
Stream processing with Apache Flink (Timo Walther - Ververica)
Stream processing with Apache Flink (Timo Walther - Ververica)Stream processing with Apache Flink (Timo Walther - Ververica)
Stream processing with Apache Flink (Timo Walther - Ververica)KafkaZone
 
MinIO January 2020 Briefing
MinIO January 2020 BriefingMinIO January 2020 Briefing
MinIO January 2020 BriefingJonathan Symonds
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeFlink Forward
 
Grokking Techtalk #40: Consistency and Availability tradeoff in database cluster
Grokking Techtalk #40: Consistency and Availability tradeoff in database clusterGrokking Techtalk #40: Consistency and Availability tradeoff in database cluster
Grokking Techtalk #40: Consistency and Availability tradeoff in database clusterGrokking VN
 
MySQL with DRBD/Pacemaker/Corosync on Linux
 MySQL with DRBD/Pacemaker/Corosync on Linux MySQL with DRBD/Pacemaker/Corosync on Linux
MySQL with DRBD/Pacemaker/Corosync on LinuxPawan Kumar
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
HCL Domino V12 Key Security Features Overview
HCL Domino V12 Key Security Features Overview HCL Domino V12 Key Security Features Overview
HCL Domino V12 Key Security Features Overview hemantnaik
 

Mais procurados (20)

Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...
Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...
Room 3 - 7 - Nguyễn Như Phúc Huy - Vitastor: a fast and simple Ceph-like bloc...
 
Introduction to Apache Flink
Introduction to Apache FlinkIntroduction to Apache Flink
Introduction to Apache Flink
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internals
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchy
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
Building an Activity Feed with Cassandra
Building an Activity Feed with CassandraBuilding an Activity Feed with Cassandra
Building an Activity Feed with Cassandra
 
IBM Notes Traveler administration and Log troubleshooting tips
IBM Notes Traveler administration and Log troubleshooting tipsIBM Notes Traveler administration and Log troubleshooting tips
IBM Notes Traveler administration and Log troubleshooting tips
 
Alles was Sie über HCL Notes 14 wissen müssen
Alles was Sie über HCL Notes 14 wissen müssenAlles was Sie über HCL Notes 14 wissen müssen
Alles was Sie über HCL Notes 14 wissen müssen
 
Using eBPF for High-Performance Networking in Cilium
Using eBPF for High-Performance Networking in CiliumUsing eBPF for High-Performance Networking in Cilium
Using eBPF for High-Performance Networking in Cilium
 
Evening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkEvening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in Flink
 
Stream processing with Apache Flink (Timo Walther - Ververica)
Stream processing with Apache Flink (Timo Walther - Ververica)Stream processing with Apache Flink (Timo Walther - Ververica)
Stream processing with Apache Flink (Timo Walther - Ververica)
 
Linux file system
Linux file systemLinux file system
Linux file system
 
MinIO January 2020 Briefing
MinIO January 2020 BriefingMinIO January 2020 Briefing
MinIO January 2020 Briefing
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive Mode
 
Grokking Techtalk #40: Consistency and Availability tradeoff in database cluster
Grokking Techtalk #40: Consistency and Availability tradeoff in database clusterGrokking Techtalk #40: Consistency and Availability tradeoff in database cluster
Grokking Techtalk #40: Consistency and Availability tradeoff in database cluster
 
MySQL with DRBD/Pacemaker/Corosync on Linux
 MySQL with DRBD/Pacemaker/Corosync on Linux MySQL with DRBD/Pacemaker/Corosync on Linux
MySQL with DRBD/Pacemaker/Corosync on Linux
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
HCL Domino V12 Key Security Features Overview
HCL Domino V12 Key Security Features Overview HCL Domino V12 Key Security Features Overview
HCL Domino V12 Key Security Features Overview
 

Destaque

High Availability Server with DRBD in linux
High Availability Server with DRBD in linuxHigh Availability Server with DRBD in linux
High Availability Server with DRBD in linuxAli Rachman
 
High Availability Setup with Heartbeat and Floating IP
High Availability Setup with Heartbeat and Floating IPHigh Availability Setup with Heartbeat and Floating IP
High Availability Setup with Heartbeat and Floating IPayman diab
 
WordPress for Beginners Create Professional Websites
WordPress for Beginners Create Professional WebsitesWordPress for Beginners Create Professional Websites
WordPress for Beginners Create Professional Websitesayman diab
 
brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2Nick Wang
 
Accomplishing redundancy on Lustre based PFS with DRBD
Accomplishing redundancy on Lustre based PFS with DRBDAccomplishing redundancy on Lustre based PFS with DRBD
Accomplishing redundancy on Lustre based PFS with DRBDTyrone Systems
 
What is new in Leap42.2 and SLE12SP2
What is new in Leap42.2 and SLE12SP2What is new in Leap42.2 and SLE12SP2
What is new in Leap42.2 and SLE12SP2Nick Wang
 
BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...
BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...
BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...Michal Němec
 
Introduction to DRBD
Introduction to DRBDIntroduction to DRBD
Introduction to DRBDdawnlua
 
DRBD + OpenStack (Openstack Live Prague 2016)
DRBD + OpenStack (Openstack Live Prague 2016)DRBD + OpenStack (Openstack Live Prague 2016)
DRBD + OpenStack (Openstack Live Prague 2016)Jaroslav Jacjuk
 
Alfio Muñoz - Alta disponibilidad con Elastix
Alfio Muñoz - Alta disponibilidad con ElastixAlfio Muñoz - Alta disponibilidad con Elastix
Alfio Muñoz - Alta disponibilidad con ElastixElastixCom
 
Elastix4.0 High Availability without ElastixHA module
Elastix4.0 High Availability without ElastixHA moduleElastix4.0 High Availability without ElastixHA module
Elastix4.0 High Availability without ElastixHA moduleHani Perkasa
 
أساسيات لغة Php بالعربي
أساسيات لغة Php بالعربيأساسيات لغة Php بالعربي
أساسيات لغة Php بالعربيtahsal99
 
High Availability Asterisk and FreePBX on Microsoft Azure
High Availability Asterisk and FreePBX on Microsoft AzureHigh Availability Asterisk and FreePBX on Microsoft Azure
High Availability Asterisk and FreePBX on Microsoft AzureSanjay Willie
 
What you need to know about ceph
What you need to know about cephWhat you need to know about ceph
What you need to know about cephEmma Haruka Iwao
 
Storage tiering and erasure coding in Ceph (SCaLE13x)
Storage tiering and erasure coding in Ceph (SCaLE13x)Storage tiering and erasure coding in Ceph (SCaLE13x)
Storage tiering and erasure coding in Ceph (SCaLE13x)Sage Weil
 
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...Odinot Stanislas
 
Ceph Introduction 2017
Ceph Introduction 2017  Ceph Introduction 2017
Ceph Introduction 2017 Karan Singh
 
Drbd9 and drbdmanage_june_2016
Drbd9 and drbdmanage_june_2016Drbd9 and drbdmanage_june_2016
Drbd9 and drbdmanage_june_2016Philipp Reisner
 
drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015Alexandre Huynh
 

Destaque (20)

High Availability Server with DRBD in linux
High Availability Server with DRBD in linuxHigh Availability Server with DRBD in linux
High Availability Server with DRBD in linux
 
High Availability Setup with Heartbeat and Floating IP
High Availability Setup with Heartbeat and Floating IPHigh Availability Setup with Heartbeat and Floating IP
High Availability Setup with Heartbeat and Floating IP
 
WordPress for Beginners Create Professional Websites
WordPress for Beginners Create Professional WebsitesWordPress for Beginners Create Professional Websites
WordPress for Beginners Create Professional Websites
 
brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2brief introduction of drbd in SLE12SP2
brief introduction of drbd in SLE12SP2
 
Accomplishing redundancy on Lustre based PFS with DRBD
Accomplishing redundancy on Lustre based PFS with DRBDAccomplishing redundancy on Lustre based PFS with DRBD
Accomplishing redundancy on Lustre based PFS with DRBD
 
What is new in Leap42.2 and SLE12SP2
What is new in Leap42.2 and SLE12SP2What is new in Leap42.2 and SLE12SP2
What is new in Leap42.2 and SLE12SP2
 
BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...
BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...
BlackStor - World's fastest & most reliable Cloud Native Software Defined Sto...
 
Introduction to DRBD
Introduction to DRBDIntroduction to DRBD
Introduction to DRBD
 
DRBD + OpenStack (Openstack Live Prague 2016)
DRBD + OpenStack (Openstack Live Prague 2016)DRBD + OpenStack (Openstack Live Prague 2016)
DRBD + OpenStack (Openstack Live Prague 2016)
 
Alfio Muñoz - Alta disponibilidad con Elastix
Alfio Muñoz - Alta disponibilidad con ElastixAlfio Muñoz - Alta disponibilidad con Elastix
Alfio Muñoz - Alta disponibilidad con Elastix
 
Elastix4.0 High Availability without ElastixHA module
Elastix4.0 High Availability without ElastixHA moduleElastix4.0 High Availability without ElastixHA module
Elastix4.0 High Availability without ElastixHA module
 
أساسيات لغة Php بالعربي
أساسيات لغة Php بالعربيأساسيات لغة Php بالعربي
أساسيات لغة Php بالعربي
 
Drbd
DrbdDrbd
Drbd
 
High Availability Asterisk and FreePBX on Microsoft Azure
High Availability Asterisk and FreePBX on Microsoft AzureHigh Availability Asterisk and FreePBX on Microsoft Azure
High Availability Asterisk and FreePBX on Microsoft Azure
 
What you need to know about ceph
What you need to know about cephWhat you need to know about ceph
What you need to know about ceph
 
Storage tiering and erasure coding in Ceph (SCaLE13x)
Storage tiering and erasure coding in Ceph (SCaLE13x)Storage tiering and erasure coding in Ceph (SCaLE13x)
Storage tiering and erasure coding in Ceph (SCaLE13x)
 
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
 
Ceph Introduction 2017
Ceph Introduction 2017  Ceph Introduction 2017
Ceph Introduction 2017
 
Drbd9 and drbdmanage_june_2016
Drbd9 and drbdmanage_june_2016Drbd9 and drbdmanage_june_2016
Drbd9 and drbdmanage_june_2016
 
drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015drbd9_and_drbdmanage_may_2015
drbd9_and_drbdmanage_may_2015
 

Semelhante a High Availability With DRBD & Heartbeat

High Availability != High-cost
High Availability != High-costHigh Availability != High-cost
High Availability != High-costnormanmaurer
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterAndrey Kudryavtsev
 
Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Sean Hull
 
10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in production10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in productionParis Data Engineers !
 
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Mydbops
 
Distributed replicated block device
Distributed replicated block deviceDistributed replicated block device
Distributed replicated block deviceChanaka Lasantha
 
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"OpenStack Korea Community
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Praguetomasbart
 
Advanced administration and problem determination
Advanced administration and problem determinationAdvanced administration and problem determination
Advanced administration and problem determinationsolarisyougood
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementKenny (netman)
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisAnne Nicolas
 
Linux lv ms step by step
Linux lv ms step by stepLinux lv ms step by step
Linux lv ms step by stepsudakarman
 
import rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythonimport rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythongroveronline
 
Hands on Virtualization with Ganeti
Hands on Virtualization with GanetiHands on Virtualization with Ganeti
Hands on Virtualization with GanetiOSCON Byrum
 

Semelhante a High Availability With DRBD & Heartbeat (20)

High Availability != High-cost
High Availability != High-costHigh Availability != High-cost
High Availability != High-cost
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
 
Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10Oreilly Webcast 01 19 10
Oreilly Webcast 01 19 10
 
10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in production10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in production
 
testing-nfs
testing-nfstesting-nfs
testing-nfs
 
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
 
Web Server Free Bsd
Web Server Free BsdWeb Server Free Bsd
Web Server Free Bsd
 
Multipath
MultipathMultipath
Multipath
 
Distributed replicated block device
Distributed replicated block deviceDistributed replicated block device
Distributed replicated block device
 
Dev ops
Dev opsDev ops
Dev ops
 
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
 
XS Japan 2008 Xen Mgmt English
XS Japan 2008 Xen Mgmt EnglishXS Japan 2008 Xen Mgmt English
XS Japan 2008 Xen Mgmt English
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
 
Debug generic process
Debug generic processDebug generic process
Debug generic process
 
Advanced administration and problem determination
Advanced administration and problem determinationAdvanced administration and problem determination
Advanced administration and problem determination
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware Management
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysis
 
Linux lv ms step by step
Linux lv ms step by stepLinux lv ms step by step
Linux lv ms step by step
 
import rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythonimport rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Python
 
Hands on Virtualization with Ganeti
Hands on Virtualization with GanetiHands on Virtualization with Ganeti
Hands on Virtualization with Ganeti
 

Mais de Chris Barber

Remote IP Power Switches
Remote IP Power SwitchesRemote IP Power Switches
Remote IP Power SwitchesChris Barber
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsChris Barber
 
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013Chris Barber
 
Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012Chris Barber
 
Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)Chris Barber
 
Cassandra - Say Goodbye to the Relational Database (5-6-2010)
Cassandra - Say Goodbye to the Relational Database (5-6-2010)Cassandra - Say Goodbye to the Relational Database (5-6-2010)
Cassandra - Say Goodbye to the Relational Database (5-6-2010)Chris Barber
 
Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)Chris Barber
 
Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)Chris Barber
 
Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)Chris Barber
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference RecapChris Barber
 
Memcached And MySQL
Memcached And MySQLMemcached And MySQL
Memcached And MySQLChris Barber
 

Mais de Chris Barber (11)

Remote IP Power Switches
Remote IP Power SwitchesRemote IP Power Switches
Remote IP Power Switches
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ Addons
 
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
 
Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012Exploring the Titanium CLI - Codestrong 2012
Exploring the Titanium CLI - Codestrong 2012
 
Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)Intro to PECL/mysqlnd_ms (4/7/2011)
Intro to PECL/mysqlnd_ms (4/7/2011)
 
Cassandra - Say Goodbye to the Relational Database (5-6-2010)
Cassandra - Say Goodbye to the Relational Database (5-6-2010)Cassandra - Say Goodbye to the Relational Database (5-6-2010)
Cassandra - Say Goodbye to the Relational Database (5-6-2010)
 
Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)Debugging Dojo Applications (2/10/2010)
Debugging Dojo Applications (2/10/2010)
 
Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)Titanium Powered Desktop & Mobile Apps (11/21/2009)
Titanium Powered Desktop & Mobile Apps (11/21/2009)
 
Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)Dojo - Javascript's Swiss Army Knife (7/15/2009)
Dojo - Javascript's Swiss Army Knife (7/15/2009)
 
2008 MySQL Conference Recap
2008 MySQL Conference Recap2008 MySQL Conference Recap
2008 MySQL Conference Recap
 
Memcached And MySQL
Memcached And MySQLMemcached And MySQL
Memcached And MySQL
 

Último

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
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
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Último (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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?
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
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
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

High Availability With DRBD & Heartbeat

  • 1. High Availability with DRBD & Heartbeat Chris Barber http://www.cb1inc.com
  • 2. What is DRBD? ● Distributed Replicated Block Device ● RAID 1 mirror across network ● Realtime replications ● Linux-only kernel module ● 2 nodes – Primary/Secondary ● Single/Dual primary mode ● Open source, free
  • 3. Visual Overview Primary Server Secondary Server Service (MySQL, Apache, etc) Service (MySQL, Apache, etc) File system File system OS OS Buffer cache Buffer cache DRBD DRBD Disk TCP/IP TCP/IP Disk Scheduler Scheduler Disk Driver NIC Driver NIC Driver Disk Driver Network Card Network Card Disk Disk Network Card Network Card Original chart: http://www.drbd.org/users-guide/ch-fundamentals.html
  • 4. Uses ● Database Server( MySQL) ● Web Server (Apache) ● File Server (Samba) ● FTP ● DNS ● Email (Postfix) ● Source Repository (Subversion)
  • 5. My Setup ● App 1 ● App 2 ● AMD Opteron 180 ● AMD Sempron 2800+ 2.4GHz dual-core ● 3GB RAM ● 4GB RAM ● 1 x 250 IDE Hard ● 2 x 250GB SATA Drive Software RAID 1 ● 2 x Gigabit NICs ● 2 x Gigabit NICs
  • 6. My Setup App 1 App 2 File Server
  • 8. Partitions ● 250GB total ● 20GB Operating system (/) ● 4GB swap ● 226GB DRBD (/mnt/data)
  • 9. /mnt/data ● /mnt/data/apache2 – Apache conf, SSL certs, htpasswd ● /mnt/data/mail – Mail directory (Postfix/CourierIMAP) ● /mnt/data/mysql – MySQL conf, database files, binlog ● /mnt/data/svn – Subversion repository ● /mnt/data/www - Websites
  • 10. DRBD Install Overview ● Download source ● Compile driver ● modprobe drbd ● Create /etc/drbd.conf ● Create meta disk - drbdadm create-md r0 ● Bring up device - drbdadm up r0 ● Become primary – drbdadm -- --overwrite-data-of-peer primary r0 ● mkfs.ext3 /dev/drbd0 ● mount /dev/drbd0 /mnt/data
  • 11. /etc/drbd.conf net { sndbuf-size 512k; timeout 60; # 6 seconds (unit = 0.1 seconds) connect-int 10; # 10 seconds (unit = 1 second) global { ping-int 10; # 10 seconds (unit = 1 second) usage-count no; ping-timeout 5; # 500 ms (unit = 0.1 seconds) } max-buffers 8000; max-epoch-size 8000; common { cram-hmac-alg quot;sha1quot;; protocol C; shared-secret quot;secretquot;; } syncer { } rate 30M; al-extents 1801; resource r0 { } on app1 { disk /dev/md2; startup { address 10.10.10.21:7788; wfc-timeout 0; device /dev/drbd0; degr-wfc-timeout 15; meta-disk internal; } } disk { on app2 { on-io-error detach; disk /dev/sda3; # fencing resource-and-stonith; address 10.10.10.31:7788; } device /dev/drbd0; meta-disk internal; } }
  • 12. Checking DRBD ● cat /proc/drbd root@app1:/mnt/data# 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--- ns:237740648 nr:7160 dw:19725440 dr:242166751 al:2274 bm:17504 lo:0 pe:0 ua:0 ap:0 resync: used:0/31 hits:13841287 misses:13628 starving:0 dirty:0 changed:13628 act_log: used:0/1801 hits:4927296 misses:2427 starving:0 dirty:153 changed:2274
  • 13. Heartbeat ● Exchange heartbeats ● When the heartbeat fails, other begins takeover ● Use 2 NICs (try to prevent split brain) ● Uses LSB init scripts ● Version 1 – Simple as cake ● Version 2 – GUI, allows more complex situations
  • 14. Heartbeat Installation Overview ● Install heartbeat (apt-get install heartbeat) ● 3 conf files /etc/ha.d/ha.cf keepalive 2 /etc/ha.d/haresources deadtime 15 app1 warntime 5 IPaddr::192.168.1.211/24/eth0 initdead 30 IPaddr::192.168.1.212/24/eth0 autojoin none drbddisk::r0 bcast eth1 Filesystem::/dev/drbd0::/mnt/data::ext3 mcast eth0 239.0.0.42 694 1 0 bind9 auto_failback off postfix node app1 app2 courier-imap logfacility local0 courier-imap-ssl mysql apache2 /etc/ha.d/authkeys samba auth 1 1 sha1 secret
  • 15. Finalizing Heartbeat Install ● Stop services – /etc/init.d/apache2 stop ● Disable services (Ubuntu/Debian) – update-rc.d -f apache2 remove ● Disable mounting of DRBD drive (/etc/fstab) – /dev/drbd0 /mnt/data ext3 noauto 0 0
  • 16. Running Heartbeat ● /etc/init.d/heartbeat start ● /usr/lib/heartbeat/hb_takeover ● /usr/lib/heartbeat/hb_standby
  • 17. Samba [global] log file = /var/log/samba/log.%m passwd chat = *EntersnewsUNIXspassword:* %nn *RetypesnewsUNIXspassword:* %nn [data] *passwd:*passwordsupdatedssuccessfully* . writeable = yes socket options = TCP_NODELAY path = /mnt/data obey pam restrictions = yes force group = root encrypt passwords = true force user = root passwd program = /usr/bin/passwd %u create mode = 664 passdb backend = tdbsam directory mode = 775 dns proxy = no server string = %h server (Samba, Ubuntu) [www] invalid users = root force user = www-data workgroup = WORKGROUP writeable = yes os level = 20 create mode = 664 auto services = data path = /mnt/data/www security = user directory mode = 775 syslog = 0 force group = www-data panic action = /usr/share/samba/panic-action %d max log size = 1000 # guest account = nobody
  • 18. Split Brain ● Both servers are primary ● Which one is up-to-date? ● How do you prevent split brain?
  • 19. Stonith apt-get install stonith Shoot The Other Node In The Head ● Home made stonith device ● Connects serial port to other server's reset switch ● ~$40 in Radio Shack parts to build 2 of them ● http://www.scl.co.uk/rcd_serial/README.rcd_serial
  • 20. MySQL ● For maximum performance, use RAID 10 with battery backed cache RAID controller ● Write transactions to disk so they get replicated – innodb_flush_log_at_trx_commit=1 – sync_binlog=1 ● More info: – http://www.mysqlperformanceblog.com/2008/06/02/how-much-overhead-drdb-could-cause/
  • 21. Demo ● Reboot app1 ● App2 become primary ● App1 comes online, re-syncs ● Turn off app1's network ● DRBD on app2 loses connection with app1 ● Run home and enable app1's networking :)
  • 22. More Info ● http://www.drbd.org/ ● http://www.cb1inc.com/taxonomy/term/70