Author Topic: heartbeat version 3 + drbd + pacemaker on centos  (Read 17337 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
heartbeat version 3 + drbd + pacemaker on centos
« on: พฤษภาคม 12, 2011, 05:14:55 PM »
วันนี้ ว่าจะมาอัฟข้อมูลเกี่ยวกับ เรื่องของ heartbeat version 3 + drbd + pacemaker ครับ
ซึ่งใช้งานบน production จริงๆ ครับ แล้วก็มีประสิทธิภาพในการใช้งานดี ทีเดียว

เลยอยากนำมาแบ่งปัน เพื่อนๆ ดูครับ เผื่อจะได้นำไปประยุกต์ใช้ เพื่อให้เกิดประโยชน์แก่ สังคม ต่อไป

###โจทย์
1. ให้ทำระบบ web ที่ใช้งานกับ ldap ให้มีประสิทธิภาพในการใช้งาน คือถ้า node หลักตาย ให้ย้ายการทำงานไป node รองได้ โดยที่ส่วนของ database ต้องใช้งานได้ปกติ

###ทรัพยากร
1. มีเครื่องserver ldap 2 ตัว ทำ virtual ip กัน

###Main Application:
Heartbeat V.3 : ทำหน้าที่ fail over service เช่น node master ตายจะ เช๊ค process แล้วย้ายไปทำงาน slave node แทน
drbd83 : ทำหน้าที่ disk replicate block data คือทำหน้าที่เก็บ data ไว้ใน path ที่เป็น drbd เวลาที่ heartbeat ย้ายไปทำงานที่ slave node ก็จะทำการย้าย path นี้ไปด้วย
Pacemaker :  ทำหน้าที่ เพิ่มประสิทธิภาพในการทำ fail over service ให้กับ heartbeat ครับ
apache2 :  ทำหน้าที่ให้บริการเว็บเพจ
openldap : เก็บ database ของลูกค้าเป็นรูปแบบ ldap

#####เริ่มกันเลย

1. ทำการ install OS = ผมใช้เป็น centos 5.4 AMD 64bit (ลงไว้ในรูปแบบนี้ ทั้งสองเครื่อง )
2. ตอนแบ่ง partition ต้องกันพื้นที่ disk ไว้ประมาณ 5G เพื่อใช้เป็น drbd path เก็บข้อมูล database

[root@ha0 etc]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1305 10482381 83 Linux
/dev/sda2 1306 1958 5245222+ 83 Linux      ==> อันนี้เป็น drbd path ครับ ไม่ต้อง mount ไว้ใน fstab นะครับ heartbeat จะทำให้เองหลังจากinstallเสร็จ
/dev/sda3 1959 1991 265072+ 82 Linux swap / Solaris   ==> Swap path

### ส่วนของ network ครับ
eth0 10.0.1.143 10.0.1.144 (Connected to switch)  ###สำหรับ service และ physical ip
eth1 192.168.56.101 192.168.56.102 (Directly connected with cross cable) ###สำหรับ heartbeat #0
eth2 10.1.0.1 10.1.0.2 (Directly connected with cross cable) ###สำหรับ heartbeat #1 และ ใช้ในการ sync data drbd ครับ

## เริ่มทำการ ลง application drbd ครับ (ตัวนี้ต้องลง ทั้ง kernel module ของ drbd ด้วยนะครับ) ลงเสร็จทำการปิด service ตอน startup ด้วยครับ ป้องกันไม่ให้ heartbeat สับสน

[root@ha0 ~]# yum install drbd83.x86_64 kmod-drbd83.x86_64
[root@ha0 ~]# chkconfig drbd off

หลังจากลง drbd เสร็จทำการ ปรับ full zero partition ที่ใช้ทำ drbd เพื่อให้พร้อมกับการใช้งานครับ

[root@ha0 etc]# dd if=/dev/zero of=/dev/sda2
dd: writing to `/dev/sda2': No space left on device
10490446+0 records in
10490445+0 records out
5371107840 bytes (5.4 GB) copied, 163.096 seconds, 32.9 MB/s
[root@ha0 etc]#

ทำการแก้ไข config "drbd.conf" ดังนี้ครับ
โดยที่  1 DRBD resource (r0) – DRBD target block device (/dev/sda2) - DRBD device name(/dev/drbd0).

#vi /etc/drbd.conf

global {
usage-count no;
}
common {
syncer { rate 30M;}
}
resource r0 {
protocol C;
disk {
on-io-error pass_on;
}
device /dev/drbd0;
disk /dev/sda2;
on ha0.test.aaa {
address 10.1.0.1:7788;
meta-disk internal;
}
on ha1.test.aaa {
address 10.1.0.2:7788;
meta-disk internal;
}
}

หลังจากทำ config เสร็จใน ldap server ทั้ง สองเครื่อง
ต่อไปทำการ สร้าง meta data ให้กับ drbd ครับ (รัน command นี้ทั้งสองเครื่อง)
[root@ha0 etc]# drbdadm create-md r0

เมื่อรันเสร็จแล้ว ถ้าเจอข้อความนี้แสดงว่าเสร็จ
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.

ต่อไปทำการ สั่ง start drbd service ให้ทำงาน โดย manual command (รัน command นี้ทั้งสองเครื่อง)
[root@ha0 etc]# /etc/init.d/drbd start

ถ้ารันได้สำเร็จจะขึ้น ข้อความแบบข้างล่าง ( ทั้งสองเครื่อง)
Starting DRBD resources: [
r0
Found valid meta data in the expected location, 5371101184 bytes into
/dev/sda2.
d(r0) s(r0) n(r0) ].
[root@ha0 etc]#

เสร็จแล้วทำการ check process drbd ว่าทำงานหรือเปล่า
[root@ha0 ~]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by
mockbuild@builder10.centos.org, 2010-06-04 08:04:09
0: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r----   ==> แสดงว่ายังไม่เริ่ม sync ข้อมูลกันครับ
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:5245020

### สำคัญ รัน command นี้ที่ master node นะครับ (เครื่องเดียวเท่านั้น)
[root@ha0 ~]# drbdadm -- --overwrite-data-of-peer primary r0

###เมื่อเสร็จแล้วทำการ check process drbd อีกครั้งครับ จะเห็นว่า เริ่ม sync data กันแล้วระหว่างสอง node 
[root@ha0 ~]# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
GIT-hash: d78846e52224fd00562f7c225bcc25b2d422321d build by
mockbuild@builder10.centos.org, 2010-06-04 08:04:09
0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----   ==> ทำงานเป็น primary/secondary แล้ว
ns:544768 nr:0 dw:0 dr:544768 al:0 bm:33 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:4700252
[=>..................] sync'ed: 10.5% (4588/5120)M delay_probe: 104     ==> เริ่ม sync data กันแล้วครับ
finish: 0:07:09 speed: 10,868 Sync pro g(1re0s,s2 76) K/sec


« Last Edit: พฤษภาคม 12, 2011, 06:05:02 PM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #1 on: กุมภาพันธ์ 07, 2012, 11:08:13 AM »
ถ้าทำการ sync replicate block device เรียบร้อยทั้งสอง node แล้ว
ตรง ro: จะเป็น ro:Primary/Secondary          //หน้าที่ของแต่ละ node
ส่วนของ ds: จะเป็น ds:UpToDate/UpToDate  //สถานะของ diskจะเป็น UpToDate ทั้งสอง node ครับ

[root@ha0 golf]# cat /proc/drbd
version: 8.3.12 (api:88/proto:86-96)
GIT-hash: e2a8ef4656be026bbae540305fcb998a5991090f build by mockbuild@builder10.centos.org, 2012-01-28 13:52:25
 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
    ns:520192 nr:0 dw:0 dr:520192 al:0 bm:53 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

ลองดูนะครับผม

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #2 on: กุมภาพันธ์ 07, 2012, 11:10:03 AM »
เสร็จแล้วทำการ mount device ที่เป็น drbd ขึ้นมาเพื่อทำงานครับ

#mount /dev/drbd0 /data

/data คือ path ที่เป็น resource กลางเก็บอยู่ครับผม
« Last Edit: เมษายน 04, 2013, 09:25:01 AM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #3 on: กุมภาพันธ์ 07, 2012, 11:13:03 AM »
ลองเทส io ของ path ที่เป็น drbd ดูนะครับผม

#### check write file on disk
#dd if=/dev/zero of=/data/dummy.dat bs=10240 count=1000000

1000000+0 records in
1000000+0 records out
10240000000 bytes (10 GB) copied, 19.4393 seconds, 527 MB/s

ก็ถือว่าพอใช้ได้ทีเดียว สำหรับ disk ที่เป็น SAS


« Last Edit: เมษายน 04, 2013, 09:24:47 AM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #4 on: เมษายน 04, 2013, 09:14:16 AM »
ต่อไปจะพูดถึงในเรื่องของ Heartbeat version 3.0.3 นะครับผม
ตัว heartbeat จะใช้ควบคุมการทำงาน ในเรื่อง High availability ประมาณว่าถ้าให้คุมการทำงาน ในกรณีของเครื่องหลักพังไป แล้วให้เครื่องสำรองขึ้นมาทำงานแทน
และใช้งานร่วมกับ Pacemaker ซึ่งเป็นตัวสคิป ที่ไว้ใช้ควบคุม ตัว application ที่นำมาใช้งานในกลุ่มของ resource ครับผม
ซึ่งในตัวอย่างผมจะยกตัวอย่างที่เป็น web+mysql DB app นะครับผม

น่าจะพอมองเห็นภาพการทำงาน กันบ้างนะครับ ต่อไปเริ่มการ install + configure กันเลยครับผม

ก่อนอื่นต้องหา repo ที่มี package มาให้ได้ก่อนนะครับ  
Install heartbeat , ทำการ copy file "pacemaker-1.0.12-1.2.el5.x86_64.repo.tar.gz" into /tmp
#cp pacemaker-1.0.12-1.2.el5.x86_64.repo.tar.gz /tmp/.
#cd /tmp
#tar zxf pacemaker-1.0.12-1.2.el5.x86_64.repo.tar.gz
#mv /tmp/pacemaker/pacemaker.repo /etc/yum.repos.d/  

เริ่มลง package heartbeat+pacemaker กันเลยครับ
#yum install heartbeat.x86_64
#yum install pacemaker.x86_64
#yum install pm_logconv-hb.noarch

ตัวนี้จะเป็นตัวช่วยเราในการ debug นะครับ สำหรับผมแล้วเรื่องนี้จำเป็นมาก บางครั้งเกิดปัญหาขึ้น การ debug เป็นสิ่งที่จะช่วยเราได้
#vi /etc/pm_logconv.conf
open comment on
     [Settings]
     ha_log_path = /var/log/ha-log
     output_path = /var/log/pm_logconv.out
     act_rsc = r_vip0, r_httpd"

ต่อไปเริ่มลง application ครับผม
#yum install httpd.x86_64
#yum install mod_ssl.x86_64
#yum install mysql-server.x86_64
#yum install openssl.x86_64
set password for mysql
#mysqladmin -u root password newpass"

ถ้าจะใช้งาน Heartbeat ให้ควบคุมการทำงานของ httpd + mysqld ต้องทำการปิด init script ไม่ให้ทำงานนะครับ
แต่จะให้ pacemaker ทำหน้าที่นี้แทนในการใช้งานร่วมกับ heartbeat ครับผม
#chkconfig httpd off
#/etc/init.d/httpd stop

#chkconfig  mysqld off
#/etc/init.d/mysqld stop

#chkconfig drbd off
#/etc/init.d/drbd stop

ที่ต้องปิด heartbeat ด้วยก็เพราะว่า ให้ admin ทำหน้าที่เปิดเอง เพราะเราจะได้เชคการทำงานได้ครับผม
อันนี้แล้วแต่ความสะดวกนะครับผม สำหรับผม เลือกวิธีนี้

# chkconfig heartbeat off
#/etc/init.d/heartbeat stop

ทำการ configure httpd ให้เปิดการทำงานของ server-status ด้วยนะครับ
#vi /etc/httpd/conf/httpd.conf
<Location /server-status>
     SetHandler server-status
     Order deny,allow
     Deny from all
     Allow from 127.0.0.1
</Location>"

« Last Edit: เมษายน 04, 2013, 09:18:08 AM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #5 on: เมษายน 04, 2013, 09:24:23 AM »
ต่อไปทำการสร้าง path เพื่อเก็บการทำงานของ ไฟล์configure , ไฟล์เว็บ , ไฟล์Database นะครับ
โดยผมจะสร้างเก็บไว้ที่ path กลางบน drbd นั่นคือ /data

#mkdir -p /data/CONFIG
#mkdir -p /data/MYSQL
#mkdir -p /data/WWW

ทำการสร้าง link กลับมาที่ path หลักของไฟล์ config my.cnf
#cp /etc/my.cnf /data/CONFIG/.
#mv /etc/my.cnf /etc/my.cnf.ori
#ln -s /data/CONFIG/my.cnf /etc/my.cnf

ทำการสร้าง link กลับมาที่ path หลักของไฟล์ Database
#mv /var/lib/mysql /data/MYSQL/mysql
#chown -R mysql:mysql /data/MYSQL
#ln -s /data/MYSQL/mysql  /var/lib/mysql

ทำการสร้าง link กลับมาที่ path หลักของไฟล์ config httpd
#mv /etc/httpd  /etc/httpd.ori
#cp -r /etc/httpd.ori /data/CONFIG/httpd
#cd /data/CONFIG/httpd
#unlink logs
#ln -s /var/log/httpd /data/CONFIG/httpd/logs
#unlink run
#ln -s /var/run /data/CONFIG/httpd/run
#unlink modules
#ln -s /usr/lib64/httpd/module modules
#ln -s /data/CONFIG/httpd /etc/httpd
#cd /var/www/
#mv html /data/WWW/html
#mv cgi-bin /data/WWW/cgi-bin
#ln -s /data/WWW/cgi-bin /var/www/cgi-bin
#ln -s /data/WWW/html /var/www/html
#mkdir -p /log/httpd"

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #6 on: เมษายน 04, 2013, 09:38:23 AM »
ต่อไปเริ่มทำการ configure ha.cf,authkeys ครับ
แล้วก็ทำการ upload file configure ของ heartbeat เข้า resource

#cp /etc/ha.d/ha.cf /etc/ha.d/ha.cf.ori
#echo > /etc/ha.d/ha.cf
#vi /etc/ha.d/ha.cf
crm yes
auto_failback off
debugfile /var/log/ha-debug
logfile  /var/log/ha-log
logfacility none
keepalive 2
deadtime 30
warntime 10
initdead 60
udpport 694
bcast eth1
node ha0.test.aaa
node ha1.test.aaa

ส่วน authkeys
#cd /etc/ha.d
#cp authkeys authkeys.ori
#vi authkeys
auth 2
2 sha1 MYTEST@

ทำการ chmod authkeys ด้วยนะครับผม เพื่อความปลอดภัย
#chmod 600 authkeys

เสร็จแล้วทำการเตรียม file configure ของ resource ที่จะเก็บบน crm ไว้ครับ
#vi ha_crm.cib

primitive r_drbd_r0 ocf:linbit:drbd \
   params drbd_resource="r0" \
   op monitor interval="20s"
primitive r_fs ocf:heartbeat:Filesystem \
   params device="/dev/drbd0" directory="/data" fstype="ext3" options="noatime" \
   op monitor interval="20s" timeout="10s" on-fail="restart" OCF_CHECK_LEVEL="10" \
   op start on-fail="restart" interval="0s" timout="40s" \
   op stop on-fail="ignore" interval="0s" timout="40s"
primitive r_httpd ocf:heartbeat:apache \
   params configfile="/data/CONFIG/httpd/conf/httpd.conf" \
   op monitor interval="20s" timeout="10s" on-fail="restart" \
   op start on-fail="restart" interval="0s" timout="40s" \
   op stop on-fail="ignore" interval="0s" timout="40s"
primitive r_mysqld ocf:heartbeat:mysql \
   params binary="/usr/bin/mysqld_safe" config="/data/CONFIG/my.cnf" datadir="/data/MYSQL/mysql" pid="/var/run/mysqld/mysqld.pid" \
   op monitor interval="20s" timeout="10s" on-fail="restart" \
   op start on-fail="restart" interval="0s" timout="40s" \
   op stop on-fail="ignore" interval="0s" timout="40s"
primitive r_vip0 ocf:heartbeat:IPaddr2 \
   params ip="192.168.56.103" cidr_netmask="24"
group rg_sc r_vip0 r_fs r_mysqld r_httpd \
   meta target-role="Started" is-managed="true"
ms ms_drbd_r0 r_drbd_r0 \
   meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
location l_defaultnode rg_sc 100: h0.test.aaa
colocation c_sc inf: rg_sc ms_drbd_r0:Master
order o_sc inf: ms_drbd_r0:promote rg_sc:start
property $id="cib-bootstrap-options" \
   no-quorum-policy="ignore" \
   stonith-enabled="false" \
   default-resource-stickiness="200" \
   dc-version="1.0.12-066152e" \
   cluster-infrastructure="Heartbeat" \
   last-lrm-refresh="1364438238"
rsc_defaults $id="rsc-options" \
   migration-threshold="5"

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #7 on: เมษายน 04, 2013, 09:42:42 AM »
หลังจาก เตรียม configure ทุกอย่างเสร็จแล้วทำการ load ha_crm.cib เข้าระบบได้ดังนี้ครับผม

ที่เครื่อง Active หลัก
h0#/etc/init.d/heartbeat start
h1#/etc/init.d/heartbeat start

check monitor service
h0#crm_mon -of

h0#crm configure
>load ha_crm.cib
>commit

รอสัก 1 นาทีครับผม
หลังจากนั้น ลองให้ start resource ดูครับผม
>start rg_xx

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #8 on: เมษายน 04, 2013, 09:50:20 AM »
สำหรับการ debug ก็ดูได้จาก command ข้างล่างได้นะครับผม

#tail -f /var/log/ha-debug
#crm_mon -of

ส่วนถ้า service ที่อยู่ใน node ถ้า start ไม่ขึ้นก็อาจจะ ลอง manual start แล้วทำการเชค log ที่ service นั้นได้นะครับผม เช่น
apache start ผ่าน resource ใน heartbeat ไม่ขึ้นก็ทำการ stop heartbeat ก่อนแล้วทำการ mount drbd ขึ้นมาเพื่อ start httpd แบบ manual ครับ

h0#/etc/init.d/heartbeat stop
h1#/etc/init.d/heartbeat stop

h0#/etc/init.d/drbd start
h1#/etc/init.d/drbd start

h0#drbdadm -- --overwrite-data-of-peer primary r0
h0#mount /dev/drbd0 /data
h0#/etc/init.d/httpd start

h0#tail -f /var/log/httpd/errors

ถ้าแก้ไขเสร็จแล้วก็ทำการ stop httpd , stop drbd แล้ว start heartbeat ปกตินะครับผม
ลองดูนะครับ

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #9 on: ตุลาคม 10, 2013, 10:15:59 AM »
ถ้าเกิดเหตุการณ์ของตัว stacked (ชื่อ resource =r2)ขึ้นเป็น  cs:Unconfigured

[root@backup01 /]# cat /proc/drbd
version: 8.3.15 (api:88/proto:86-97)
GIT-hash: 0ce4d235fc02b5c53c1c52c53433d11a694eab8c build by mockbuild@builder10.centos.org, 2013-03-27 16:01:26
 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
    ns:10661596 nr:0 dw:443024 dr:29384684 al:350 bm:633 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

 3: cs:Unconfigured

แก้ไขโดยทำการ adjust node ที่ master ดังนี้ครับ
#drbdadm --stacked adjust r2

[root@backup01 /]# cat /proc/drbd
version: 8.3.15 (api:88/proto:86-97)
GIT-hash: 0ce4d235fc02b5c53c1c52c53433d11a694eab8c build by mockbuild@builder10.centos.org, 2013-03-27 16:01:26
 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
    ns:10661597 nr:0 dw:443025 dr:29385277 al:350 bm:633 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

 3: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

 drbdadm --stacked primary r2

 3: cs:Connected ro:Master/Secondary ds:UpToDate/UpToDate C r-----
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0


golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #10 on: มิถุนายน 30, 2015, 10:44:23 AM »
property $id="cib-bootstrap-options" \
   no-quorum-policy="ignore"

 setting ในส่วนนี้ มีความสำคัญมาก ลองมาดูความหมายของมันกันครับผม
การทำงานของ no-quorum-policy="ignore" สามารถระบุให้เกิดการ recover resource ได้กรณีถ้าต่อกันสองเครื่องทำ cluster เป็นแบบ Master , Slave
ถ้า node master ดับไป ตัว HA จะทำการ recover ไปเริ่ม resource ที่อีกหนึ่งทันที ครับ

    Two-node clusters: Since a single node failure would always result in a loss of majority, usually you want the cluster to carry on regardless. Resource integrity is ensured using fencing, which also prevents split brain scenarios.

    Resource-driven clusters: For local clusters with redundant communication channels, a split brain scenario only has a certain probability. Thus, a loss of communication with a node most likely indicates that the node has crashed, and that the surviving nodes should recover and start serving the resources again.

    If no-quorum-policy is set to ignore, a 4-node cluster can sustain concurrent failure of three nodes before service is lost, whereas with the other settings, it would lose quorum after concurrent failure of two nodes.

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #11 on: มิถุนายน 30, 2015, 10:50:18 AM »
อ่านเพิ่มเติมได้นะครับผม
https://www.suse.com/documentation/sle_ha/book_sleha/data/sec_ha_configuration_basics_global.html

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: heartbeat version 3 + drbd + pacemaker on centos
« Reply #12 on: กรกฎาคม 03, 2015, 06:04:45 PM »
STONITH (Shoot The Other Node In The Head)

Stonith is our fencing implementation. It provides the node level fencing.
NB

The stonith and fencing terms are often used interchangeably here as well as in other texts.

The stonith subsystem consists of two components:

    stonithd

    stonith plugins

stonithd

stonithd is a daemon which may be accessed by the local processes or over the network. It accepts commands which correspond to fencing operations: reset, power-off, and power-on. It may also check the status of the fencing device.

stonithd runs on every node in the CRM HA cluster. The stonithd instance running on the DC node receives a fencing request from the CRM. It is up to this and other stonithd programs to carry out the desired fencing operation.
Stonith plugins

For every supported fencing device there is a stonith plugin which is capable of controlling that device. A stonith plugin is the interface to the fencing device. All stonith plugins look the same to stonithd, but are quite different on the other side reflecting the nature of the fencing device.

Some plugins support more than one device. A typical example is ipmilan (or external/ipmi) which implements the IPMI protocol and can control any device which supports this protocol.