Hello Thomas,

I configured the 2 machines using the steps you provided.
and tested it.. in the first step it is ok. But it give some errors while running cibadmin.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#crm_mod -1 -r
============
Last updated: Fri Jan  4 10:37:18 2008
Current DC: test1.mydomain.com (e0083465-ae84-4949-be8a-62d80ce20236)
2 Nodes configured.
0 Resources configured.
============

Node: squid-2.mydomain.com (01efc983-be1e-4ab2-9142-a5cc030cbd85): online
Node: squid-1.mydomain.com (e0083465-ae84-4949-be8a-62d80ce20236): online

Full list of resources:

#cibadmin -U -x squid.xml
#crm_mod -1 -r
============
Last updated: Fri Jan  4 10:26:19 2008
Current DC: squid-1.mydomain.com (e0083465-ae84-4949-be8a-62d80ce20236)
2 Nodes configured.
1 Resources configured.
============

Node: squid-2.mydomain.com (01efc983-be1e-4ab2-9142-a5cc030cbd85): online
Node: squid-1.mydomain.com (e0083465-ae84-4949-be8a-62d80ce20236): online

Full list of resources:

Resource Group: squid-cluster
   ip0 (heartbeat::ocf:IPaddr2):       Started squid-2.mydomain.com
squid (heartbeat::ocf:squid): Started squid-1.mydomain.com (unmanaged) FAILED

Failed actions:
   squid_monitor_0 (node=test1.mydomain.com, call=3, rc=1): Error
   squid_stop_0 (node=test1.mydomain.com, call=4, rc=1): Error

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following error is occurred during the execution of squid.xml.
i attached the squid.xml file in this.

Thanks,
Jayaprakash S









Thomas Glanzmann wrote:
Hello again,
so here is step by step guide. I just did it to stay in training. I used
Debian etch:

        On both nodes:
                /etc/init.d/heartbeat stop
                rm /var/lib/heartbeat/crm/* (Don't do this in production it
                                             wipes your configuration)

                (ha-1) [~] cat /etc/ha.d/ha.cf
                use_logd yes
                bcast eth1
                mcast eth0 239.0.0.2 694 1 0
                node ha-1 ha-2
                crm on

                Note: eth0 is the network segment both nodes are on; eth1 is a 
crosslink

                Copy the attached OCF Agent for squid on top of debian init
                script to /usr/lib/ocf/resource.d/heartbeat/squid

                I wrote that ressource agent because I could not find one for
                squid.

                chmod +x /usr/lib/ocf/resource.d/heartbeat/squid

                apt-get install squid

                Get sure squid isn't started by init:

                        update-rc.d -f squid remove (This is for Debian)
                        chkconfig squid off (That would be for SuSE / Red Hat)

                /etc/init.d/heartbeat stop

        On _one_ node load the attached XML Service Description:

                cibadmin -U -x squid.xml (Don't forget to adopt your IP address)

        Call "crm_mon -r -1" to see if squid gets started and on which node it
        gets started:

                crm_mon -r -1

        On that node call:

                /etc/init.d/squid stop

        The monitor interval is set to 60 seconds. So linux-ha should detect
        within 60 seconds that squid is gone and restart it. Linux-ha tries on
        default first the node where it ran before. If that goes wrong for
        whatever reason it tries the other node.

And now to the practice:

(ha-1) [~] crm_mon -1 -r
============
Last updated: Thu Jan  3 14:57:57 2008
Current DC: ha-2 (095256ab-361c-4b1e-9a8b-8bed74c4a7fb)
2 Nodes configured.
0 Resources configured.
============

Node: ha-2 (095256ab-361c-4b1e-9a8b-8bed74c4a7fb): online
Node: ha-1 (330da1b6-5f99-480a-b071-a144a98e1248): online

Full list of resources:

(ha-1) [~] cibadmin -U -x squid.xml
(ha-1) [~] crm_mon -1 -r
============
Last updated: Thu Jan  3 14:58:17 2008
Current DC: ha-2 (095256ab-361c-4b1e-9a8b-8bed74c4a7fb)
2 Nodes configured.
1 Resources configured.
============

Node: ha-2 (095256ab-361c-4b1e-9a8b-8bed74c4a7fb): online
Node: ha-1 (330da1b6-5f99-480a-b071-a144a98e1248): online

Full list of resources:

Resource Group: squid-cluster
    ip0 (heartbeat::ocf:IPaddr2):       Started ha-2
    squid       (heartbeat::ocf:squid): Started ha-2

Okay we loaded the config and squid is running on ha-2 so lets go to ha-2:

(ha-2) [~] date; ps axuww | grep squid
Thu Jan  3 14:58:38 CET 2008
root     13732  0.0  0.2   4628   672 ?        Ss   14:58   0:00 
/usr/sbin/squid -D -sYC
proxy    13734  0.0  1.7   6848  4572 ?        S    14:58   0:00 (squid) -D -sYC
root     13753  0.0  0.2   3688   596 pts/0    R+   14:58   0:00 grep 
--color=auto squid
(ha-2) [~] /etc/init.d/squid stop
Stopping Squid HTTP proxy: squid.
(ha-2) [~] date; ps axuww | grep squid
Thu Jan  3 14:58:48 CET 2008
root     13762  0.0  0.2   3692   600 pts/0    R+   14:58   0:00 grep 
--color=auto squid
(ha-2) [~] date; ps axuww | grep squid
Thu Jan  3 14:59:04 CET 2008
root     13767  0.0  0.2   3688   596 pts/0    R+   14:59   0:00 grep 
--color=auto squid
(ha-2) [~] date; ps axuww | grep squid
Thu Jan  3 14:59:10 CET 2008
root     13770  0.0  0.2   3688   596 pts/0    R+   14:59   0:00 grep 
--color=auto squid
(ha-2) [~] date; ps axuww | grep squid
Thu Jan  3 14:59:15 CET 2008
root     13806  0.0  0.5   4648  1396 ?        S    14:59   0:00 /bin/sh 
/usr/lib/ocf/resource.d//heartbeat/squid stop
root     13812  0.0  0.4   2536  1248 ?        S    14:59   0:00 /bin/sh 
/etc/init.d/squid stop
root     13819  0.0  0.2   3692   600 pts/0    R+   14:59   0:00 grep 
--color=auto squid
(ha-2) [~] date; ps axuww | grep squid
Thu Jan  3 14:59:19 CET 2008
root     13862  0.0  0.2   4628   664 ?        Ss   14:59   0:00 
/usr/sbin/squid -D -sYC
proxy    13865  0.6  1.7   6852  4552 ?        S    14:59   0:00 (squid) -D -sYC
root     13869  0.0  0.2   3688   600 pts/0    R+   14:59   0:00 grep 
--color=auto squid
(ha-2) [~] crm_mon -r -1

============
Last updated: Thu Jan  3 14:59:23 2008
Current DC: ha-2 (095256ab-361c-4b1e-9a8b-8bed74c4a7fb)
2 Nodes configured.
1 Resources configured.
============

Node: ha-2 (095256ab-361c-4b1e-9a8b-8bed74c4a7fb): online
Node: ha-1 (330da1b6-5f99-480a-b071-a144a98e1248): online

Full list of resources:

Resource Group: squid-cluster
    ip0 (heartbeat::ocf:IPaddr2):       Started ha-2
    squid       (heartbeat::ocf:squid): Started ha-2

Okay squid was running on ha-2, so lets stop it. Okay it is stopped. Now lets
see every few seconds if linux-ha detects that squid is down. And in fact it
does. When it does, it stops squid just to make sure that it is really
down. That is what the "/bin/sh /usr/lib/ocf/resource.d//heartbeat/squid stop"
line is about. A few seconds later squid is back up and running again.

One more thing I have to tell you:

In the squid.xml file you see two resources: One for the floating IP address
and one for squid. I put the two resources into a so called resource group. A
resource group does group one or more ressources together and gets sure that
they always run on the same host and that they are started and stopped in
order. So in our example the ip address is started before the squid and the
squid is stopped first and than the ip address. I defined two monitor
operations in squid.xml. Without these two operations linux-ha doesn't detect
if a service goes down. So you could for example call "ip addr del IP/CIDDR dev 
eth0"
and see for yourself how linux-ha configures the ip address again. So I really
do hope that this is enough to get you started. Give me feedback when you get
it running.

                Thomas
------------------------------------------------------------------------

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
<configuration>
        <resources>
                <group id="squid-cluster">
                        <primitive class="ocf" provider="heartbeat" type="IPaddr2" id="ip0">
                                <instance_attributes id="ia-ip0">
                                        <attributes>
                                                <nvpair id="ia-ip0-1" name="ip" value="172.168.1.100"/>
                                                <nvpair id="ia-ip0-2" name="cidr_netmask" value="255.255.255.0"/>
                                                <nvpair id="ia-ip0-3" name="nic" value="eth0"/>
                                        </attributes>
                                </instance_attributes>
                                <operations>
                                        <op id="ip0-monitor0" name="monitor" interval="60s" timeout="120s" start_delay="1m"/>
                                </operations>
                        </primitive>

                        <primitive class="ocf" provider="heartbeat" type="squid" id="squid">
                                <operations>
                                        <op name="monitor" interval="60s" timeout="120s" start_delay="1m" id="monitor-squid"/>
                                </operations>
                        </primitive>
                </group>
        </resources>

        <constraints/>
</configuration>

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to