Hero Image

Maxscale and pacemaker on Almalinux 8

Install packages on both nodes

sudo dnf --enablerepo=ha -y install pacemaker pcs corosync
sudo dnf -y install https://downloads.mariadb.com/MaxScale/latest/centos/8/x86_64/maxscale-22.08.3-1.rhel.8.x86_64.rpm

Note about maxscale rpm package. If you get 404 then there is most likely new version. Look it up from URL: https://downloads.mariadb.com/MaxScale/latest/centos/8/x86_64/

Set the password for the hacluster user [both nodes]

sudo passwd hacluster

Start the pcs daemon service [both nodes]

sudo systemctl start pcsd

Authenticate the cluster

sudo pcs cluster auth node01.domain.local node02.domain.local

Create cluster

sudo pcs cluster setup --name clustername node01.domain.local node02.domain.local
  • Example output

    Shutting down pacemaker/corosync services...
    Redirecting to /bin/systemctl stop  pacemaker.service
    Redirecting to /bin/systemctl stop  corosync.service
    Killing any remaining services...
    Removing all cluster configuration files...
    node01.domain.local: Succeeded
    node02.domain.local: Succeeded
  • Check the changes in: nano /etc/corosync/corosync.conf

Start the cluster

sudo pcs cluster start --all

Check the cluster status

sudo pcs status cluster
sudo pcs status nodes
sudo corosync-cmapctl | grep members
sudo pcs status corosync
sudo crm_verify -L -V

Set quorum settings

sudo pcs property set stonith-enabled=false
sudo pcs property set no-quorum-policy=ignore

Verify the properties with: sudo pcs property

Create a virtual IP resource called virtual_ip

sudo pcs resource create virtual_ip ocf:heartbeat:IPaddr2 \
 ip=10.10.10.123 cidr_netmask=24 \
 op monitor interval=30s

Check the resource status

sudo pcs status resources

Prevent Resources from Moving after Recovery

sudo pcs resource defaults resource-stickiness=100

Confirm the resource defaults with sudo pcs resource defaults

Create maxscale service resource called maxscale_service

Note: for maxscale 1.1.1 and older change systemd to lsb in the command below as the startup scripts are invoked via systemd in version 1.2 and newer.

sudo pcs resource create maxscale_service systemd:maxscale \
op monitor interval="10s" timeout="15s" \
op start interval="0" timeout="15s" \
op stop interval="0" timeout="30s"

Let the cluster control maxscale on both nodes

sudo systemctl stop maxscale

According to maxscale guide disable maxscale from starting automatically on both nodes

  sudo systemctl disable maxscale

Create constraints so that the VIP and maxscale stay together

sudo pcs constraint colocation add maxscale_service virtual_ip INFINITY

View constraints with sudo pcs constraint list If desired, to keep the maxscale from starting before the VIP is started on the server add an ordering constraint

  sudo pcs constraint order virtual_ip then maxscale_service

Restart the cluster

sudo pcs cluster stop --all && sudo pcs cluster start --all

Check the status

sudo pcs status

Enable cluster services on both nodes

sudo systemctl enable pcsd
sudo systemctl enable corosync
sudo systemctl enable pacemaker

Troubleshooting / Status

  • Check cluster status with sudo pcs status
  • Stop a node (force a failover) with sudo pcs cluster stop node.domain.local
  • Start a node with sudo pcs cluster start node.domain.local

Sources:

Other Related Posts:

Maxscale and pacemaker on centos 7

Install packages on both nodes

sudo yum install corosync pcs pacemaker maxscale

Set the password for the hacluster user [both nodes]

sudo passwd hacluster

Start the pcs daemon service [both nodes]

sudo systemctl start pcsd

Authenticate the cluster

sudo pcs cluster auth node01.domain....

Read more

13th Dec 2022

Kerberos setup on Almalinux 8

Installing Kerberos on Almalinux 8

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • K...

Read more

29th Dec 2022