[Linux-HA] grouping resources and other trivial questions

Andreas Kurz andreas.kurz at gmail.com
Mon Jan 15 09:46:50 MST 2007


On 1/15/07, Lawrence Yann <Yann.Lawrence at aah.co.uk> wrote:
> Hello all,
>
> I'm currently configuring a two node HA cluster. It will be managing a
> tomcat thingy and an in house xinetd type service. I've managed to get
> one service on one machine and the other service on the second machine,
> an active/active configuration of sorts.
>
> Picking up HA-linux from scratch to get where I am today has proved both
> interesting (exciting at times!) and at times (very) frustrating.
>
> I have just a couple of questions:
>
> 1) I have grouped the resources for each service as follows:
> TomCat_group:
>   TC_IP_address_resource
>   TC_LVM_Resource
>   TC_FileSystem_resource
>   TC_Tomcat_resource
>
> Xinetd_group:
>   X_IP_address_resource
>   X_LVM_resource
>   X_Filesystem_resource
>   X_Service_resource
>
> Constrains are:
> TC_Tomcat_IP before TC_LVM
> TC_LVM before TC_Filesystem
> TC_Filesystem before TC_Tomcat
>
> Similar thing for the Xinetd_group. I assumed that the ordering
> constraints would take care of the order in which the actual group
> components would start, in actual fact, it seems that it is the order
> that they appear in the cib.xml file is the more significant. Troubles
> bringing up the Tomcat resource were solved by moving the TC_Tomcat
> resource from the top of the group to the bottom. Are constrains only
> useful for whole groups of resources not in a group (i.e. Tomcat_group
> before Xinetd_group)? If so, need I bother with the constraints is have
> defined? Is there a better way to group resources or is this a good way
> of doing it?

The advantage of using groups is the implicit creation of co-location
and linear ordering constraints (which can also be disabled). So just
configure the primitives in the order they should start and you dont't
need to create extra costraints for ordering/colocation.

There is a nice example at
http://www.linux-ha.org/_cache/GuiGuide__cib.xml. This is a mixed
example that shows the flexibility of constraints.

>
> 2) Despite putting in location preferences, it seems that if I manually
> migrate a resource from one node to the other, the resource on the other
> node will migrate over to the server from which I had just migrated...
> is this expected. I realise that a location constraint is only a
> suggestion to  the cluster, but I did not expect it to balance services
> in this way. Is the only way to move a service away from a specific
> server to put that server into standby?
> e.g.
> server1 has Tomcat running
> server2 has xinetd_service running
> crm_resource -M -r xinetd_service -H server1 causes xinetd to migrate to
> server1 but also tomcat to migrate to server2

Without specifying location constraints with specific scores,
heartbeat trys to balance the resources ... in your case: one group
per node. When you migrate a group away heartbeat decides to balance
the resources again.

Try setting location constraints for each group and define a positive
resource_stickiness to have complete controll over resource placement.

Regards,
Andreas

>
> 3) It becomes necessary in the lifetime of a tomcat server to deploy
> updated web service code. How is this best done. Stopping the tomcat
> server manually sees the cluster helpfully restarting it. My thoughts
> were to deploy the new tomcat files whilst the server was up and then
> manually stop it. When the cluster restarts it, Tomcat will pick up the
> new files. Is there a way of stopping a service without removing it from
> the cib (e.g. cibadmin -D -X '< group id="AAH_group">')?

Disable resource management and heartbeat stops monitoring its
services ...  crm_attribute -t crm_config -n is_managed_default -v
false
... do your maintenance and reenable monitoring
crm_attribute -t crm_config -n is_managed_default -v true

>
>
> I am sure that these seem like trivial questions, but they are puzzling
> to someone who three weeks ago, thought it might be a good idea to give
> this linux-HA stuff a go.
>
> By the way, I'm now able to migrate the Tomcat resource between machines
> within 10 seconds. The cluster doesn't drop a 'ping'. All very
> impressive. All that remains is to sort out logging...
>
> Kind regards,
>
>
> Yann
>
>
> --------------------------
>
> cibadmin -Ql
>  <cib generated="true" admin_epoch="0" have_quorum="true"
> ccm_transition="2" num_peers="2" cib_feature_revision="1.3"
> dc_uuid="1dbeef7c-e0bf-4890-9588-9e9248404ff4" epoch="2"
> num_updates="235">
>    <configuration>
>      <crm_config>
>        <cluster_property_set id="cib-bootstrap-options">
>          <attributes>
>            <nvpair id="cib-bootstrap-options-no_quorum_policy"
> name="no_quorum_policy" value="ignore"/>
>            <nvpair id="cib-bootstrap-options-last-lrm-refresh"
> name="last-lrm-refresh" value="1168858391"/>
>          </attributes>
>        </cluster_property_set>
>      </crm_config>
>      <nodes>
>        <node uname="gbw607su1053" type="normal"
> id="d3c109d4-0eaa-430f-ab28-0021e06898d9">
>          <instance_attributes
> id="nodes-d3c109d4-0eaa-430f-ab28-0021e06898d9">
>            <attributes>
>              <nvpair name="standby"
> id="standby-d3c109d4-0eaa-430f-ab28-0021e06898d9" value="off"/>
>            </attributes>
>          </instance_attributes>
>        </node>
>        <node uname="gbw607su1052" type="normal"
> id="1dbeef7c-e0bf-4890-9588-9e9248404ff4">
>          <instance_attributes
> id="nodes-1dbeef7c-e0bf-4890-9588-9e9248404ff4">
>            <attributes>
>              <nvpair name="standby"
> id="standby-1dbeef7c-e0bf-4890-9588-9e9248404ff4" value="off"/>
>            </attributes>
>          </instance_attributes>
>        </node>
>      </nodes>
>      <resources>
>        <group id="AAH_group">
>          <primitive class="ocf" id="AAH_IPaddr_10_221_3_43"
> provider="heartbeat" type="IPaddr">
>            <operations>
>              <op id="AAH_IPaddr_monitor" interval="5s" name="monitor"
> timeout="5s"/>
>            </operations>
>            <instance_attributes id="AAH_ipaddr_10_221_3_43_attributes">
>              <attributes>
>                <nvpair id="AAH_IPaddr_attributes" name="ip"
> value="10.221.3.43"/>
>              </attributes>
>            </instance_attributes>
>          </primitive>
>          <primitive class="ocf" id="LVM_aahvg" provider="heartbeat"
> type="LVM">
>            <operations>
>              <op id="LVM_aahvg_monitor" interval="60s" name="monitor"
> timeout="5s"/>
>            </operations>
>            <instance_attributes id="LVM_aahvg-attributes">
>              <attributes>
>                <nvpair id="LVM_aahvg" name="volgrpname" value="aahvg"/>
>              </attributes>
>            </instance_attributes>
>          </primitive>
>          <primitive class="ocf" id="FS_aah" provider="heartbeat"
> type="Filesystem">
>            <operations>
>              <op id="FS_aah-monitor" interval="60s" name="monitor"
> timeout="15s"/>
>            </operations>
>            <instance_attributes id="FS_aah-attibutes">
>              <attributes>
>                <nvpair id="FS_aah_device" name="device"
> value="/dev/mapper/aahvg-aah"/>
>                <nvpair id="FS_aah_directory" name="directory"
> value="/aah"/>
>                <nvpair id="FS_aah_fstype" name="fstype" value="ext3"/>
>              </attributes>
>            </instance_attributes>
>          </primitive>
>          <primitive class="ocf" id="AAH_TomCat" provider="heartbeat"
> type="tomcat2">
>            <operations>
>              <op id="AAH_tomcat_monitor" interval="60s" name="monitor"
> timeout="15s"/>
>            </operations>
>            <instance_attributes id="AAH_tomcat_attributes">
>              <attributes>
>                <nvpair id="AAH_tomcat_attributes" name="user"
> value="tc_testy"/>
>                <nvpair id="AAH_TomCat_target_role" name="target_role"
> value="started"/>
>              </attributes>
>            </instance_attributes>
>          </primitive>
>        </group>
>        <group id="THREEPO_group">
>          <primitive class="ocf" id="THREEPO_IPaddr_10_221_3_44"
> provider="heartbeat" type="IPaddr">
>            <operations>
>              <op id="THREEPO_IPaddr_monitor" interval="5s"
> name="monitor" timeout="5s"/>
>            </operations>
>            <instance_attributes
> id="THREEPO_ipaddr_10_221_3_44_attributes">
>              <attributes>
>                <nvpair id="THREEPO_IPaddr_attributes" name="ip"
> value="10.221.3.44"/>
>              </attributes>
>            </instance_attributes>
>          </primitive>
>          <primitive class="ocf" id="LVM_threepovg" provider="heartbeat"
> type="LVM">
>            <operations>
>              <op id="LVM_threepovg_monitor" interval="60s"
> name="monitor" timeout="5s"/>
>            </operations>
>            <instance_attributes id="LVM_threepo-attributes">
>              <attributes>
>                <nvpair id="LVM_threepovg-attributes" name="volgrpname"
> value="threepovg"/>
>              </attributes>
>            </instance_attributes>
>          </primitive>
>          <primitive class="ocf" id="FS_threepo" provider="heartbeat"
> type="Filesystem">
>            <operations>
>              <op id="FS_threepo-monitor" interval="60s" name="monitor"
> timeout="15s"/>
>            </operations>
>            <instance_attributes id="FS_threepo-attibutes">
>              <attributes>
>                <nvpair id="FS_threepo_device" name="device"
> value="/dev/mapper/threepovg-threepo"/>
>                <nvpair id="FS_threepo_directory" name="directory"
> value="/home/threepo"/>
>                <nvpair id="FS_threepo_fstype" name="fstype"
> value="ext3"/>
>              </attributes>
>            </instance_attributes>
>          </primitive>
>        </group>
>      </resources>
>      <constraints>
>        <rsc_order id="AAH_IP_group-ordering"
> from="AAH_IPaddr_10_221_3_43" action="start" type="before"
> to="LVM_aahvg"/>
>        <rsc_order id="AAH_group_ordering" from="LVM_aahvg"
> action="start" type="before" to="FS_aah"/>
>        <rsc_order id="AAH_TomCat_group_ordering" from="AAH_TomCat"
> action="start" type="after" to="FS_aah"/>
>        <rsc_order id="THREEPO_IP_group-ordering"
> from="THREEPO_IPaddr_10_221_3_44" action="start" type="before"
> to="LVM_threepovg"/>
>        <rsc_order id="THREEPO_group_ordering" from="LVM_threepovg"
> action="start" type="before" to="FS_threepo"/>
>        <rsc_location rsc="AAH_group" id="cli-prefer-AAH_group">
>          <rule score="INFINITY" id="cli-prefer-rule-AAH_group">
>            <expression attribute="#uname" operation="eq" type="string"
> id="cli-prefer-expr-AAH_group" value="gbw607su1052"/>
>          </rule>
>        </rsc_location>
>        <rsc_location id="cli-prefer-THREEPO_group" rsc="THREEPO_group">
>          <rule id="prefered_cli-prefer-THREEPO_group" score="INFINITY">
>            <expression attribute="#uname"
> id="cli-prefer-expr-THREEPO_group" operation="eq" value="gbw607su1053"/>
>          </rule>
>        </rsc_location>
>      </constraints>
>    </configuration>
> **STATUS stuff ommited for clarity**
>  </cib>
>
>
>
>
> ************************************************************************
> DISCLAIMER
> The information contained in this e-mail is confidential and is intended
> for the recipient only.
> If you have received it in error, please notify us immediately by reply
> e-mail and then delete it from your system. Please do not copy it or
> use it for any other purposes, or disclose the content of the e-mail
> to any other person or store or copy the information in any medium.
> The views contained in this e-mail are those of the author and not
> necessarily those of Admenta UK Group.
>
> Admenta UK plc is a company incorporated in England and Wales
> under company number 3011757 and whose registered office
> is at Sapphire Court, Walsgrave Triangle, Coventry CV2 2TX
> ************************************************************************
>
> _______________________________________________
> Linux-HA mailing list
> Linux-HA at lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>


More information about the Linux-HA mailing list