[GELÖST] Pacemaker - Resourcen verteilen sich auf die Nodes

Alle weiteren Dienste, die nicht in die drei oberen Foren gehören.
Antworten
Benutzeravatar
Wambui
Beiträge: 120
Registriert: 03.08.2014 10:06:10
Lizenz eigener Beiträge: GNU Free Documentation License

[GELÖST] Pacemaker - Resourcen verteilen sich auf die Nodes

Beitrag von Wambui » 08.02.2016 10:39:45

Hallo,
ich habe auf zwei Virtualbox-Instanzen ein Pacemaker-Cluster (Debian-Wheezy) installiert und einen Apache2.

Code: Alles auswählen

elwood:~ $ crm status  
============
Last updated: Mon Feb  8 10:18:42 2016
Last change: Mon Feb  8 10:16:46 2016 via crm_attribute on elwood
Stack: openais
Current DC: jake - partition with quorum
Version: 1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff
2 Nodes configured, 2 expected votes
2 Resources configured.
============

Online: [ elwood jake ]

 Service_IP     (ocf::heartbeat:IPaddr2):       Started elwood
 apache2        (ocf::heartbeat:apache):        Started elwood

Failed actions:
    apache2_monitor_20000 (node=jake, call=7, rc=7, status=complete): not running
Jetzt ist unter der Service_IP 192.168.0.150 der Webserver erreichbar.
Dann stoppe ich jake:

Code: Alles auswählen

crm_standby -U jake -v true

Code: Alles auswählen

elwood:~ $ crm status
============
Last updated: Mon Feb  8 10:24:42 2016
Last change: Mon Feb  8 10:24:10 2016 via crm_attribute on elwood
Stack: openais
Current DC: jake - partition with quorum
Version: 1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff
2 Nodes configured, 2 expected votes
2 Resources configured.
============

Node jake: standby
Online: [ elwood ]

 Service_IP     (ocf::heartbeat:IPaddr2):       Started elwood
 apache2        (ocf::heartbeat:apache):        Started elwood

Failed actions:
    apache2_monitor_20000 (node=jake, call=7, rc=7, status=complete): not running
Apache2 und Service-IP bekommt elwood und der Webserver ist erreichbar, soweit gut.
Jetzt mache jake wieder verfügbar:

Code: Alles auswählen

elwood:~ $ crm_standby -U jake -v false
elwood:~ $ crm status
============
Last updated: Mon Feb  8 10:26:21 2016
Last change: Mon Feb  8 10:24:10 2016 via crm_attribute on elwood
Stack: openais
Current DC: jake - partition with quorum
Version: 1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff
2 Nodes configured, 2 expected votes
2 Resources configured.
============

Online: [ elwood jake ]

 Service_IP     (ocf::heartbeat:IPaddr2):       Started elwood
 apache2        (ocf::heartbeat:apache):        Started elwood

Failed actions:
    apache2_monitor_20000 (node=jake, call=7, rc=7, status=complete): not running
Der Webserver ist immer noch verfügbar. Soweit gut.
Jetzt das ganze mit elwood, der ausfällt:

Code: Alles auswählen

elwood:~ $ crm_standby -U elwood -v true
elwood:~ $ crm status
============
Last updated: Mon Feb  8 10:28:14 2016
Last change: Mon Feb  8 10:28:10 2016 via crm_attribute on elwood
Stack: openais
Current DC: jake - partition with quorum
Version: 1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff
2 Nodes configured, 2 expected votes
2 Resources configured.
============

Node elwood: standby
Online: [ jake ]

 Service_IP     (ocf::heartbeat:IPaddr2):       Started jake
 apache2        (ocf::heartbeat:apache):        Started jake

Failed actions:
    apache2_monitor_20000 (node=jake, call=7, rc=7, status=complete): not running
Der Webserver ist immer noch erreichbar, wie es sein sollte.
Ich setze elwood wieder online:

Code: Alles auswählen

elwood:~ $ crm_standby -U elwood -v false
elwood:~ $ crm status
============
Last updated: Mon Feb  8 10:32:33 2016
Last change: Mon Feb  8 10:32:30 2016 via crm_attribute on elwood
Stack: openais
Current DC: jake - partition with quorum
Version: 1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff
2 Nodes configured, 2 expected votes
2 Resources configured.
============

Online: [ elwood jake ]

 Service_IP     (ocf::heartbeat:IPaddr2):       Started elwood
 apache2        (ocf::heartbeat:apache):        Started jake

Failed actions:
    apache2_monitor_20000 (node=jake, call=7, rc=7, status=complete): not running
Spätestens jetzt ist der Webserver unerreichbar, weil die Service-IP elwood erhalten hat und der Apache bei jake geblieben ist. Eigentlich sollten Webserver und Service-IP immer derselbe Node erhalten. Wie ist das zu bewerkstelligen?

Code: Alles auswählen

jake:~ $ crm configure show
node elwood \
        attributes standby="false"
node jake \
        attributes standby="false"
primitive Service_IP ocf:heartbeat:IPaddr2 \
        params ip="192.168.0.150" cidr_netmask="24" \
        op monitor interval="10" timeout="20" \
        meta target-role="started"
primitive apache2 ocf:heartbeat:apache \
        params configfile="/etc/apache2/apache2.conf" \
        op monitor interval="20" timeout="30" \
        meta target-role="Started"
location cli-prefer-Service_IP Service_IP \
        rule $id="cli-prefer-rule-Service_IP" inf: #uname eq elwood
property $id="cib-bootstrap-options" \
        dc-version="1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff" \
        cluster-infrastructure="openais" \
        expected-quorum-votes="2" \
        stonith-enabled="false" \
        no-quorum-policy="ignore" \
        stonith-action="poweroff" \
        default-resource-stickiness="100"
Ich müsste jedesmal manuell migrieren, damit es wieder läuft:

Code: Alles auswählen

crm_resource -r Service_IP -M -N jake

crm status
============
Last updated: Mon Feb  8 10:42:21 2016
Last change: Mon Feb  8 10:42:17 2016 via crm_resource on elwood
Stack: openais
Current DC: jake - partition with quorum
Version: 1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff
2 Nodes configured, 2 expected votes
2 Resources configured.
============

Online: [ elwood jake ]

 Service_IP     (ocf::heartbeat:IPaddr2):       Started jake
 apache2        (ocf::heartbeat:apache):        Started jake

Failed actions:
    apache2_monitor_20000 (node=jake, call=7, rc=7, status=complete): not running

Das wäre auch wichtig, wenn /var/www auf einem SAN liegt und immer der Node den Mount und die IP erhält, der auch die Resource Apache2 hat.

Grüße
Wambui
Zuletzt geändert von Wambui am 08.02.2016 13:37:11, insgesamt 2-mal geändert.

Benutzeravatar
Wambui
Beiträge: 120
Registriert: 03.08.2014 10:06:10
Lizenz eigener Beiträge: GNU Free Documentation License

Re: Pacermaker - Resourcen verteilen sich auf die Nodes

Beitrag von Wambui » 08.02.2016 13:05:26

Beantworte ich mal selber, damit alle Neugierigen später auch etwas davon haben.

Code: Alles auswählen

crm configure
crm(live)configure# colocation coloc_apache2_ip +inf: Service_IP apache2
crm(live)configure# commit
crm(live)configure# bye

Code: Alles auswählen

elwood:~ $ crm_mon -n1  
============
Last updated: Mon Feb  8 13:00:57 2016
Last change: Mon Feb  8 12:58:41 2016 via cibadmin on elwood
Stack: openais
Current DC: jake - partition with quorum
Version: 1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff
2 Nodes configured, 2 expected votes
2 Resources configured.
============

Node elwood: online
        Service_IP      (ocf::heartbeat:IPaddr2) Started 
        apache2 (ocf::heartbeat:apache) Started 
Node jake: online

Code: Alles auswählen

crm configure
crm(live)configure# order ord_apache_ip inf: apache2 Service_IP
crm(live)configure# commit 
crm(live)configure# bye

Code: Alles auswählen

crm configure show
node elwood \
        attributes standby="false"
node jake \
        attributes standby="true"
primitive Service_IP ocf:heartbeat:IPaddr2 \
        params ip="192.168.0.150" cidr_netmask="24" \
        op monitor interval="10" timeout="20" \
        meta target-role="started"
primitive apache2 ocf:heartbeat:apache \
        params configfile="/etc/apache2/apache2.conf" \
        op monitor interval="20" timeout="30" \
        meta target-role="Started"
location cli-prefer-Service_IP Service_IP \
        rule $id="cli-prefer-rule-Service_IP" inf: #uname eq elwood
colocation coloc_apache2_ip +inf: Service_IP apache2
order ord_apache_ip inf: apache2 Service_IP
property $id="cib-bootstrap-options" \
        dc-version="1.1.7-ee0730e13d124c3d58f00016c3376a1de5323cff" \
        cluster-infrastructure="openais" \
        expected-quorum-votes="2" \
        stonith-enabled="false" \
        no-quorum-policy="ignore" \
        stonith-action="poweroff" \
        default-resource-stickiness="100"

Somit wandert die Service-IP mit der anderen Resource mit.

Antworten