
# Cluster CMAN CentOS 6

# Install cluster support
yum install pacemaker cman pcs ccs resource-agents crmsh

# make sure all nodes are listed on /etc/hosts on all nodes

# Generate corosync key
corosync-keygen
# move corosync key to cluster configuration directory
mv /etc/corosync/authkey /etc/cluster/corosync.key

# move the example cluster.conf to the cluster configuration directory
mv /usr/local/opmon/utils/cluster/cluster.conf /etc/cluster/.
# edit cluster.conf, set the cluster nodes

# copy /etc/cluster/corosync.key and /etc/cluster/cluster.conf to all nodes

# edit /etc/sysconfig/cman and set CMAN_QUORUM_TIMEOUT=0 on all nodes

# start services
service cman start
service pacemaker start

# add to boot
chkconfig --level 35 cman on
chkconfig --level 35 pacemaker on


# Set default initial configuration
crm configure property start-failure-is-fatal=false
crm configure property stonith-enabled=false
crm configure property no-quorum-policy=ignore
crm configure rsc_defaults rsc_defaults-options: migration-threshold=0 failure-timeout=2s  resource-stickiness=50

Inside crm configure

# configuring virtual IPs and in which node they will be
primitive ClusterIP1 ocf:heartbeat:IPaddr2 \
        params ip=192.168.10.213 cidr_netmask=32 \
        op monitor interval=30s
primitive ClusterIP2 ocf:heartbeat:IPaddr2 \
        params ip=192.168.10.214 cidr_netmask=32 \
        op monitor interval=30s
primitive ClusterIP13 ocf:heartbeat:IPaddr2 \
        params ip=192.168.10.214 cidr_netmask=32 \
        op monitor interval=30s

location loc_clusterIP1 ClusterIP1 100: opdev1
location loc_clusterIP2 ClusterIP2 100: opdev2
location loc_clusterIP3 ClusterIP3 100: opdev3

primitive gearmand lsb:gearmand op monitor interval="10" timeout="30" op start interval="0" timeout="120" op stop interval="0" timeout="120"
primitive OpMon lsb:opmon op monitor interval="10" timeout="30" op start interval="0" timeout="120" op stop interval="0" timeout="120"
primitive syncfiles lsb:syncfiles op monitor interval="10" timeout="30" op start interval="0" timeout="120" op stop interval="0" timeout="120"
group OpMon_Group gearmand syncfiles OpMon
location loc_OpMon_Group OpMon_Group inf: opdev1

# Move resources in the cluster
crm resource move gearmand opdev2

# Stop start resources
crm resource stop ClusterIP1
crm resource start ClusterIP1

# deleting resource
crm configure delete clusterIP2

# Remove stickness
crm resource meta ClusterIP1 resource-stickiness=0

# Info
crm_mon -1rtf 
