SlideShare une entreprise Scribd logo
1  sur  22
With IP Failover, Heartbeat, Pacemaker on Ubuntu Server
                                                   Presented by Ali Rachman




               Annual Meeting TS, 7-9 Maret 2012                              1
High Availability

High Availability mengacu kepada suatu praktek untuk menjaga agar
resource yang ada tetap online atau tersedia karena disebabkan oleh
kegagalan suatu node atau sistem



Panduan kali ini, menunjukkan suatu metode untuk menggunakan dua
linode untuk menjaga suatu website tetap online. Bahkan ketika node
primary dimatikan.



Pada prakteknya, akan menggunakan metode IP Failover, Heartbeat,
Pacemaker dan Apache




                            Annual Meeting TS, 7-9 Maret 2012         2
Catatan :

1. Metode yang digunakan mungkin tidak sesuai dengan beberapa kasus
   High Availability yang ada.
2. Diharapkan metode yang digunakan dalam praktek ini bisa memberikan
   gambaran yang jelas tentang HA guna pengembangan di kasus-kasus
   yang lain.
3. Konfigurasi yang ada dalam metode ini hanya bekerja untuk situs yang
   statis




                           Annual Meeting TS, 7-9 Maret 2012              3
Terminology :

1.   Basic system configuration
2.   Assign Static IP Address
3.   Install require Packages
4.   Configure Apache 2
5.   Configure Heartbeat
6.   Configure Cluster Resources
7.   Monitor Cluster Resource




                             Annual Meeting TS, 7-9 Maret 2012   4
Konfigurasi yang digunakan
:
1.   HA1  Primary Linode
2.   HA2  Secondary Linode
3.   12.34.56.78  Static IP untuk Primary Linode
4.   98.76.54.32  Static IP untuk Secondary Linode
5.   44.44.44.44  “floating” IP
6.   4321  password untuk authentifikasi
7.   Tes.ams.id  contoh website yang akan di bangun




                            Annual Meeting TS, 7-9 Maret 2012   5
Basic System Configuration
:
Login dengan ssh ke primary linode
Edit /etc/hosts dan isi sesuai di bawah :


  127.0.0.1                   localhost.localdomain                localhost
  12.34.56.78                 ha1.ams.id                           ha1
  98.76.54.32                 ha2.ams.id                           ha2




                               Annual Meeting TS, 7-9 Maret 2012               6
Basic System Configuration
:
Ssh host key syncronization
Ssh host key syncronization ini digunakan untuk mensinkronisasikan login
antar dua linode yang berbeda
Lakukan hal berikut dari primary linode :
        ssh-keygen -t rsa
        scp ~/.ssh/id_rsa.pub root@ha2:/root/ha1_key.pub
        ssh root@ha2 "ssh-keygen -t rsa"
        ssh root@ha2 "echo `cat ~/ha1_key.pub` >> ~/.ssh/authorized_keys2"
        ssh root@ha2 "rm ~/ha1_key.pub"
        scp root@ha2:/root/.ssh/id_rsa.pub /root
        cat ~/id_rsa.pub >> ~/.ssh/authorized_keys2
        rm ~/id_rsa.pub

        scp /etc/ssh/ssh_host* root@ha2:/etc/ssh/
        rm ~/.ssh/known_hosts
        ssh root@ha2 "/etc/init.d/ssh restart"

        scp /etc/hosts root@ha2:/etc/hosts
        echo "ha1" > /etc/hostname
        hostname -F /etc/hostname
        ssh root@ha2 "echo "ha2" > /etc/hostname"
        ssh root@ha2 "hostname -F /etc/hostname"
                                  Annual Meeting TS, 7-9 Maret 2012            7
Assign Static IP Address :
Primary Linode :
  Edit /etc/network/interfaces :
        auto lo
        iface lo inet loopback

        auto eth0
        iface eth0 inet static
        address 12.34.56.78
        netmask 255.255.255.0
        gateway 12.34.56.1
                                                 Secondary Linode :
  /etc/init.d/networking restart
                                                      Edit /etc/network/interfaces :
                                                                auto lo
                                                                iface lo inet loopback

                                                                auto eth0
                                                                iface eth0 inet static
                                                                address 98.76.54.32
                                                                netmask 255.255.255.0
                                                                gateway 09.76.54.1
                                                      /etc/init.d/networking restart
                                 Annual Meeting TS, 7-9 Maret 2012                       8
Install Required Packages :
Primary Linode :


      apt-get update
      apt-get upgrade
      apt-get install heartbeat pacemaker apache2
      /etc/init.d/apache2 stop
      update-rc.d -f apache2 remove
      mkdir -p /srv/www/ams.id/tes/public_html
      mkdir /srv/www/ams.id/tes/logs

      ssh root@ha2 "apt-get update"
      ssh root@ha2 "apt-get upgrade"
      ssh root@ha2 "apt-get install heartbeat pacemaker apache2"
      ssh root@ha2 "/etc/init.d/apache2 stop"
      ssh root@ha2 "update-rc.d -f apache2 remove"
      ssh root@ha2 "mkdir -p /srv/www/ams.id/tes/public_html"
      ssh root@ha2 "mkdir /srv/www/ams.id/tes/logs"




                                  Annual Meeting TS, 7-9 Maret 2012   9
Configure Apache2 :
Primary Linode :
 Edit /etc/apache2/ports.conf :
      NameVirtualHost      44.44.44.44:80
      Listen 80

Buat file untuk website tes.ams.id yang akan dibuat HA :
 Edit /etc/apache2/sites-available/tes.ams.id :
      <VirtualHost 44.44.44.44:80>
         ServerAdmin support@ams.id
         ServerName tes.ams.id
         DocumentRoot /srv/www/ams.id/tes/public_html/
         ErrorLog /srv/www/ams.id/tes/logs/error.log
         CustomLog /srv/www/ams.id/tes/logs/access.log combined
      </VirtualHost>




                                 Annual Meeting TS, 7-9 Maret 2012   10
Configure Apache2 :
Primary Linode :
 Lakukan perintah berikut :
      <VirtualHost 44.44.44.44:80>
         ServerAdmin support@ams.id
         ServerName tes.ams.id
         DocumentRoot /srv/www/ams.id/tes/public_html/
         ErrorLog /srv/www/ams.id/tes/logs/error.log
         CustomLog /srv/www/ams.id/tes/logs/access.log combined
      </VirtualHost>

Buat tes page di primary :
Buat file di /srv/www/ams.id/tes/public_html/index.html :
      <html>
      <head>
      <title>Test page served from ha1</title>
      </head>
      <body>
      <h1>Test page served from ha1</h1>
      </body>
      </html>


                                   Annual Meeting TS, 7-9 Maret 2012   11
Configure Apache2 :
Secondary Linode :
 Buat tes page di secondary :
 Buat file di /srv/www/ams.id/tes/public_html/index.html :
       <html>
       <head>
       <title>Test page served from ha2</title>
       </head>
       <body>
       <h1>Test page served from ha2</h1>
       </body>
       </html>

Primary Linode :
 Lakukan hal berikut untuk meng-enable site :
       a2ensite tes.ams.id
       ssh root@ha2 "a2ensite tes.ams.id"




                                   Annual Meeting TS, 7-9 Maret 2012   12
Configure Heartbeat :
Primary Linode :

 Edit /etc/heartbeat/ha.cf :

       logfacility daemon
       keepalive 2
       deadtime 15
       warntime 5
       initdead 120
       udpport 694
       ucast eth0 98.76.54.32
       auto_failback on
       node ha1
       node ha2
       use_logd yes
       crm respawn




                                Annual Meeting TS, 7-9 Maret 2012   13
Configure Heartbeat :
Secondary Linode :

 Edit /etc/heartbeat/ha.cf :

       logfacility daemon
       keepalive 2
       deadtime 15
       warntime 5
       initdead 120
       udpport 694
       ucast eth0 12.34.56.78
       auto_failback on
       node ha1
       node ha2
       use_logd yes
       crm respawn




                                Annual Meeting TS, 7-9 Maret 2012   14
Configure Heartbeat :
Primary Linode :

 Edit /etc/heartbeat/authkeys :

       auth 1
       1 sha1 4321


 Lakukan perintah berikut :

       chmod 600 /etc/ha.d/authkeys
       /etc/init.d/heartbeat start
       scp /etc/ha.d/authkeys root@ha2:/etc/ha.d/
       ssh root@ha2 "chmod 600 /etc/ha.d/authkeys"
       ssh root@ha2 "/etc/init.d/heartbeat start"




                                 Annual Meeting TS, 7-9 Maret 2012   15
Configure Cluster
Resources :
Primary Linode :

 Lakukan perintah berikut :

       export EDITOR=/bin/nano
       echo "export EDITOR=/bin/nano" >> .bashrc




Secondary Linode :

 Lakukan perintah berikut :

       export EDITOR=/bin/nano
       echo "export EDITOR=/bin/nano" >> .bashrc




                                 Annual Meeting TS, 7-9 Maret 2012   16
Configure Cluster
Resources :
Primary Linode :

 Lakukan perintah berikut :

       crm configure edit

 Akan tampil seperti berikut :

       node $id="285a1261-9066-45de-97ac-04b13e5a1f6c" ha1
       node $id="b4fbb893-55d6-4a33-81fb-34f8d010df7f" ha2
       property $id="cib-bootstrap-options" 
           dc-version="1.0.8-
       042548a451fce8400660f6031f4da6f0223dd5dd" 
           cluster-infrastructure="Heartbeat"




                                 Annual Meeting TS, 7-9 Maret 2012   17
Configure Cluster
Resources :
Primary Linode :

 Insert perintah berikut di antara baris kedua setelah “node” dengan
 “property” :

       primitive apache2 lsb:apache2 
            op monitor interval="5s"
       primitive ip1 ocf:heartbeat:IPaddr2 
            params ip=“44.44.44.44" nic="eth0:0"
       primitive ip1arp ocf:heartbeat:SendArp 
            params ip=“44.44.44.44" nic="eth0:0"
       group WebServices ip1 ip1arp apache2
       colocation apache_with_ip inf: apache2 ip1
       colocation web_with_ip inf: ip1 ip1arp
       order arp_after_ip inf: ip1:start ip1arp:start
       order web_after_arp inf: ip1arp:start apache2:start




                                    Annual Meeting TS, 7-9 Maret 2012   18
Configure Cluster
Resources :
Primary Linode :

 Tambahkan “expected-quorum-votes”, “stonith-enabled” dan “no-
 quorum-policy”, dan jangan lupa menambahkan “” setelah “cluster-
 infrastructure” sehingga seperti berikut :
       property $id="cib-bootstrap-options" 
           dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" 
           cluster-infrastructure="Heartbeat" 
           expected-quorum-votes="1" 
           stonith-enabled="false" 
           no-quorum-policy="ignore"

 Tambahkan baris berikut setelah “property” section :
       rsc_defaults $id="rsc-options" 
            resource-stickiness="100"




                                    Annual Meeting TS, 7-9 Maret 2012      19
Configure Cluster
Resources :
Primary Linode :
 Konfigurasi komplitnya akan seperti ini :
    node $id="285a1261-9066-45de-97ac-04b13e5a1f6c" ha1
    node $id="b4fbb893-55d6-4a33-81fb-34f8d010df7f" ha2
    primitive apache2 lsb:apache2 
         op monitor interval="5s"
    primitive ip1 ocf:heartbeat:IPaddr2 
         params ip=“44.44.44.44" nic="eth0:0"
    primitive ip1arp ocf:heartbeat:SendArp 
         params ip=“44.44.44.44" nic="eth0:0"
    group WebServices ip1 ip1arp apache2
    colocation apache_with_ip inf: apache2 ip1
    colocation web_with_ip inf: ip1 ip1arp
    order arp_after_ip inf: ip1:start ip1arp:start
    order web_after_arp inf: ip1arp:start apache2:start
         property $id="cib-bootstrap-options" 
         dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" 
         cluster-infrastructure="Heartbeat" 
         expected-quorum-votes="1" 
         stonith-enabled="false" 
         no-quorum-policy="ignore"
    rsc_defaults $id="rsc-options" 
         resource-stickiness="100"
                                 Annual Meeting TS, 7-9 Maret 2012       20
Monitor Cluster Resources :
Untuk memonitor clusternya gunakan perintah crm_mon
dan outputnya akan seperti :

  ============
  Last updated: Mon Jun 28 16:59:06 2010
  Stack: Heartbeat
  Current DC: ha2 (b4fbb893-55d6-4a33-81fb-34f8d010df7f) - partition with quorum
  Version: 1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd
  2 Nodes configured, 1 expected votes
  1 Resources configured.
  ============

  Online: [ ha1 ha2 ]

  Resource Group: WebServices
    ip1    (ocf::heartbeat:IPaddr2): Started ha1
    ip1arp (ocf::heartbeat:SendArp):   Started ha1
    apache2 (lsb:apache2): Started ha1




                                    Annual Meeting TS, 7-9 Maret 2012              21
Monitor Cluster Resources :
Untuk memindahkan services ke HA2 gunakan perintah berikut :

  crm resource move WebServices ha2


Sebaliknya untuk mengembalikan services ke HA1 gunakan perintah
berikut :
  crm resource move WebServices ha1




                                 Annual Meeting TS, 7-9 Maret 2012   22

Contenu connexe

Tendances

oracle cloud with 2 nodes processing
oracle cloud with 2 nodes processingoracle cloud with 2 nodes processing
oracle cloud with 2 nodes processing
mahdi ahmadi
 
Lamp configuration u buntu 10.04
Lamp configuration   u buntu 10.04Lamp configuration   u buntu 10.04
Lamp configuration u buntu 10.04
mikehie
 
Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0
venkatakrishnan k
 

Tendances (20)

Network Manual
Network ManualNetwork Manual
Network Manual
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
SystemD Usage Guide
SystemD Usage GuideSystemD Usage Guide
SystemD Usage Guide
 
9i hp relnotes
9i hp relnotes9i hp relnotes
9i hp relnotes
 
oracle cloud with 2 nodes processing
oracle cloud with 2 nodes processingoracle cloud with 2 nodes processing
oracle cloud with 2 nodes processing
 
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
 
Habilitar repositorio EPEL RHEL
Habilitar repositorio EPEL RHELHabilitar repositorio EPEL RHEL
Habilitar repositorio EPEL RHEL
 
Linux Du Jour
Linux Du JourLinux Du Jour
Linux Du Jour
 
Lamp configuration u buntu 10.04
Lamp configuration   u buntu 10.04Lamp configuration   u buntu 10.04
Lamp configuration u buntu 10.04
 
Centos config
Centos configCentos config
Centos config
 
Presentation1
Presentation1Presentation1
Presentation1
 
Unix executable buffer overflow
Unix executable buffer overflowUnix executable buffer overflow
Unix executable buffer overflow
 
Shell Script Disk Usage Report and E-Mail Current Threshold Status
Shell Script  Disk Usage Report and E-Mail Current Threshold StatusShell Script  Disk Usage Report and E-Mail Current Threshold Status
Shell Script Disk Usage Report and E-Mail Current Threshold Status
 
How to installation and configure apache2
How to installation and configure apache2How to installation and configure apache2
How to installation and configure apache2
 
Mini CTF workshop dump
Mini CTF workshop dumpMini CTF workshop dump
Mini CTF workshop dump
 
RAC 12c
RAC 12cRAC 12c
RAC 12c
 
Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0Power point on linux commands,appache,php,mysql,html,css,web 2.0
Power point on linux commands,appache,php,mysql,html,css,web 2.0
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Anthony McKeown Drupal Presentation
Anthony McKeown Drupal PresentationAnthony McKeown Drupal Presentation
Anthony McKeown Drupal Presentation
 

Similaire à High Availability Server with DRBD in linux

Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
webhostingguy
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
webhostingguy
 
Creating "Secure" PHP applications, Part 2, Server Hardening
Creating "Secure" PHP applications, Part 2, Server HardeningCreating "Secure" PHP applications, Part 2, Server Hardening
Creating "Secure" PHP applications, Part 2, Server Hardening
archwisp
 

Similaire à High Availability Server with DRBD in linux (20)

PGConf.ASIA 2019 - High Availability, 10 Seconds Failover - Lucky Haryadi
PGConf.ASIA 2019 - High Availability, 10 Seconds Failover - Lucky HaryadiPGConf.ASIA 2019 - High Availability, 10 Seconds Failover - Lucky Haryadi
PGConf.ASIA 2019 - High Availability, 10 Seconds Failover - Lucky Haryadi
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installation
 
grate techniques
grate techniquesgrate techniques
grate techniques
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)
Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)
Hadoop 2.0 cluster setup on ubuntu 14.04 (64 bit)
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
 
Xen time machine
Xen time machineXen time machine
Xen time machine
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Apache
ApacheApache
Apache
 
Advanced Level Training on Koha / TLS (ToT)
Advanced Level Training on Koha / TLS (ToT)Advanced Level Training on Koha / TLS (ToT)
Advanced Level Training on Koha / TLS (ToT)
 
Linux advanced privilege escalation
Linux advanced privilege escalationLinux advanced privilege escalation
Linux advanced privilege escalation
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linux
 
Performance_Up.ppt
Performance_Up.pptPerformance_Up.ppt
Performance_Up.ppt
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
 
Creating "Secure" PHP applications, Part 2, Server Hardening
Creating "Secure" PHP applications, Part 2, Server HardeningCreating "Secure" PHP applications, Part 2, Server Hardening
Creating "Secure" PHP applications, Part 2, Server Hardening
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
 
Docker
DockerDocker
Docker
 
Hadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup InsightsHadoop Cluster - Basic OS Setup Insights
Hadoop Cluster - Basic OS Setup Insights
 
Dev ops
Dev opsDev ops
Dev ops
 

Dernier

KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
Cara Menggugurkan Kandungan 087776558899
 
the Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentationthe Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentation
brynpueblos04
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
vikas rana
 

Dernier (14)

2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
 
WOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxWOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptx
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
 
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
 
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
 
the Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentationthe Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentation
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 

High Availability Server with DRBD in linux

  • 1. With IP Failover, Heartbeat, Pacemaker on Ubuntu Server Presented by Ali Rachman Annual Meeting TS, 7-9 Maret 2012 1
  • 2. High Availability High Availability mengacu kepada suatu praktek untuk menjaga agar resource yang ada tetap online atau tersedia karena disebabkan oleh kegagalan suatu node atau sistem Panduan kali ini, menunjukkan suatu metode untuk menggunakan dua linode untuk menjaga suatu website tetap online. Bahkan ketika node primary dimatikan. Pada prakteknya, akan menggunakan metode IP Failover, Heartbeat, Pacemaker dan Apache Annual Meeting TS, 7-9 Maret 2012 2
  • 3. Catatan : 1. Metode yang digunakan mungkin tidak sesuai dengan beberapa kasus High Availability yang ada. 2. Diharapkan metode yang digunakan dalam praktek ini bisa memberikan gambaran yang jelas tentang HA guna pengembangan di kasus-kasus yang lain. 3. Konfigurasi yang ada dalam metode ini hanya bekerja untuk situs yang statis Annual Meeting TS, 7-9 Maret 2012 3
  • 4. Terminology : 1. Basic system configuration 2. Assign Static IP Address 3. Install require Packages 4. Configure Apache 2 5. Configure Heartbeat 6. Configure Cluster Resources 7. Monitor Cluster Resource Annual Meeting TS, 7-9 Maret 2012 4
  • 5. Konfigurasi yang digunakan : 1. HA1  Primary Linode 2. HA2  Secondary Linode 3. 12.34.56.78  Static IP untuk Primary Linode 4. 98.76.54.32  Static IP untuk Secondary Linode 5. 44.44.44.44  “floating” IP 6. 4321  password untuk authentifikasi 7. Tes.ams.id  contoh website yang akan di bangun Annual Meeting TS, 7-9 Maret 2012 5
  • 6. Basic System Configuration : Login dengan ssh ke primary linode Edit /etc/hosts dan isi sesuai di bawah : 127.0.0.1 localhost.localdomain localhost 12.34.56.78 ha1.ams.id ha1 98.76.54.32 ha2.ams.id ha2 Annual Meeting TS, 7-9 Maret 2012 6
  • 7. Basic System Configuration : Ssh host key syncronization Ssh host key syncronization ini digunakan untuk mensinkronisasikan login antar dua linode yang berbeda Lakukan hal berikut dari primary linode : ssh-keygen -t rsa scp ~/.ssh/id_rsa.pub root@ha2:/root/ha1_key.pub ssh root@ha2 "ssh-keygen -t rsa" ssh root@ha2 "echo `cat ~/ha1_key.pub` >> ~/.ssh/authorized_keys2" ssh root@ha2 "rm ~/ha1_key.pub" scp root@ha2:/root/.ssh/id_rsa.pub /root cat ~/id_rsa.pub >> ~/.ssh/authorized_keys2 rm ~/id_rsa.pub scp /etc/ssh/ssh_host* root@ha2:/etc/ssh/ rm ~/.ssh/known_hosts ssh root@ha2 "/etc/init.d/ssh restart" scp /etc/hosts root@ha2:/etc/hosts echo "ha1" > /etc/hostname hostname -F /etc/hostname ssh root@ha2 "echo "ha2" > /etc/hostname" ssh root@ha2 "hostname -F /etc/hostname" Annual Meeting TS, 7-9 Maret 2012 7
  • 8. Assign Static IP Address : Primary Linode : Edit /etc/network/interfaces : auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 12.34.56.78 netmask 255.255.255.0 gateway 12.34.56.1 Secondary Linode : /etc/init.d/networking restart Edit /etc/network/interfaces : auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 98.76.54.32 netmask 255.255.255.0 gateway 09.76.54.1 /etc/init.d/networking restart Annual Meeting TS, 7-9 Maret 2012 8
  • 9. Install Required Packages : Primary Linode : apt-get update apt-get upgrade apt-get install heartbeat pacemaker apache2 /etc/init.d/apache2 stop update-rc.d -f apache2 remove mkdir -p /srv/www/ams.id/tes/public_html mkdir /srv/www/ams.id/tes/logs ssh root@ha2 "apt-get update" ssh root@ha2 "apt-get upgrade" ssh root@ha2 "apt-get install heartbeat pacemaker apache2" ssh root@ha2 "/etc/init.d/apache2 stop" ssh root@ha2 "update-rc.d -f apache2 remove" ssh root@ha2 "mkdir -p /srv/www/ams.id/tes/public_html" ssh root@ha2 "mkdir /srv/www/ams.id/tes/logs" Annual Meeting TS, 7-9 Maret 2012 9
  • 10. Configure Apache2 : Primary Linode : Edit /etc/apache2/ports.conf : NameVirtualHost 44.44.44.44:80 Listen 80 Buat file untuk website tes.ams.id yang akan dibuat HA : Edit /etc/apache2/sites-available/tes.ams.id : <VirtualHost 44.44.44.44:80> ServerAdmin support@ams.id ServerName tes.ams.id DocumentRoot /srv/www/ams.id/tes/public_html/ ErrorLog /srv/www/ams.id/tes/logs/error.log CustomLog /srv/www/ams.id/tes/logs/access.log combined </VirtualHost> Annual Meeting TS, 7-9 Maret 2012 10
  • 11. Configure Apache2 : Primary Linode : Lakukan perintah berikut : <VirtualHost 44.44.44.44:80> ServerAdmin support@ams.id ServerName tes.ams.id DocumentRoot /srv/www/ams.id/tes/public_html/ ErrorLog /srv/www/ams.id/tes/logs/error.log CustomLog /srv/www/ams.id/tes/logs/access.log combined </VirtualHost> Buat tes page di primary : Buat file di /srv/www/ams.id/tes/public_html/index.html : <html> <head> <title>Test page served from ha1</title> </head> <body> <h1>Test page served from ha1</h1> </body> </html> Annual Meeting TS, 7-9 Maret 2012 11
  • 12. Configure Apache2 : Secondary Linode : Buat tes page di secondary : Buat file di /srv/www/ams.id/tes/public_html/index.html : <html> <head> <title>Test page served from ha2</title> </head> <body> <h1>Test page served from ha2</h1> </body> </html> Primary Linode : Lakukan hal berikut untuk meng-enable site : a2ensite tes.ams.id ssh root@ha2 "a2ensite tes.ams.id" Annual Meeting TS, 7-9 Maret 2012 12
  • 13. Configure Heartbeat : Primary Linode : Edit /etc/heartbeat/ha.cf : logfacility daemon keepalive 2 deadtime 15 warntime 5 initdead 120 udpport 694 ucast eth0 98.76.54.32 auto_failback on node ha1 node ha2 use_logd yes crm respawn Annual Meeting TS, 7-9 Maret 2012 13
  • 14. Configure Heartbeat : Secondary Linode : Edit /etc/heartbeat/ha.cf : logfacility daemon keepalive 2 deadtime 15 warntime 5 initdead 120 udpport 694 ucast eth0 12.34.56.78 auto_failback on node ha1 node ha2 use_logd yes crm respawn Annual Meeting TS, 7-9 Maret 2012 14
  • 15. Configure Heartbeat : Primary Linode : Edit /etc/heartbeat/authkeys : auth 1 1 sha1 4321 Lakukan perintah berikut : chmod 600 /etc/ha.d/authkeys /etc/init.d/heartbeat start scp /etc/ha.d/authkeys root@ha2:/etc/ha.d/ ssh root@ha2 "chmod 600 /etc/ha.d/authkeys" ssh root@ha2 "/etc/init.d/heartbeat start" Annual Meeting TS, 7-9 Maret 2012 15
  • 16. Configure Cluster Resources : Primary Linode : Lakukan perintah berikut : export EDITOR=/bin/nano echo "export EDITOR=/bin/nano" >> .bashrc Secondary Linode : Lakukan perintah berikut : export EDITOR=/bin/nano echo "export EDITOR=/bin/nano" >> .bashrc Annual Meeting TS, 7-9 Maret 2012 16
  • 17. Configure Cluster Resources : Primary Linode : Lakukan perintah berikut : crm configure edit Akan tampil seperti berikut : node $id="285a1261-9066-45de-97ac-04b13e5a1f6c" ha1 node $id="b4fbb893-55d6-4a33-81fb-34f8d010df7f" ha2 property $id="cib-bootstrap-options" dc-version="1.0.8- 042548a451fce8400660f6031f4da6f0223dd5dd" cluster-infrastructure="Heartbeat" Annual Meeting TS, 7-9 Maret 2012 17
  • 18. Configure Cluster Resources : Primary Linode : Insert perintah berikut di antara baris kedua setelah “node” dengan “property” : primitive apache2 lsb:apache2 op monitor interval="5s" primitive ip1 ocf:heartbeat:IPaddr2 params ip=“44.44.44.44" nic="eth0:0" primitive ip1arp ocf:heartbeat:SendArp params ip=“44.44.44.44" nic="eth0:0" group WebServices ip1 ip1arp apache2 colocation apache_with_ip inf: apache2 ip1 colocation web_with_ip inf: ip1 ip1arp order arp_after_ip inf: ip1:start ip1arp:start order web_after_arp inf: ip1arp:start apache2:start Annual Meeting TS, 7-9 Maret 2012 18
  • 19. Configure Cluster Resources : Primary Linode : Tambahkan “expected-quorum-votes”, “stonith-enabled” dan “no- quorum-policy”, dan jangan lupa menambahkan “” setelah “cluster- infrastructure” sehingga seperti berikut : property $id="cib-bootstrap-options" dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" cluster-infrastructure="Heartbeat" expected-quorum-votes="1" stonith-enabled="false" no-quorum-policy="ignore" Tambahkan baris berikut setelah “property” section : rsc_defaults $id="rsc-options" resource-stickiness="100" Annual Meeting TS, 7-9 Maret 2012 19
  • 20. Configure Cluster Resources : Primary Linode : Konfigurasi komplitnya akan seperti ini : node $id="285a1261-9066-45de-97ac-04b13e5a1f6c" ha1 node $id="b4fbb893-55d6-4a33-81fb-34f8d010df7f" ha2 primitive apache2 lsb:apache2 op monitor interval="5s" primitive ip1 ocf:heartbeat:IPaddr2 params ip=“44.44.44.44" nic="eth0:0" primitive ip1arp ocf:heartbeat:SendArp params ip=“44.44.44.44" nic="eth0:0" group WebServices ip1 ip1arp apache2 colocation apache_with_ip inf: apache2 ip1 colocation web_with_ip inf: ip1 ip1arp order arp_after_ip inf: ip1:start ip1arp:start order web_after_arp inf: ip1arp:start apache2:start property $id="cib-bootstrap-options" dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" cluster-infrastructure="Heartbeat" expected-quorum-votes="1" stonith-enabled="false" no-quorum-policy="ignore" rsc_defaults $id="rsc-options" resource-stickiness="100" Annual Meeting TS, 7-9 Maret 2012 20
  • 21. Monitor Cluster Resources : Untuk memonitor clusternya gunakan perintah crm_mon dan outputnya akan seperti : ============ Last updated: Mon Jun 28 16:59:06 2010 Stack: Heartbeat Current DC: ha2 (b4fbb893-55d6-4a33-81fb-34f8d010df7f) - partition with quorum Version: 1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd 2 Nodes configured, 1 expected votes 1 Resources configured. ============ Online: [ ha1 ha2 ] Resource Group: WebServices ip1 (ocf::heartbeat:IPaddr2): Started ha1 ip1arp (ocf::heartbeat:SendArp): Started ha1 apache2 (lsb:apache2): Started ha1 Annual Meeting TS, 7-9 Maret 2012 21
  • 22. Monitor Cluster Resources : Untuk memindahkan services ke HA2 gunakan perintah berikut : crm resource move WebServices ha2 Sebaliknya untuk mengembalikan services ke HA1 gunakan perintah berikut : crm resource move WebServices ha1 Annual Meeting TS, 7-9 Maret 2012 22