cmdref.net - Command Reference

This site is command references for system engineers.

User Tools

Site Tools


Top     SiteMap

Sidebar

Top     SiteMap








Etc


Reference











.

middleware:cluster:pacemaker:index.html



Middleware

Pacemaker

Knowlege

Formation

Formation Note
Pacemaker + Corosync
Pacemaker + Heartbeat Versinon3

Component

Package Note
pacemaker Pacemaker is an Open Source, High Availability resource manager suitable for both small and large clusters.
corosync cluster.conf
pcs a full cluster lifecycle configuration shell and web based GUI.


Commands

Pacemaker (pcs)

Check

You must start pacemaker for pcs commands.

Operation Commands Note
Check Configuration pcs config
pcs property list
Check Configuration with XML pcs cluster cib
Check Status pcs status
pcs status --full
crm_mon -1
Check Note Status pcs status nodes

Operation

Operation Commands Note
stop cluster pc cluster stop --all
start cluster pc cluster start --all
stop cluster on only one node pcs cluster stop server1 --force
Forcibly stop cluster pcs cluster kill
change to standby pcs cluster standby SERVER1 Cluster SERVER1 to SERVER2
change to unstandby pcs cluster unstandby SERVER1

Configuration

Operation Commands Note
Sync corosync.conf pcs cluster sync
Delete Configuration pcs cluster destroy Deleted /etc/cluster/cluster.conf, too.
Output Configuration pcs cluster cib output.cib
Change Configuration pcs -f output.cib COMMAND
Input Configuration pcs cluster cib-push output.cib
RESOURCE GROUPS
Commands Operation
pcs resource group list The following command lists all currently configured resource groups
pcs resource group add group_name resource_id You create a resource group with the following command
If the group does not exist, this command creates the group. If the group exists, this command adds additional resources to the group.
pcs resource group remove group_name resource_id… You remove a resource from a group with the following command.
If there are no resources in the group, this command removes the group itself.
pcs resource show
pcs resource group list
pcs resource show RESCOURCE
pcs cluster corosync check node and totem
pcs stonith show RESOURCE
pcs constraint list check the resource order

Ref.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/High_Availability_Add-On_Reference/s1-resourcegroups-HAAR.html




How to create Pacemaker.

Installing

# yum install pcs fence-agents-all
# systemctl enable pcsd
# systemctl start pcsd


Configuration of Cluster

# echo redhat |passwd --stdin hacluster
# pcs cluster auth -u hacluster -p redhat  server1 server2
# pcs cluster setup --start --name test-cluster --wait_for_all=0 server1 server2

--wait_for_all=0 : If it is 1node, start cluster.
# pcs status


Configuring Fencing (STONITH)

#pcs stonith list
#pcs stonith describe XXXXX
##                  unique name    fence agent   target node              device addr              options
# pcs stonith create fence_server1  fence_ilo4    pcmk_host_list="server2-ilo" ipaddr="xx.xx.xx.xx" action="reboot" login="admin" passwd="secret" delay=15 op monitor interval=60s
# pcs stonith create fence_server2  fence_ilo4    pcmk_host_list="server2-ilo" ipaddr="xx.xx.xx.xx" action="reboot" login="admin" passwd="secret" op monitor interval=60s

If you dont't use Fence, You can do action="off".
# pcs stonith show
 stonith-ilo4-server1    (stonith:fence_ilo4):    Started 
 stonith-ilo4-server2    (stonith:fence_ilo4):    Started 
Check stonith
#pcs property --all |grep -E "stonith-enabled|stonith-action"
 stonith-action: reboot
 stonith-enabled: true
Test fencing
# pcs stonith fence server2

-> server2 is rebooted.
Disable/Enable STONITH
# pcs resource disable RESOURCE_STONITH
# pcs resource enable RESOURCE_STONITH


Setting Resources

Failover

disable auto failover
It is failovered with manual operation or node down.
'migration-threshold' is retry number of resource restart.

pcs resource defaults resource-stickiness="INFINITY" migration-threshold="0"

VIP

set virtual IP address

pcs resource create ipfront ocf:heartbeat:IPaddr2 ip=192.168.40.xx cidr_netmask=24 nic="eth0" op monitor interval=10s
pcs resource create ipmaintenance ocf:heartbeat:IPaddr2 ip=192.168.50.xx cidr_netmask=24 nic="eth1" op monitor interval=10s

Process

/etc/init.d/mysqld

pcs resource create mysql lsb:mysqld op monitor interval=60s
pcs resource update mysql op start interval=30s timeout=15 on-fail=ignore
pcs resource update mysql op stop interval=0s timeout=15 on-fail=ignore

Order of Resource

pcs constraint order frontip then maintenanceip
pcs constraint order maintenanceip then mysql

RESOURCE GROUPS

pcs resource group add mysqlgroup frontip maintenanceip mysql

Resource cleanup

# pcs resource cleanup res_stonith_ipmilan01


Note

Backup/Restore

# pcs config backup /tmp/`date +%Y%m%d`_`uname -n`_pcs_config_backup
# pcs config restore /tmp/`date +%Y%m%d`_`uname -n`_pcs_config_backup.tar.bz2

CORROSYNC : corosync.conf

/etc/corosync/corosync.conf
/etc/corosync/corosync.conf.example

In AWS EC2, You must use UDP Unicast insted of UDP Multicast in corosync.
Sample Configuration : /etc/corosync/corosync.conf.example.udpu


Reference




middleware/cluster/pacemaker/index.html.txt · Last modified: 2017/09/25 by admin