MariaDB Zero-Downtime Upgrade with MaxScale

๐Ÿ’ก MariaDB Zero-Downtime Upgrade with MaxScale โ€” Executive Summary

Technical architectural analysis, practical configuration manifests, and deployment instructions for MariaDB Zero-Downtime Upgrade with MaxScale.

Info
References and Guidelines (NOTE)

version info: 10.4.24(tarball) โ†’ 10.4.30(tarball)
maxscale info: 2.2.21
OS info: rhel 8

Stop Maxscale
bash
# ์‹คํ–‰๋ช…๋ น ๋ฏธ๋ฆฌ ํ™•์ธ
ps -aux | grep maxscale #/usrl/local/maxscale/bin/maxscale --user=maxscale -d
# pid ํ™•์ธ
pidof maxscale
# ์ค‘์ง€
sudo kill $(pidof maxscale)
Backup and Shutdown Mariadb (2 Servers)
bash
# ๋ฐฑ์—… ์ „ replication ๊ณ„์ •, maxscale ๊ณ„์ • ํ™•์ธ
mysql -uroot -pCloud000@
	show slave status\G; #Master_User
	#replication๊ณ„์ • password test
## maxscale node ํ™•์ธ
sudo vi /etc/maxscale.cnf #user, passwd ํ™•์ธ

# Data ๋ฐฑ์—… (master์—์„œ ๋ฐฑ์—… ํ›„ slave์— ๋ณต์ œ)
mysqldump -uroot -pCloud000@ --all-databases --single-transaction > 2024-upgrade-backup.sql

# my.cnf ๋ฐฑ์—…
sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.copied

# mysql ์ข…๋ฃŒ
## ์‹คํ–‰๋ช…๋ น ๋ฏธ๋ฆฌ ํ™•์ธ
ps -aux | grep mysql #sudo /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data
## pid ํ™•์ธ
pidof mysqld
## ์ค‘์ง€
sudo kill $(pidof mysqld)
Change binary version and run (2 Servers)
bash
# 10.4.24 ์ œ๊ฑฐ
cd /usr/local
sudo rm -rf mysql

# 10.4.30 ์„ค์น˜
cd ~
tar xvzf mariadb-10.4.30-linux-systemd-x86_64.tar.gz
sudo mv mariadb-10.4.30-linux-systemd-x86_64 /usr/local

cd /usr/local
sudo ln -s /usr/local/mariadb-10.4.30-linux-systemd-x86_64/ mysql
cd mysql

sudo chown -R root:root .
sudo mkdir data
sudo chown -R mysql:mysql data

sudo ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --auth-root-authentication-method=normal  --defaults-file=/etc/mysql/my.cnf
sudo ./bin/mysqld_safe --datadir='/usr/local/mysql/data' &
sudo ./bin/mysqladmin -u root password 'Cloud000@'
Data restoration (2 Servers) and replication settings
bash
cd ~
mysql -uroot -pCloud000@ < 2024-upgrade-backup.sql

# ๊ณ„์ •์ƒ์„ฑ: ํ•„์š”์—†์„๊ฒƒ์œผ๋กœ ๋ณด์ž„
##mysql -uroot -pCloud000@
##grant replication slave on *.* to repl@'%' identified by 'Cloud000@';
##flush privileges;

## ์žฌ์‹œ์ž‘
sudo kill $(pidof mysqld)
# ์ƒ์œ„์—์„œ ํ™•์ธ๋œ ๋ช…๋ น์–ด๋กœ ์‹คํ–‰
sudo /usr/local/mysql/bin/mysqld_safe --datadir='/usr/local/mysql/data' &

# Master Node
mysql -uroot -pCloud000@
## ํ™•์ธ(file , position ๊ฐ’) (SQL)
	show master status;
##	Log_bin ๊ฐ’ on ์ธ์ง€ ํ™•์ธ (SQL)
	show variables like '%log_bin%';
## slave ์„ค์น˜ ์ž‘์—… ํ›„ ์ปค๋„ฅ์…˜ ํ™•์ธ (SQL)
	show status like 'slaves_connected';

# Slave Node
mysql -uroot -pCloud000@
	CHANGE MASTER TO MASTER_HOST='172.16.0.33', MASTER_USER='repl', MASTER_PASSWORD='Cloud000@', MASTER_LOG_FILE='mariadb-bin.000043', MASTER_LOG_POS=344, MASTER_CONNECT_RETRY=10;
## ์žฌ์‹œ์ž‘
sudo kill $(pidof mysqld)
sudo /usr/local/mysql/bin/mysqld_safe --datadir='/usr/local/mysql/data' &

mysql -uroot -pCloud000@
	start slave;
	show slave status\G
Start Maxscale
bash
## 2 mariadb ๊ณ„์ •์ƒ์„ฑ: ํ•„์š”์—†์„๊ฒƒ์œผ๋กœ ๋ณด์ž„
##mysql -uroot -pCloud000@
##SELECT PASSWORD('maxscale');
##GRANT ALL PRIVILEGES ON *.* TO `maxscale`@`%` IDENTIFIED BY PASSWORD '*53E5D0C7885BD540911663B04133F20C94AD4306' WITH GRANT OPTION;
##flush privileges;

# ์ƒ์œ„์—์„œ ํ™•์ธ๋œ ๋ช…๋ น์–ด๋กœ ์‹คํ–‰
sudo bin/maxscale --user=maxscale -d &

maxctrl list servers

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *