잡동사니

[MariaDB] Maxscale을 활용한 Auto-Failover 구성하기 본문

IT/Database

[MariaDB] Maxscale을 활용한 Auto-Failover 구성하기

yeTi 2018. 10. 24. 16:19

안녕하세요. yeTi입니다.

오늘은 Maxscale을 활용하여 MariaDB의 Master-Slave 환경에서 Auto-Failover를 구현하도록 하겠습니다.



설치 환경

- OS : CentOS release 6.9 (Final)

- MariaDB : 10.2.11



1. RPM을 다운받는다. (https://mariadb.com/downloads/mariadb-tx/maxscale)

- wget https://downloads.mariadb.com/MaxScale/2.2.15/centos/7/x86_64/maxscale-2.2.15-1.centos.7.x86_64.rpm

- yum install [패키지명]


- MariaDB 에서 아래 쿼리 실행

GRANT ALL PRIVILEGES ON *.* TO maxscale@'%' IDENTIFIED BY 'fnqlr2018!' WITH GRANT OPTION;

2. 설정을 한다.

- vi /etc/maxscale.cnf

[maxscale]

threads=auto


[server1]

type=server

address=10.10.2.6

port=3306

protocol=MariaDBBackend


[server2]

type=server

address=10.10.2.7

port=3306

protocol=MariaDBBackend


[MariaDB-Monitor]

type=monitor

module=mariadbmon

servers=server1,server2

auto_failover=true

auto_rejoin=true

user=[Maxscale용 DB ID]

passwd=[Maxscale용 DB PW]

monitor_interval=2000


[Read-Only-Service]

type=service

router=readconnroute

servers=server2

user=[Server2용 DB ID]

passwd=[Server2용 DB PW]

router_options=slave


[Read-Write-Service]

type=service

router=readwritesplit

servers=server1

user=[Server1용 DB ID]

passwd=[Server1용 DB PW]


[MaxAdmin-Service]

type=service

router=cli


[Read-Only-Listener]

type=listener

service=Read-Only-Service

protocol=MariaDBClient

port=4008


[Read-Write-Listener]

type=listener

service=Read-Write-Service

protocol=MariaDBClient

port=4006


[MaxAdmin-Listener]

type=listener

service=MaxAdmin-Service

protocol=maxscaled

socket=default


3. Maxscale 명령어는 다음과 같습니다.

- service maxscale start

- maxadmin list servers

- maxadmin list monitors




참고 문헌


Comments