Sesuai dengan request ini tak tulisken piye cara-carane konfigurasi High Availability dengan “heartbeat”.
Sesuai request juga dikataken bahwa heartbeat sudah terinstall dengan menggunakan keluarga debian dan konfigurasi fisik sudah kayak gini :
Contoh berikut ini yang ingin di fail over adalah service apache.
Jadi kalo web1 mati otomatis akan ditake over oleh web2
Keterangan :
web1 : nama host mesin pertama
web2 : nama host mesin kedua
Berikut ini daftar konfigurasi yang diperlukan :
• Konfigurasi web1
/etc/hosts
127.0.0.1 localhost
202.xxx.xxx.18 web1 web1.domainapasaja.com
202.xxx.xxx.19 web2 web2.domainapasaja.com
202.xxx.xxx.20 www http://www.domainapasaja.com domainapasaja.com
/etc/hostname
web1
/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0:0
iface eth0:0 inet static
address 202.xxx.xxx.20
netmask 255.xxx.xxx.248
# The primary network interface
auto eth0
iface eth0 inet static
address 202.xxx.xxx.18
netmask 255.xxx.xxx.248
network 202.xxx.xxx.16
broadcast 202.xxx.xxx.23
gateway 202.xxx.xxx.17
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.xxx.xxx.10 202.xxx.xxx.20
dns-search domainapasaja.com
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
• Konfigurasi web2
Setting Up the Primary Server (web2) :
/etc/hosts
127.0.0.1 localhost
202.xxx.xxx.18 web1 web1.domainapasaja.com
202.xxx.xxx.19 web2 web2.domainapasaja.com
202.xxx.xxx.20 www http://www.domainapasaja.com domainapasaja.com
/etc/hostname
web2
/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 202.xxx.xxx.19
netmask 255.255.255.248
network 202.xxx.xxx.16
broadcast 202.xxx.xxx.23
gateway 202.xxx.xxx.17
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.xxx.xxx.10 202.xxx.xxx.20
dns-search domainapasaja.com
auto eth1
iface eth1 inet static
address 192.168.1.2
netmask 255.255.255.0
/etc/ha.d/ha.cf
# Time between heartbeats in seconds
keepalive 1
# Node is pronounced dead after 15 seconds
deadtime 5
# Prevents the master node from re-acquiring cluster resources after a failover
auto_failback on
# Device for serial heartbeat
serial /dev/ttyS0
# Speed at which to run the serial line (bps)
baud 19200
# Port for udp (default)
udpport 694
# Use a udp heartbeat over the eth0 interface
udp eth1
debugfile /var/log/ha/ha.debug
logfile /var/log/ha/ha.log
# First node of the cluster (must be uname -a)
node web1
# Second node of the cluster (must be uname -a)
node web2
/etc/ha.d/authkeys
auth 1
1 crc
2 sha1 HI!
3 md5 Hello!
/etc/ha.d/haresources
web1 IPaddr::202.xxx.xxx.20 apache2
/etc/ha.d/ha.cf
# Time between heartbeats in seconds
keepalive 1
# Node is pronounced dead after 15 seconds
deadtime 5
# Prevents the master node from re-acquiring cluster resources after a failover
auto_failback on
# Device for serial heartbeat
serial /dev/ttyS0
# Speed at which to run the serial line (bps)
baud 19200
# Port for udp (default)
udpport 694
# Use a udp heartbeat over the eth0 interface
udp eth1
debugfile /var/log/ha/ha.debug
logfile /var/log/ha/ha.log
# First node of the cluster (must be uname -a)
node web1
# Second node of the cluster (must be uname -a)
node web2
/etc/ha.d/authkeys
auth 1
1 crc
2 sha1 HI!
3 md5 Hello!
/etc/ha.d/haresources
web2 IPaddr::202.xxx.xxx.20 apache2