- Tren Galera, them user:
Quan tri tu xa
CREATE USER 'root'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;
User cho maxscale
CREATE USER 'maxscale'@'%' IDENTIFIED BY 'you-password-here';
GRANT SELECT ON mysql.db TO 'maxscale'@'%';
GRANT SELECT ON mysql.user TO 'maxscale'@'%';
GRANT SHOW DATABASES ON *.* TO 'maxscale'@'%';
wget https://downloads.mariadb.com/MaxScale/latest/centos/7/x86_64/maxscale-2.0.5-1.centos.7.x86_64.rpm
yum install -y maxscale-*
mv /etc/maxscale.cnf /etc/maxscale.cnf.bk
vi /etc/maxscale.cnf
Noi dung file cau hinh
- Thay thế vào file cấu hình những thông tin nếu thay đổi:
- user=maxscale
- passwd=you-password-here
- Thông tin các node MariaDB tại các
serverX
[maxscale]
threads=4
syslog=0
maxlog=1
log_to_shm=1
log_warning=1
log_notice=1
log_info=0
log_debug=0
[Galera Monitor]
type=monitor
module=galeramon
servers=server1,server2,server3
user=maxscale
passwd=you-password-here
monitor_interval=2000
disable_master_failback=1
available_when_donor=1
[qla]
type=filter
module=qlafilter
options=/tmp/QueryLog
[fetch]
type=filter
module=regexfilter
match=fetch
replace=select
[RW Split Router]
type=service
router=readwritesplit
servers=server1,server2,server3
user=maxscale
passwd=you-password-here
max_slave_connections=100%
max_slave_replication_lag=30
[CLI]
type=service
router=cli
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=3306
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
address=127.0.0.1
port=6603
[server1]
type=server
address=192.168.100.140
port=3306
protocol=MySQLBackend
[server2]
type=server
address=192.168.100.141
port=3306
protocol=MySQLBackend
[server3]
type=server
address=192.168.100.142
port=3306
protocol=MySQLBackend
https://linoxide.com/cluster/configure-mariadb-maxscale-galera-cluster/