this is obsolete doc -- see http://doc.nethence.com/ instead
Setting up HA services with redhat/centos Cluster Suite (RHCS)
on CentOS 6.7
http://pbraun.nethence.com/unix/sysutils_linux/redhat-rhcs.html
http://pbraun.nethence.com/unix/sysutils_linux/redhat-rhcs-services.html
http://pbraun.nethence.com/unix/mail/davmail.html
http://pbraun.nethence.com/unix/sysutils_linux/systemd.html
Setting up failover domains
For an unrestricted failover domain, on e.g. cnode1,
ccs -h localhost --addfailoverdomain allnodes
ccs -h localhost --addfailoverdomainnode allnodes cnode1
ccs -h localhost --addfailoverdomainnode allnodes cnode2
ccs -h localhost --addfailoverdomainnode allnodes cnode3
check,
ccs -h localhost --lsfailoverdomain
populate the changes,
cman_tool version -r
Setting up services
Define the resources you need for a service. For my davmail service, I need:
- the binary and configuration files located in /usr/local/davmail/ (copied on all nodes), which is a symlink to ./davmail-version/
cd /usr/local/
scp -r davmail-linux-x86_64-4.7.1-2416 cnode2:/usr/local/
scp -r davmail-linux-x86_64-4.7.1-2416 cnode3:/usr/local/
cd /etc/init.d/
scp davmail cnode2:/etc/init.d/
scp davmail cnode3:/etc/init.d/
also make sure openjdk is installed
also make sure postfix is disabled on port 25
see [how to setup davmail](http://pbraun.nethence.com/unix/mail/davmail.html)
on cnode2 and cnode3 also,
cd /usr/local/
ln -s davmail-linux-x86_64-4.7.1-2416 davmail
cd ~/
ls -l /etc/init.d/davmail # already executable by scp
chkconfig --add davmail
chkconfig davmail off
- an LSB compilant [init script](http://pbraun.nethence.com/unix/sysutils_linux/systemd.html) to use the RHCS <script> statement.
- a floating IP --> this will be a RHCS resource
Disable the service at local system startup in case it is enabled,
chkconfig --list | grep davmail
chkconfig davmail off
See available resource types,
ccs -h localhost --lsresourceopts
ccs -h localhost --lsresourceopts ip
ccs -h localhost --lsresourceopts script
See available service options,
ccs -h localhost --lsserviceopts
Add this into the <rm> statement,
vi /etc/cluster/cluster.conf
<resources>
<ip address="10.0.0.X" monitor_link="yes" sleeptime="5"/>
<script file="/etc/init.d/davmail" name="davmail_service"/>
</resources>
<service autostart="0" domain="allnodes" name="davmail" recovery="relocate">
<ip ref="10.0.0.X"/>
<script ref="davmail_service"/>
</service>
increment the configuration version,
<cluster config_version="34" name="centosha">
check and populate the changes,
ccs_config_validate
cman_tool version -r
Theorically you should also be able to setup this as follows (but we did it by hand),
ccs -h localhost --addresource ip address=10.0.0.X minitor_links=yes sleeptime=5
ccs -h localhost --addservice davmail domain=allnodes recovery=relocate autostart=0
ccs -h localhost --addsubservice davmail ip ref=10.0.0.X
check,
cat /etc/cluster/cluster.conf
Ready to go
Check the the cluster is up and running,
cman_tool nodes
clustat
Enable the service,
clusvcadm -e davmail
#clusvcadm -e davmail -m cnode1
Check that the ip address is owned by the node on which the service has started,
ip addr
Refs.
Why is the virtual IP address, managed by RHCS, not listed when using ifconfig?: https://access.redhat.com/solutions/127223
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Cluster_Administration/s1-add-service-conga-CA.html
Eventually check that the service is running using the local system, e.g.,
service davmail status
also test the service while you watch the logs,
cd /usr/local/davmail/
tail -f davmaill.log
Once everything is fine enable autostart,
vi /etc/cluster/cluster.conf
<cluster config_version="35" name="centosha">
<service autostart="1" domain="allnodes" name="davmail" recovery="relocate">
check and populate the changes,
ccs_config_validate
cman_tool version -r
#ccs -h localhost --sync --activate
More commands
Disable a service,
clusvcadm -d davmail
Other services
Share a common NFS mount point on all the nodes e.g.,
cat >> /etc/fstab <<EOF
nfs_server:/export/rhcs /mnt/ict-rhcs nfs4 _netdev,rw 0 0
EOF
mkdir -p /mnt/rhcs/
mount /mnt/rhcs/