1

I'm trying to configure a two node pacemaker cluster, such that services in 2 resource groups, should only be assigned on the same host if either of the nodes is down. Can this be achieved with a 2 node cluster, or should in this case be active/active?

csomort
  • 11
  • 1
  • It would help if you could show us your existing pacemaker configuration so we can see how you've tried to implement this. – larsks Aug 14 '22 at 20:25

1 Answers1

0

Something like this might do the job. In this case I have 2 resources - SystemD service httpd and floating IP 192.168.0.10 and I only want floating IP to be on the same host where httpd is running:

## Install pacemaker...
# ...

## Start and enable pcsd service
# systemctl enable --now pcsd.service

## Authenticate to all nodes (user hacluster will be created automatically after installing pacemaker)
# pcs host auth 192.168.0.5 192.168.0.6 -u hacluster -p <password>

## Setup cluster, enable and start it
# pcs cluster setup --enable --start mycluster 192.168.0.5 192.168.0.6

## Disable stonith feature
# pcs property set stonith-enabled=false

## Ignore quorum policy
# pcs property set no-quorum-policy=ignore

## Setup virtual IP
# pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=192.168.0.10

## Setup httpd resource, using SystemD. By default it runs on one instance at a time, so clone it (and cloned one defaults to run on all nodes at the same time)
## https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/configuring_the_red_hat_high_availability_add-on_with_pacemaker/ch-advancedresource-haar
# pcs resource create httpd systemd:httpd clone

## Enable constraint, so both VirtualIP assigned and application running _on the same_ node.
# pcs constraint colocation add ClusterIP with httpd-clone INFINITY

But I haven't found a way to tell pacemaker to keep restarting httpd resource if it fails/crashes and no longer starts. It just becomes stopped and even if working instance is down - whole cluster goes down

Erikas
  • 113
  • 3