SETUP
ฝัง
- เผยแพร่เมื่อ 19 ก.ย. 2024
- High Availability cluster, also known as failover cluster or #active-passive cluster, is one of the most widely used cluster types in a production environment to have continuous availability of services even one of the cluster nodes fails.
In technical, if the server running application has failed for some reason (ex: hardware failure), cluster software #pacemaker will restart the application on the working node.
Failover is not just restarting an application; it is a series of operations associated with it, like mounting filesystems, configuring #networks, and starting dependent applications.
Discover Shared Storage :
iscsiadm --mode discovery --type sendtargets --portal 192.168.132.160 --discover
iscsiadm --mode node --targetname iqn.2021-01.localha.dbiscsi:servers --login
/etc/my.cnf :
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/lib/mysql/log/mariadb.log
pid-file=/var/lib/mysql/run/mariadb.pid
!includedir /etc/my.cnf.d
Cluster Resources :
pcs resource create mariadb_lvm ocf:heartbeat:LVM-activate vgname=cldb_vg activation_mode=exclusive vg_access_mode=system_id --group mariadb
pcs resource create mariadb_fs ocf:heartbeat:Filesystem device=/dev/cldb_vg/dblv1 directory=/var/lib/mysql fstype=xfs --group mariadb
pcs resource create MARIADB-VIP ocf:heartbeat:IPaddr2 ip=192.168.132.168 cidr_netmask=24 op monitor interval=30s --group mariadb
pcs resource create mariadb-server ocf:heartbeat:mysql binary="/usr/bin/mysqld_safe" config="/etc/my.cnf" datadir="/var/lib/mysql" pid="/var/lib/mysql/run/mariadb.pid" socket="/var/lib/mysql/mysql.sock" additional_parameters="--bind-address=0.0.0.0" op start timeout=60s op stop timeout=60s op monitor interval=20s timeout=30s --group mariadb
Allow remote access to the database :
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
Very usefull video. It works but after 2 or 3 hours first resource cant start error is mariadb-lvm-res_start_0 on node02 'unknown error' (1): call=28, status=complete, exitreason='Volume group [clustervg] does not exist or contains error! /dev/sdb: Checksum error at offset 68608',