Author Topic: install heartbeat on freebsd  (Read 7026 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
install heartbeat on freebsd
« on: มกราคม 23, 2011, 12:53:18 AM »
##heartbeat port
cd /usr/ports/sysutils/heartbeat/

make config
make install clean


config on ha.cf
#vi /usr/local/etc/ha.d/ha.cf

logfile /var/log/ha-log
debugfile /var/log/ha-debug
logfacility local0
bcast bce1
baud 9600
serial /dev/cuad0
auto_failback on
node mysql0.test.server
node ldap01.test.server
ping 10.0.0.1
respawn hacluster /usr/local/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
keepalive 2
deadtime 10
warntime 5
initdead 30

-----------------------------------------------------------------
อธิบาย ค่า config

logfile /var/log/ha-log
ให้เปิด logfile ไปที่ไฟล์ /var/log/ha-log
debugfile /var/log/ha-debug
ให้เปิด debugfile ไปที่ไฟล์ /var/log/ha-debug
logfacility local0
ให้กำหนดการโชว์ log เป็น 0
bcast bce1
ให้ broadcast packet สำหรับ heartbeat ไปถึงกันผ่าน bce1
baud 9600
ให้เปิดใช้งาน serial port ผ่าน rate 9600
serial /dev/cuad0
ให้เปิดใช้งาน device serial port ที่ cuad0 ปกติ freebsd ใช้ตัว device นี้
auto_failback on
กำหนดให้ทำการ auto failback กรณีตัว master ที่ตายกลับมาทำงานได้ใหม่
node mysql0.test.server
node mysql1.test.server
ชื่อ เครื่องที่ทำการ รัน heartbeat และใช้งาน heartbeat
ping 10.0.0.1
ให้เช็คปิงไปที่ gateway node ถ้า master ping ไม่ได้จะ swap การทำงานไปที่ slave node
respawn hacluster /usr/local/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
เปิดให้ใช้งาน ipfail ในการเช๊ค heartbeat ด้วย
keepalive 2
deadtime 10
ค่าตัวนี้ ใช้ในการระบุหาก master node ตาย ให้ทำการรอประมาณ 10 วินาที แล้วจะย้าย vip ไปที่ slave
node
warntime 5
เตือนเวลา heartbeat ไม่สามารถคุยกันได้
initdead 30
ระบุว่า อีก host ตายในเวลา 30 วินาที กรณี boot เครื่องมาใหม่ แล้วไม่เจออีก node

-----------------------------------------------------------------
###create authkeys file , input below command on shell prompt
( echo -ne "auth 1\n1 sha1 "; \
  dd if=/dev/urandom bs=512 count=1 | openssl md5 ) \
  > /etc/ha.d/authkeys

chmod 0600 /usr/local/etc/ha.d/authkeys

หรือเข้าไป ทำ md5 ที่ link ข้างล่างนี้ก็ได้ครับ
http://7thspace.com/webmaster_tools/online_md5_encoder.html
-----------------------------------------------------------------

#### create file \"haresources\" to share packet
mysql0.test.server 10.0.0.2

ทำการ config ที่ mysql1 ให้มีค่า config เหมือนกันทั้งสามไฟล์
ha.cf
authkeys
haresources

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2141
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install heartbeat on freebsd
« Reply #1 on: มกราคม 23, 2011, 12:53:39 AM »
initdead 30
ระบุว่า อีก host ตายในเวลา 30 วินาที กรณี boot เครื่องมาใหม่ แล้วไม่เจออีก node

ให้ทำการ restart service heartbeat พร้อมกันใหม่
แล้วทั้งสองเครื่องจะได้ share connection กัน