Beranda > Linux, System Administrator > Peacemaker clustering for httpd memakai CentOS 6

Peacemaker clustering for httpd memakai CentOS 6

www1.tar-xzvf.web.id ( eth0 [192.168.0.1], eth1 [202.201.150.150] )

www2.tar-xzvf.web.id ( eth0 [192.168.0.2], eth1 [202.201.150.151] )

Interface eth0 untuk interkoneksi dan eth1 adalah link ke internet.

STEP 1 : INSTALL PEACEMAKER

[1]Install Pacemaker di kedua server tersebut

[verrysoon@kowalski]# yum -y install pacemaker

[2]Configure auth keys di kedua server

[verrysoon@kowalski]# vi /etc/ha.d/authkeys

auth 1

1 sha1 secret

[verrysoon@kowalski]# chmod 600 /etc/ha.d/authkeys

[3]Configure Corosync di kedua server

[verrysoon@kowalski]# cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf

[verrysoon@kowalski]# vi /etc/corosync/corosync.conf

compatibility: whitetank

#tambahkan baris berikut :

aisexec {

user: root

group: root

}

service {

name: pacemaker

ver: 0

use_mgmtd: yes

}

totem {

version: 2

secauth: off

threads: 0

interface {

ringnumber: 0

# Specify network address for inter-connection

bindnetaddr: 192.168.0.0

mcastaddr: 226.94.1.1

mcastport: 5405

}

}

logging {

fileline: off

to_stderr: no

to_logfile: yes

to_syslog: yes

logfile: /var/log/cluster/corosync.log

debug: off

timestamp: on

logger_subsys {

subsys: AMF

debug: off

}

}

amf {

mode: disabled

}

[verrysoon@kowalski]# chown -R hacluster. /var/log/cluster

[verrysoon@kowalski]# /etc/rc.d/init.d/corosync start

Starting Corosync Cluster Engine (corosync): [ OK ]

[verrysoon@kowalski]# chkconfig corosync on

[4]Execute crm_mon on a Host, kalo berhasil akan ada output berikut.

[verrysoon@kowalski]# crm_mon

============

Last updated: Fri Nov 16 20:56:49 2012

Stack: openais

Current DC: www1.tar-xzvf.web.id – partition with quorum

Version: 1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe

2 Nodes configured, 2 expected votes

0 Resources configured.

============

Online: [ www1.tar-xzvf.web.id www1.tar-xzvf.web.id ]

[verrysoon@kowalski]# crm configure property no-quorum-policy=”ignore” stonith-enabled=”false”

[verrysoon@kowalski]# crm configure rsc_defaults resource-stickiness=”INFINITY” migration-threshold=”1″

[5]Untuk clear peacemaker lakukan command berikut

[verrysoon@kowalski]# /etc/rc.d/init.d/corosync stop # stop

[verrysoon@kowalski]# rm -f /var/lib/heartbeat/crm/* # remove all

[verrysoon@kowalski]# /etc/rc.d/init.d/corosync start # start

STEP 2 : SET VIRTUAL IP

[1]Configure Virtual IP diHost

[verrysoon@kowalski]# crm configure

crm(live)configure# primitive vip ocf:heartbeat:IPaddr2 \

> params ip=”202.201.150.153″ \ #Virtual IP Address

> nic=”eth1″ \

> cidr_netmask=”24″ \

> op start interval=”0s” timeout=”60s” \

> op monitor interval=”5s” timeout=”20s” \

> op stop interval=”0s” timeout=”60s”

crm(live)configure# show 

node www1.tar-xzvf.web.id

node www2.tar-xzvf.web.id

primitive vip ocf:heartbeat:IPaddr2 \

params ip=”202.201.150.153″ nic=”eth1″ cidr_netmask=”24″ \

op start interval=”0s” timeout=”60s” \

op monitor interval=”5s” timeout=”20s” \

op stop interval=”0s” timeout=”60s”

property $id=”cib-bootstrap-options” \

dc-version=”1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe” \

cluster-infrastructure=”openais” \

expected-quorum-votes=”2″ \

no-quorum-policy=”ignore” \

stonith-enabled=”false”

rsc_defaults $id=”rsc-options” \

resource-stickiness=”INFINITY” \

migration-threshold=”1″

crm(live)configure# commit # enable settings

crm(live)configure# exit

bye

[3]Execute crm_mon and make sure status.

[verrysoon@kowalski]# crm_mon

============

Last updated: Fri Nov 16 20:59:16 2011

Stack: openais

Current DC: www1.tar-xzvf.web.id – partition with quorum

Version: 1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe

2 Nodes configured, 2 expected votes

1 Resources configured.

============

Online: [ www1.tar-xzvf.web.id www2.tar-xzvf.web.id ]

vip (ocf::heartbeat:IPaddr2): Started www1.tar-xzvf.web.id

[4] Pastikan sudah connected

[verrysoon@kowalski]# ping 202.201.150.153

PING 202.201.150.153 (202.201.150.153) 56(84) bytes of data.

64 bytes from 202.201.150.153: icmp_seq=1 ttl=64 time=0.016 ms

64 bytes from 202.201.150.153: icmp_seq=2 ttl=64 time=0.008 ms

64 bytes from 202.201.150.153: icmp_seq=3 ttl=64 time=0.009 ms

64 bytes from 202.201.150.153: icmp_seq=4 ttl=64 time=0.025 ms

64 bytes from 202.201.150.153: icmp_seq=5 ttl=64 time=0.014 ms

64 bytes from 202.201.150.153: icmp_seq=6 ttl=64 time=0.008 ms

— 202.201.150.153 ping statistics —

6 packets transmitted, 6 received, 0% packet loss, time 5149ms

rtt min/avg/max/mdev = 0.008/0.013/0.025/0.006 ms

STEP 3 : MONITOR HTTP

[1]Set Virtual IP Address first.

[2]Enable server-status on httpd. Set it on both Hosts.

[verrysoon@kowalski]# vi /etc/httpd/conf/httpd.conf

# line 921-926: uncomment and chnage acceses permittion

<Location /server-status>

SetHandler server-status

Order deny,allow

Deny from all

Allow from 127.0.0.1 202.201.150.0/24

</Location>

[3]Configure Clustering. Set it on a Host.

[verrysoon@kowalski]# crm configure

crm(live)configure# primitive httpd ocf:heartbeat:apache \

> params configfile=”/etc/httpd/conf/httpd.conf” \

> port=”80″ \

> op start interval=”0s” timeout=”60s” \

> op monitor interval=”5s” timeout=”20s” \

> op stop interval=”0s” timeout=”60s”

crm(live)configure# group webserver vip httpd # create a group

crm(live)configure# show #confirm settings

node www1.tar-xzvf.web.id

node www2.tar-xzvf.web.id

primitive httpd ocf:heartbeat:apache \

params configfile=”/etc/httpd/conf/httpd.conf” port=”80″ \

op start interval=”0s” timeout=”60s” \

op monitor interval=”5s” timeout=”20s” \

op stop interval=”0s” timeout=”60s”

primitive vip ocf:heartbeat:IPaddr2 \

params ip=”202.201.150.150″ cidr_netmask=”24″ \

op start interval=”0s” timeout=”60s” \

op monitor interval=”5s” timeout=”20s” \

op stop interval=”0s” timeout=”60s”

group webserver vip httpd

property $id=”cib-bootstrap-options” \

dc-version=”1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe” \

cluster-infrastructure=”openais” \

expected-quorum-votes=”2″ \

no-quorum-policy=”ignore” \

stonith-enabled=”false”

rsc_defaults $id=”rsc-options” \

resource-stickiness=”INFINITY” \

migration-threshold=”1″

crm(live)configure# commit # enable settings

crm(live)configure# exit

bye

[4]Pastikan status with crm_mon, then httpd starts on a Host.

[verrysoon@kowalski]# crm_mon

============

Last updated: Fri Nov 16 21:03:50 2011

Stack: openais

Current DC: www1.tar-xzvf.web.id – partition with quorum

Version: 1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe

2 Nodes configured, 2 expected votes

1 Resources configured.

============

Online: [ www1.tar-xzvf.web.id www2.tar-xzvf.web.id ]

Resource Group: webserver

vip (ocf::heartbeat:IPaddr2): Started www1.tar-xzvf.web.id

httpd (ocf::heartbeat:apache): Started www2.tar-xzvf.web.id

[5]Access to Virtual IP address, di browser

http://202.201.150.150 dan http://202.201.150.151

 

Regards,

Verrysoon

http://forum.tar-xzvf.web.id

  1. April 10, 2013 pukul 10:52 am

    Have you ever considered about adding a little bit more than just your articles?
    I mean, what you say is valuable and all. Nevertheless imagine if you added some great pictures or videos to give your
    posts more, “pop”! Your content is excellent but
    with pics and clips, this blog could definitely be
    one of the most beneficial in its field. Excellent blog!

  2. Mei 24, 2013 pukul 12:10 am

    Right here is the perfect website for everyone who really wants
    to find out about this topic. You understand a whole lot its almost tough to argue with you
    (not that I actually will need to…HaHa). You certainly put
    a brand new spin on a topic which has been discussed for ages.
    Wonderful stuff, just excellent!

  3. Juni 4, 2013 pukul 12:58 pm

    Xantrex Photovoltaic Inverter energy in the mix but I think one of the very reasons divorce rate is still increasing.

  4. Juni 9, 2014 pukul 7:22 am

    On their first mission, they brought back live chickens and ducks which they had captured.
    E3 2013 has added an Online and Mobile Game Pavilion this year.
    With new updates coming in from time to time, this game will keep
    you entertained with almost endless play-ability.

  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s