Heartbeat: Difference between revisions

From VVCWiki
Jump to navigationJump to search
No edit summary
 
(No difference)

Latest revision as of 21:20, 5 December 2009

Configuration files

  • /etc/hosts
127.0.0.1		localhost
10.10.10.20		c20.chepkov.lan c20
10.10.10.21		c21.chepkov.lan c21
  • /etc/ha.d/ha.cf
crm yes
use_logd on
udpport 694
bcast eth0
keepalive 1
warntime 5
deadtime 15
initdead 60
node c20.chepkov.lan
node c21.chepkov.lan
# Ping default host
ping 10.10.10.250
respawn root /usr/lib64/heartbeat/pingd -m 200 -d 5
deadping 10
  • /etc/ha.d/authkeys
auth 1
1 sha1 3c2749538df51665ad8dfab76a6d90f7
chmod 0600 /etc/ha.d/authkeys
  • /var/lib/heartbeat/crm/cib.xml
<cib admin_epoch="0" num_updates="1" epoch="1" >
  <configuration>
    <crm_config/>
    <nodes/>
    <resources/>
    <constraints/>
  </configuration>
</cib>
  • /etc/logd.conf
logfacility	local2
  • /etc/syslog.conf
local2.*						/var/log/heartbeat.log
touch /var/log/heartbeat.log

Initial configuration

  • crm_config
crm_attribute --attr-name symmetric-cluster --attr-value true
crm_attribute --attr-name default-resource-stickiness --attr-value 1000
crm_attribute --attr-name stonith-enabled --attr-value false
  • constraints

<constraints>

  <rsc_location id="location_rg0" rsc="rg0">
    <rule id="prefered_location_rg0" score="100">
      <expression attribute="#uname" operation="eq" value="c20.chepkov.lan"/>
    </rule>
  </rsc_location>
  <rsc_location id="location_rg1" rsc="rg1">
    <rule id="prefered_location_rg1" score="100">
      <expression attribute="#uname" operation="eq" value="c21.chepkov.lan"/>
    </rule>
  </rsc_location>
  <rsc_location id="rg0-needs-ping" rsc="rg0">
    <rule score="-INFINITY" boolean_op="or">
      <expression attribute="pingd" operation="not_defined"/>
      <expression attribute="pingd" operation="lte" value="0"/>
    </rule>
  </rsc_location>
  <rsc_location id="rg1-needs-ping" rsc="rg1">
    <rule score="-INFINITY" boolean_op="or">
      <expression attribute="pingd" operation="not_defined"/>
      <expression attribute="pingd" operation="lte" value="0"/>
    </rule>
  </rsc_location>
</constraints>

</source>

cibadmin -R -o constraints -x constraints.xml
  • resources
 <resources>
   <group id="rg0">
     <primitive id="ip_rg0" class="ocf" type="IPaddr2" provider="heartbeat">
       <instance_attributes>
         <attributes>
           <nvpair name="ip" value="10.10.10.22"/>
           <nvpair name="nic" value="eth0"/>
           <nvpair name="cidr_netmask" value="255.255.255.255"/>
         </attributes>
       </instance_attributes>
     </primitive>
     <primitive id="drbd_u00" class="heartbeat" type="drbddisk" provider="heartbeat">
       <instance_attributes>
         <attributes>
           <nvpair name="1" value="u00"/>
         </attributes>
       </instance_attributes>
     </primitive>
     <primitive id="fs_u00" class="ocf" type="Filesystem" provider="heartbeat">
       <instance_attributes>
         <attributes>
           <nvpair name="device" value="/dev/drbd0"/>
           <nvpair name="directory" value="/u00"/>
           <nvpair name="fstype" value="ext3"/>
           <nvpair name="options" value="noatime"/>
         </attributes>
       </instance_attributes>
     </primitive>
   </group>
</resources>
cibadmin -R -o resources -x resources.xml

Heartbeat Cluster operations

  • check cluster status
crm_mon -1 -r
  • Migrate Resource group to specific node without creating constraint
crm_resource -M -f -Q -r rg0 -H c20.chepkov.lan

Wait until resource will be migrated, then

crm_resource -U -r rg0
  • Mark resource unmanageable by cluster
crm_resource -p is_managed -r apache_svn -t primitive -v off
  • Stop resource
crm_resource --meta -r rg0 -p target_role -v stopped
  • Remove stopped role
crm_resource --meta -r rg0 -d target_role