SlideShare a Scribd company logo
1 of 49
MaxScale
목 차
I. MaxScale 소개
― 개요
― 특징
― 라이센스
― 아키텍처
II. MaxScale 구성 및 운영
― 설치
― maxscale.cnf 예시
― Configure Concepts
― High Availability
― 운영
― 성능
III. MaxScale Limitation
― configure / security
― protocol / Authenticator
― Filter / Monitor
― Router
IV. MaxScale 활용
― Router
― HA
― Flexibility & Scalability
MaxScale 소개
개요
Database
Customer Centric
Front-end
Transaction Focused
Back-end
▪ Continuous Delivery
▪ Microservices
▪ Modular deployment
▪ Security
▪ Scalability
▪ High quality data management
Application
Database
Customer Centric Front-end
Transaction Focused Back-end
▪ Continuous Delivery
▪ Microservices
▪ Modular deployment
▪ Security
▪ Scalability
▪ High quality data management
개요
Database
Customer Centric
Front-end
Transaction Focused
Back-end
▪ Continuous Delivery
▪ Microservices
▪ Modular deployment
▪ Security
▪ Scalability
▪ High quality data management
Application
Database
Customer Centric Front-end
Transaction Focused Back-end
▪ Continuous Delivery
▪ Microservices
▪ Modular deployment
▪ Security
▪ Scalability
▪ High quality data management
MaxScale
개요
query query
result
result
…Apps…
• [Database]
MySQL 5.1 later
MariaDB/Percona all versions
ClustrixDB
• [Cluster]
Galera Cluster
Replication
MySQL Cluster
• [OS]
RHEL 5 later
CentOS 5 later
Ubuntu 12.04 later
Debian 7 later
openSUSE 13.1
SLES 11 later
특징
MaxScale is a database proxy and more specifically
Database를 방해하지 않으면서, Apps에 영향을 주지 않으면서,
Database와 Apps를 완벽하게 분리할 수 있고, 관리프로세스를 실행할 수 있어요.
보안성 유연성 고가용성 데이터 스트리밍
SQL-Injection / DDoS등의
공격에 대한 보호기능으로서
Secure Database Firewall
Application 코드변경 없이
Scale-out Infrastructure 관리
SPOF없는 가동시간 보장과
업그레이드를 위한
최소 다운타임 제공
실시간 분석을 위해서
Data lake에 트랜잭션
데이터 스트리밍제공
특징
보안성
SQL-Injection, DDoS, 비인증접속 등의
보안위협으로부터 데이터 보호
Data in Motion
▪ 데이터 이동(Network)시 end-to-end SSL 제공
Data in Use
▪ MaxAdmin Security -local only access
Data at Rest
▪ Firewall Filter: Whitelisting/Blacklisting
▪ DDos 공격보호를 위한 Client Connection 제한 가능
Query
Firewall Filter
Select from customer
Where id = 5:SELECT *
FROM CUSTOMERS;
MaxScale
1 3
2
Client
Query failed: 1141
Error: Required WHERE/HAVING
clause is missing
Error
SQ
L
특징
유연성
Content Aware(강화된 Proxy기능)
▪ 서버의 요구내용 인식
▪ 서버의 구성 및 상태 인식
Query Routing
▪ Load balancing: 트랜잭션 로드밸런싱과 모니터링
▪ Read/Write 분할처리
Replication
▪ Large Master-Slave구조에서 고성능 복제(Binlog서버)
Multi-tenant Database Scaling
▪ Schema sharding을 위한 분산처리 지원
Read
Write
특징
고가용성(HA)
SPOF없는 고가용성 지원
Ensure database uptime
▪ 자동 Fail-Over
▪ New Master로 Slave들의 Master정보 변경.
▪ Master가 Fail상태일때도 Read Transaction 지원
Minimize database downtime
▪ 사용자 영향 없이 DB upgrade 지원
▪ Tee-filter 통해 쿼리 복제하여 신규DB로 전송
Master
script
master_down event
Failover Script
CHANGE MASTER to new master;
START SLAVE
Slaves
STOP SLAVE
Promote as master
binlog cache
1 4
3
2
4
특징
데이터 스트리밍
Slaves
Binlog,
Avro,
JSON
Master
MaxScale
Binary log
events
Avro or
JSON
events
실시간 분석을 위해서 data lake에 트랜잭션 데이터 스트리밍 제공.
▪ Binary Log Event에서 변경데이터를 캡처하고
이를 AVRO or JSON형식으로 변환하여 이를 실시간으로 Kafka broker통해
하둡, 카산드라 같은 빅데이터 플랫폼에 데이터를 제공하는 Producer역할 수행
Data Warehouse
Slaves
Binlog,
Avro, JSON
라이센스
BSL (Business Source License)
▪ Maxscale 2.0 ~ 2.0.4 은 BSL 1.0 적용
▪ BSL은 Closed Source 또는 Open Core 라이센스 모델의 새로운 대안입니다. BSL에서 소스
코드는 항상 자유롭게 사용할 수 있으며 특정 시점 (즉, 변경 날짜)에 오픈 소스가 될 수
있습니다. BSL의 특정 수준 이하의 사용은 항상 완전 무료입니다. 지정된 수준 (고급 사용자)
이상으로 사용하면 변경 날짜까지 공급 업체 라이선스가 필요하며 이 시점에서 모든 사용은
무료가 됩니다. (참고 https://mariadb.com/bsl-faq-mariadb )
▪ BSL 적용받는 또다른 Project들은?
+ MariaDB ColumnStore Backup Restore Tool
+ MariaDB ColumnStore MaxScale CDC Data Adapter
▪ + MariaDB ColumnStore Kafka Data Adapter
▪ + MariaDB Kubernetes Operator
https://mariadb.com/projects-using-bsl-11/
▪ 약은 약사에게~, BSL라이센스는 MariaDB에게~
라이센스
GA Latest Releases (2019-07-20 현재)
• MaxScale 2.3.9 : 2019-07-04
• MaxScale 2.2.21 : 2019-05-08 √
• MaxScale 2.1.17 : 2018-05-16
• MaxScale 2.0.6 : 2017-06-14
• MaxScale 1.4.5 : 2017-02-01
아키텍처
Applications
Containers
MariaDB Platform
MariaDB MaxScale
CDC
MariaDB Server
InnoDB + MyRocks
MariaDB Server
ColumnStore
Transactional Analytical
Kubernetes (Helm) Docker (Compose)
C JDBC ODBC Node.js
Ingest streaming data
Kafka connector
Administration
SQL Diagnostic
Manager
SQLyog
MariaDB Backup
MariaDB Flashback
Import bulk data
Spark connector
C/Java/Python API
아키텍처
MaxScale
• Threading
• Logging
• Plugin loading
• Lifetime management
APIs Protocol Authenticator Filter Router Query Classifier Monitor
… … … … … …
MariaDBClient MySQLAuth DBFwfilter ReadWriteSplit qc_sqlite MariaDBMon
• REST-API (8989)
• Admin Functionality
• etc.
Core
Utility
maxadmin
maxbinlog
check
MaxCtrl
아키텍처
MaxScale
Protocol
Filter Filter
Servers State
Router
Protocol
Monitor
Client
Servers
Query
Classifier
monitors
updates
uses
modified
parser
from sqlite
아키텍처
객체 설명 종류 비고
Protocol 서버간 통신.
mariadbclient
mariadbbackend
Filter Router앞에서 Request에 대한 정보 거부,처리,변경,기록.
dbfwfilter
cache
regexfilter
qlafilter
[section가능]
Routers Request의 특성에 따라 백엔드로 라우팅 제공.
readconnroute
readwritesplit
Monitor 특정 클러스터상태, 라우팅 상태 등을 모니터링, failover.
mariadbmon, mysqlmon
galeramon, mmmon
auroramon, csmon
[section가능]
Server 백엔드 서버정보 사용자정의 [section가능]
Service 데이터베이스 추상화 집합(like single database) 사용자정의 [section가능]
Listener MaxScale이 수신대기 포트정보. 리스너에 연결된 서비스로 전달. 사용자정의 [section가능]
* section : maxscale config상의 단위
https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios
구성요소
(버전간 다소 차이가 있어요.)
module
아키텍처
객체 설명 주요 옵션
Readconroute 매개변수/가중치에 따른 가벼운 로드밸런서. router_options (master,slave, synced, ndb,running)
Readwritesplit 클러스터의 일관성을 유지하면서 읽기/쓰기 분산 로드밸런서. router_options ( 많아요 ^^;;)
Binlogrouter Master와 Slave사이에서 복제 프로토콜 프록시 모듈. binlogdir
Avrorouter
Master or Binlogserver로부터 avro 형식파일로 자동변환 후
CDC 프로토콜에 응답가능.
avrodir (https://avro.apache.org/docs/current/)
Cli maxadmin cli interface
SchemaRouter 데이터베이스 기반 샤딩, ignore_databases
HintRouter 힌트에 따른 패킷 라우팅 ?? beta버전….(introduced in 2.2)
debugcli port=4442, protocol=telnetd (admin / mariadb)
cat 모든 서버에 명령을 라우팅. 실험용.
* section : maxscale config상의 단위
https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios
Router
(버전간 다소 차이가 있어요.)
아키텍처
객체 설명 주요 옵션/비고
namedserverfilter 패치되는 패턴에 일치하는 SQL을 특정 Server로 라우팅. match= *from *users
qlafilter 세션별로 모든 SQL 기록. match=select.*from.*customer.*where
regexfilter 매치되는 패턴에 대한 SQL 변경. 정규식 String을 replace 처리.
match=TYPEs*=
replace=ENGINE=
tee 매치되는 패턴에 대한 SQL의 이중으로 복사 전송. match=insert[ ]*into[ ]*orders
topfilter 매치되는 패턴에 대한 모니터링(보고서). filebase = 경로
dbfwfilter 매치되는 패턴에 대한 SQL 차단. rules = role1.cnf
mqfilter RabbitMQ 필터. 정규화된 SQL/응답을 RabbitMQ 브로커로 푸시.
Filters
@ 복수의 필터적용은 ‘|’ 사용
filters = top | qlafilter
아키텍처
객체 설명 주요 옵션/비고 소개(버전)
ccrfilter 일관된 주요읽기 수행제어. 주요하지 않는 읽기는 스케일아웃. match =. * INSERT. * 2.1
insertstream 트랜잭션에 다수의 INSERT문을 LOAD DATA LOCAL INFILE~로 변환 2.1 실험용
masking 특정 컬럼의 반환값을 마스킹처리. rules = rule2.cnf 2.1
luafilter lua 스크립트에서 일부 함수를 호출하는 필터. 2.1 실험용
maxrows 결과셋으로 전달되는 rows를 제한하는 필터. max_resultset_size=64Ki 2.1
tpmfilter 트랜잭션 성능 모니터링 필터 filename=tpm.log 2.1
cache select 결과값에 대한 캐싱후 제공. max_count = 1000 2.1
binlogfilter 빈로그 복제처리의 필터링 처리.(match or exclude) exclude=/[.]orders/ 2.3
comment 요청 SQL에 주석 삽입. inject="IP=$IP" 2.3
throttlefilter 세션의 최대쿼리빈도 (초당 쿼리 수)를 구성가능한 값으로 제한에 사용 max_qps = 500 2.3
Filters( After 2.1)
MaxScale 구성 및 운영
설치
https://mariadb.com/downloads/#mariadb_platform-mariadb_maxscale
MariaDB MaxScale 선택
설치하고자 하는 버전 선택
MaxScale를 설치하려는 OS 플랫폼 선택
원하는 버전 혹은 설치종류가 없을 경우
(rpm/binary)
설치
• 미리 download 한 RPM 패키지 혹은 yum repository를 구성하여 install
• MaxScale이 DB에서 사용 할 유저 생성
• Configure 설정 (사용 할 port 방화벽 open)  기본 /etc/maxscale.cnf
• MaxScale 기동
https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-installation-guide/
# rpm -ivh maxscale-2.3.9-1.centos.7.x86_64.rpm
# curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
# yum install maxscale*
MariaDB [(none)]> create user '[user]'@'[host]' identified by '[password]';
MariaDB [(none)]> grant select on mysql.user to '[user]'@'[host]';
MariaDB [(none)]> grant select on mysql.db to '[user]'@'[host]';
MariaDB [(none)]> grant select on mysql.table_priv to '[user]'@'[host]';
MariaDB [(none)]> grant show databases, replication_client on *.* to '[user]'@'[host]';
# service maxscale start
# systemctl start maxscale
기본 환경구성(/etc/maxscale.cnf 예시)
https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios/
[maxscale]
threads=auto
[Write service]
type=service
router=readconnroute
router_options=master
servers=DB1,DB2,DB3
user=max
passwd=maxscalePW
[DB1]
type=server
address=192.168.0.100
port=3306
protocol=MySQLBackend
user=max
passwd=maxscalePW
[DB2]
…
[DB3]
…
[DB Monitor]
type=monitor
module=mysqlmon
servers=DB1,DB2,DB3
user=max
passwd=maxscalePW
monitor_interval=60000
[MaxAdmin]
type=service
router=cli
[maxadmin listener]
type=listener
service=MaxAdmin
protocol=maxscaled
socket=default
각 섹션 별 maxscale.cnf 예시
[ ] = 섹션(정해진 것이 아닌 임의의 지정)
[Listener]
type=listener
service=Write service
protocol=MySQLClient
port=3306
address=0.0.0.0
Configure Concepts
https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios/#concepts
Glossary
Word Description
connection routing
MariaDB MaxScale이 클라이언트의 연결을 수락하고 단일 연결을 사용하여 해당 연결의 데이터를 단일 데이터베이스로
라우팅하는 요청을 처리하는 방법
statement routing 연결 내의 각 요청을 개별적으로 처리하는 방법
module 별도의 코드 엔티티, MariaDB MaxScale에 동적으로 로드되어 사용 가능한 기능을 향상
connection failover
MariaDB MaxScale과 데이터베이스 서버 간 사용되는 연결이 실패하면 클라이언트의 개입없이 MariaDB MaxScale에 의해
다른 서버로 자동 대체
backend database MariaDB MaxScale 뒤에 위치하며 MariaDB MaxScale을 통해 응용 프로그램에 의해 액세스되는 데이터베이스를 지칭하는 용어
REST API HTTP 관리 인터페이스
Configure Concepts
https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios/#objects
Objects
Section Description
Server
MariaDB MaxScale을 통해 클라이언트를 연결할 수 있는 개별 데이터베이스 서버
Protocol MaxScale과 MaxScale 클라이언트 또는 MaxScale에 노출 된 서버 간의 통신을 담당
Monitor 특정 종류의 클러스터 상태를 모니터링하고 MaxScale의 라우터에서 해당 상태를 사용할 수 있게 함
Filter MaxScale의 요청 처리 라우터 앞에 위치하여 요청에 대한 정보를 거부, 처리, 변경 또는 기록
Router 요청의 특성 또는 라우터가 구현하는 알고리즘에 따라 요청을 backend 서버로 라우팅 (readconnroute / readwritesplit 등)
Service 데이터베이스 집합을 추상화하여 클라이언트에 단일 데이터베이스로 표시
Listener MaxScale이 수신 대기하는 포트를 정의. 당 포트에 도착한 연결 요청은 리스너가 연결된 서비스로 전달
Status Description
Running 정상 상태
Master Master 서버를 표시
Slave Slave 서버를 표시
Maintenance 점검이 필요한 상태 (서버에 연결이 되지 않고 수동으로 켜지지만 어떠한 이유로 연결이 차단 됨)
Slave of External Master 모니터링 되지 않는 slave
High Availability
https://mariadb.com/resources/blog/maxscale-ha-setup-using-keepalived-and-maxctrl/
MaxScale
With
Keepalived
MaxScale
With
COROSYNC/PACEMAKER
OR
운영
• maxadmin 사용을 위한 configure 설정
• Maxadmin cli 접속
• Command 확인
[MaxAdmin]
type=service
router=cli
[MaxAdmin Unix Listener]
type=listener
service=MaxAdmin
protocol=maxscaled
socket=default
# maxadmin
MaxAdmin>
# maxadmin
MaxAdmin> help
운영
• Linux shell 에서 maxadmin cli에 접속하지 않고도 maxctrl 명령으로 동일한 요건 수행 가능
• maxctrl은 REST-API 와 통신.
• maxadmin의 대체용.
Ex)
# maxctrl list servers
# maxctrl list listener
Etc.
성능
MaxScale 2.0.5 (up to)
Hardware: Two physical servers, 16 cores / 32 hyperthreads, 12
8GB RAM and an SSD drive, connected using GBE LAN. One ru
ns MaxScale and sysbench, the other 4 MariaDB servers setup a
s Master and 3 Slaves.
Workload: OLTP read-only, 100 simple selects per iteration, no
transaction boundaries.
● direct: Sysbench uses all
servers directly in
round-robin fashion.
● rcr: MaxScale readonnroute
router.
● rws: MaxScale readwritesplit
router.
https://www.slideshare.net/MariaDB/m18-maxscale
성능
https://www.slideshare.net/MariaDB/m18-maxscale
MaxScale 2.1.0
● The architectural changeth
at allowed the removal of a l
arge number of locks provide
d a dramatic improvement
for readconnroute.
● No change for readwritesplit.
● With small number of clients the
introduced cache improved the
performance, with large number
no impact.
성능
https://www.slideshare.net/MariaDB/m18-maxscale
MaxScale 2.2.2
MaxScale Limitation
• 2.1.2 및 이전 버전에서는 configure 파일 작성 시 한 줄에 1024 자로 제한
― MaxScale 2.1.3에서 16384 자로 증가
― MaxScale 2.3.0은이 제한을 16777216 자로 증가
• 2.2.12 및 이전 버전에서는 configure 파일의 섹션 이름이 49 자로 제한
― MaxScale 2.2.13에서 1023 자로 증가
제한사항
• Maxscale의 parser는 WITH 구문을 올바르게 구문 분석하지만, WITH 절을 정의하는 SELECT에 사용 된 열, 함수
및 표를 수집하지 못함
• 결과적으로 데이터베이스 방화벽은 WITH 절의 SELECT가 금지 된 열을 참조하는 WITH 문을 차단하지 않음
Security (MariaDB 10.2 사용 시)
Configure
• XA트랜잭션 탐지 불가
― XA 명령은 알 수 없는 명령으로 처리
― 데이터베이스를 잠재적으로 수정할 수 있는 작업으로 취급(readwritesplit 일 경우, 마스터로 라우트 됨)
― XA 트랜잭션 내부에서 수행 된 SELECT 쿼리는 XA 트랜잭션의 일부가 아닌 서버로 라우팅
― XA 트랜잭션 수행 시 auto commit을 비활성화 하여 수행가능
제한사항
• prepared statement를 사용하여 autocommit 모드 변경 시 문제 발생
― 모드 변경이 되어도 maxscale은 이를 인지하지 못함
Prepared Statements
Query Classification
SET autocommit=0;
XA START 'MyXA’;
INSERT INTO test.t1 VALUES(1);
XA END 'MyXA’;
XA PREPARE 'MyXA’;
XA COMMIT 'MyXA’;
SET autocommit=1;
set autocommit=1
PREPARE hide_autocommit FROM "set autocommit=0"
EXECUTE hide_autocommit
 변경 되었으나 인지하지 못함
• MySQL / MariaDB 프로토콜 지원의 한계 (MariaDBClient)
― Compression은 Server handshake에 포함되지 않음
― KILL QUERY ID <query_id> 유형 문을 지원하지 않음 (DB에서 직접실행 해야 함)
― KILL 명령은 비동기적으로 실행되고 결과는 무시되므로 사용자는 권한이 없어도 성공한 것처럼 보여짐
제한사항
• GSSAPI authenticator 제한
― backend 연결이 GSSAPI 인증을 사용할 때만 GSSAPI 인증을 지원
― 다른 backend 인증 모듈을 사용하는 클라이언트 측 GSSAPI 인증은 지원되지 않음
• MySQL authenticator (MySQLAuth) 제한
― MySQL 구형 패스워드는 지원되지 않음 (MySQL 4.1 버전 이상의 인증 프로토콜 사용)
― 사용자가 연결할 호스트에 따라 다른 암호를 사용하는 경우 MariaDB MaxScale은 백엔드 데이터베이스에 연결할 때 사용해야하는 암호를 다
르게 인식하지 못함 (연결이 실패되고 사용자이름을 사용할 수 없음)
― 넷마스크 설정 시, 0 또는 255만 지원 (ex. 255.255.255.0 = 가능 / 255.255.255.192 = 미지원)
Authenticator
Protocol
• Database Firewall 제한 (dbfwfilter)
― 다중 명령문을 지원하지 않음 (클라이언트에 오류가 전송됨)
• Tee filter 제한 (tee)
― binary protocol prepared statements를 지원하지 않음. The execution of a prepared statements through a service that uses the tee filter is
not guaranteed to succeed on the service where the filter branches to as it does on the original service.
― binary protocol prepared statements 구문이 server-generated ID로 식별 됨. The ID sent to the client from the main service is not
guaranteed to be the same that is sent by the branch service.
제한사항
• 하나의 모니터만 사용 가능
― 동일 서버를 두대이상에서 모니터링할 경우 오류로 간주됨
• Galera Cluster 모니터링 제한 (galeramon)
― wsrep_local_index를 기반으로 기본 Master가 선택 됨
― 서버 우선 순위 메커니즘의 영향을 받을 수 있음
Monitor
Filter
• Avrorouter 제한 (avrorouter)
― avrorouter는 다음 데이터 유형, 변환 또는 SQL 문을 지원하지 않음: BIT, 정수 유형에서 문자열 유형으로 CAST 함수,
CREATE TABLE ... AS SELECT 구문
― avrorouter는 어떤 충돌 복구도 하지 않음. 즉, avroouter를 시작하기 전에 avro 파일을 유효한 블록 길이로 잘라 사용해야 함
― binlog checksum을 지원하지 않음.
• connection router 제한 (readconnroute)
― LOAD DATA LOCAL INFILE 로 binary data를 송신을 지원하지 않음
• Read/Write Splitter 제한 (readwritesplit)
― 마스터 서버로 라우팅 되는 쿼리: open transaction 내에서 쿼리가 실행 된 경우
: 구문에 저장 프로시저 또는 UDF 호출이 포함되어 있는 경우
: 하나의 쿼리 안에 여러 개의 명령문이 있는 경우
― Readwritesplit은 JDBC 배치 명령문의 파이프 라이닝을 지원하지 않음
― multi-statement 쿼리가 readwritesplit 라우터를 통해 실행되면 항상 마스터로 라우팅
― 다중 명령문 쿼리 내에서 LOAD DATA LOCAL INFILE 문을 실행 불가 (MaxScale hang issue)
― USE <db name> 및 SET autocommit = 0이 포함한 몇몇의 쿼리는 복사본을 각 백엔드 서버로 보내고 마스터의 응답을 클라이언트에 전달
― use_sql_variables_in 매개 변수를 all로 설정하면 SELECT 쿼리가 사용자 변수를 수정하면 라우팅되지 않고 클라이언트가 오류를 수신
제한사항
Router
MaxScale 활용
Router
• Case ) 전통적인 물리장비(L4)의 대체.
[A Service]
type=service
router=readconroute
servers=srv1,srv2,srv3,srv4….
router_options=running #(master, slave, synced, ndb, running)
• Case ) Readwritesplite 통한 Master/Slave구조의 지능적인 분산처리.
[Split-Service]
type=service
router=readwritesplite
servers=srv1,srv2,srv3,srv4
• Case ) Backend 정보의 은닉 / 보안강화
#maxscale ip – 10.10.10.1
# grant all privileges on *.* to ‘appuser’@’ 10.10.10.1’;
[A Service-Listener]
type=listener
service=A Service
protocol=MariaDBClient
port = 43306
[srv1]
type=server
address=20.20.20.1
protocol=MariaDBBackend
port = 3306
HA
• Case ) 다양한 Cluster구성에 대한 지원.
#mariadbmon : Master-Slave Replication Cluster’s Monitoring
#mmmon : Multi-Master Replication Cluster’s Monitoring(deprecatred)
#galeramon : Galera Cluster Monitoring
• Case ) Master Node 장애에 대한 Auto-Failover.
[MyMonitor]
type=monitor
module=mariadbmon
servers=server1,server2,server3
monitor_interval=2000 #2sec
failcount=5
auto_failover=true #master ha
auto_rejoin=true #slave join
#events=master_down, slave_down
#script=
Flexibility & Scalability
• Case ) Tee Filter를 통한 신규 version에 대한 검증
[A-Service]
type=service
router = readconroute
filters=NewDBClone
[NewDBClone]
type=filter
module=tee
service=NewDB
[NewDB]
type=service
router = readconroute
servers = newsrv1, newsrv2
Case ) schmearouter를 통한 단순 Database 샤딩.
[Shard-Router]
type=service
router=schemarouter
servers=server1,server2
• Case ) binlogrouter를 통한 binlog Server role.
[Replication]
type=service
router=binlogrouter
user=maxscale
password=maxpwd
server_id=3
binlogdir=/var/lib/maxscale/
mariadb10-compatibility=1
MaxScale 적용사례
적용사례
• Galera Cluster의 Routing Solution
module=galeramon
disable_master_failback=0|1
• ColumnStore 서비스의 Routing Solution
• Master/Slave 구조에서의 Routing & HA Solution
• Readwritesplite Router를 통한 Read Only와 Write Transaction 지능적인 분산처리. But~
• QueryLogFilter 통해서 Request에 대한 모든 SQL문을 기록해보자~(for ISMS).
OMG, 로그파일이 각 세션별로 만들어져요~^^;;
• 많은 모듈에 적용되는 필터링에 대한 정규표현식이 익숙하지 않아서~.
Maxscale은 정규표현식에 PCRE2 (Perl-Compatibility Regular Expression)라이브러리를 사용합니다.
https://www.pcre.org/current/doc/html/pcre2syntax.html
• 계정 사용시 root는 사용하지 마세요.
enable_root_user = 1
• Backend Server의 계정추가후 MaxAdmin 에서 maxadmin>reload dbusers 수행 필요. ( auth fail후 30초 마다 갱신)
docker 구축방법, readwritesplit multi user?
• Docker 이용
https://hub.docker.com/r/mariadb/maxscale/
• 인증/권한
- MaxScale 설치 host에 대한 권한 부여.
- 계정 / 비번 서버마다 모두 동일해야 함.( Only one)
https://mariadb.com/kb/en/mariadb-maxscale-22-mariadb-maxscale-configuration-usage-scenarios/#authentication
성능 , Transaction Routing
• 성능
2.1에 성능이 많이 개선된 거 같아요. 2.2 추천.
2019.07.24 현재 GA버전
2.2.21
2.3.9
• Transaction Routing
MaxScale도입 전에 반드시 서비스되는 SQL패턴을 인지하고
MaxScale 제약사항에 해당되는 부분이 없는지 확인해야 합니다.
반대로 Maxscale 구성 이후에 신규 작성하는 SQL/PROJECT라면
개발가이드에 MaxScale 제약사항을 배포하는게 좋겠어요.
CDC, LB, HA
• CDC
https://mariadb.com/resources/blog/streaming-data-from-mariadb-server-into-mariadb-columnstore-via-mariadb-maxscale/
• Load-Balancing
[RW Service]
type=service
weightby=rw_weight
…
[server1]
type=server
rw_weight=(가중치 수)
• HA
KeepAlived 이용 (https://mariadb.com/resources/blog/maxscale-ha-setup-using-keepalived-and-maxctrl/)
pacemaker & corosync 이용 (https://mariadb.com/kb/en/mariadb-maxscale-22-how-to-make-mariadb-maxscale-high-available/)
Maxscale 소개 1.1.1

More Related Content

What's hot

MaxScale이해와활용-2023.11
MaxScale이해와활용-2023.11MaxScale이해와활용-2023.11
MaxScale이해와활용-2023.11NeoClova
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용I Goo Lee
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxNeoClova
 
MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)NeoClova
 
MariaDB 제품 소개
MariaDB 제품 소개MariaDB 제품 소개
MariaDB 제품 소개NeoClova
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestI Goo Lee
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterMySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterKenny Gryp
 
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docxMySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docxNeoClova
 
Using all of the high availability options in MariaDB
Using all of the high availability options in MariaDBUsing all of the high availability options in MariaDB
Using all of the high availability options in MariaDBMariaDB plc
 
MariaDB Optimization
MariaDB OptimizationMariaDB Optimization
MariaDB OptimizationJongJin Lee
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기I Goo Lee
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQLMydbops
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestratorYoungHeon (Roy) Kim
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxNeoClova
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQLI Goo Lee
 
MariaDB Administrator 교육
MariaDB Administrator 교육 MariaDB Administrator 교육
MariaDB Administrator 교육 Sangmo Kim
 
How to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScaleHow to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScaleMariaDB plc
 
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.NAVER D2
 
Percona server for MySQL 제품 소개
Percona server for MySQL 제품 소개Percona server for MySQL 제품 소개
Percona server for MySQL 제품 소개NeoClova
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesKenny Gryp
 

What's hot (20)

MaxScale이해와활용-2023.11
MaxScale이해와활용-2023.11MaxScale이해와활용-2023.11
MaxScale이해와활용-2023.11
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
 
MySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptxMySQL_MariaDB-성능개선-202201.pptx
MySQL_MariaDB-성능개선-202201.pptx
 
MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)
 
MariaDB 제품 소개
MariaDB 제품 소개MariaDB 제품 소개
MariaDB 제품 소개
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterMySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
 
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docxMySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docx
 
Using all of the high availability options in MariaDB
Using all of the high availability options in MariaDBUsing all of the high availability options in MariaDB
Using all of the high availability options in MariaDB
 
MariaDB Optimization
MariaDB OptimizationMariaDB Optimization
MariaDB Optimization
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
MariaDB Administrator 교육
MariaDB Administrator 교육 MariaDB Administrator 교육
MariaDB Administrator 교육
 
How to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScaleHow to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScale
 
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
 
Percona server for MySQL 제품 소개
Percona server for MySQL 제품 소개Percona server for MySQL 제품 소개
Percona server for MySQL 제품 소개
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
 

Similar to Maxscale 소개 1.1.1

개발자 지향 WAS : IBM WebSphere Liberty Server
개발자 지향 WAS : IBM WebSphere Liberty Server개발자 지향 WAS : IBM WebSphere Liberty Server
개발자 지향 WAS : IBM WebSphere Liberty ServerJungWoon Lee
 
ARCUS offline meeting 2015. 05. 20 1회
ARCUS offline meeting 2015. 05. 20 1회ARCUS offline meeting 2015. 05. 20 1회
ARCUS offline meeting 2015. 05. 20 1회JaM2in
 
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법Ji-Woong Choi
 
IBM Spectrum Protect Plus Overview
IBM Spectrum Protect Plus OverviewIBM Spectrum Protect Plus Overview
IBM Spectrum Protect Plus OverviewDongjae Yeo
 
Azure Databases for PostgreSQL MYSQL and MariaDB
Azure Databases for PostgreSQL MYSQL and MariaDBAzure Databases for PostgreSQL MYSQL and MariaDB
Azure Databases for PostgreSQL MYSQL and MariaDBrockplace
 
SoftLayer 서비스 설명 1차 - SoftLayer 소개
SoftLayer 서비스 설명 1차 - SoftLayer 소개SoftLayer 서비스 설명 1차 - SoftLayer 소개
SoftLayer 서비스 설명 1차 - SoftLayer 소개IBM Korea
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4Seok-joon Yun
 
AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017
AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017
AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017Amazon Web Services Korea
 
클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버
클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버
클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버JungWoon Lee
 
AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기
AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기
AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기Amazon Web Services Korea
 
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...Cloud-Barista Community
 
cdit hci zerto '소통하는 세미나' 소개자료(201705)
cdit hci zerto '소통하는 세미나' 소개자료(201705)cdit hci zerto '소통하는 세미나' 소개자료(201705)
cdit hci zerto '소통하는 세미나' 소개자료(201705)CDIT-HCI
 
마이크로서비스 아키텍처로 개발하기
마이크로서비스 아키텍처로 개발하기마이크로서비스 아키텍처로 개발하기
마이크로서비스 아키텍처로 개발하기Jaewoo Ahn
 
로그 수집, 집약
로그 수집, 집약로그 수집, 집약
로그 수집, 집약kidoki
 
Openstack Usecase(2018)
Openstack Usecase(2018)Openstack Usecase(2018)
Openstack Usecase(2018)Gasida Seo
 
Azure databases for PostgreSQL, MySQL and MariaDB
Azure databases for PostgreSQL, MySQL and MariaDB Azure databases for PostgreSQL, MySQL and MariaDB
Azure databases for PostgreSQL, MySQL and MariaDB rockplace
 
MySQL Deep dive with FusionIO
MySQL Deep dive with FusionIOMySQL Deep dive with FusionIO
MySQL Deep dive with FusionIOI Goo Lee
 
Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017
Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017
Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017Amazon Web Services Korea
 
Private cloud network architecture (2018)
Private cloud network architecture (2018)Private cloud network architecture (2018)
Private cloud network architecture (2018)Gasida Seo
 

Similar to Maxscale 소개 1.1.1 (20)

개발자 지향 WAS : IBM WebSphere Liberty Server
개발자 지향 WAS : IBM WebSphere Liberty Server개발자 지향 WAS : IBM WebSphere Liberty Server
개발자 지향 WAS : IBM WebSphere Liberty Server
 
ARCUS offline meeting 2015. 05. 20 1회
ARCUS offline meeting 2015. 05. 20 1회ARCUS offline meeting 2015. 05. 20 1회
ARCUS offline meeting 2015. 05. 20 1회
 
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
 
IBM Spectrum Protect Plus Overview
IBM Spectrum Protect Plus OverviewIBM Spectrum Protect Plus Overview
IBM Spectrum Protect Plus Overview
 
Azure Databases for PostgreSQL MYSQL and MariaDB
Azure Databases for PostgreSQL MYSQL and MariaDBAzure Databases for PostgreSQL MYSQL and MariaDB
Azure Databases for PostgreSQL MYSQL and MariaDB
 
SoftLayer 서비스 설명 1차 - SoftLayer 소개
SoftLayer 서비스 설명 1차 - SoftLayer 소개SoftLayer 서비스 설명 1차 - SoftLayer 소개
SoftLayer 서비스 설명 1차 - SoftLayer 소개
 
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
[2015 07-06-윤석준] Oracle 성능 최적화 및 품질 고도화 4
 
AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017
AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017
AWS DMS를 통한 오라클 DB 마이그레이션 방법 - AWS Summit Seoul 2017
 
클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버
클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버
클라우드와 마이크로 서비스를 위한 새로운 시대의 경량화 WAS - IBM WAS Liberty 서버
 
AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기
AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기
AWS 9월 웨비나 | AWS 데이터베이스 마이그레이션 서비스 활용하기
 
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
Cloud-Barista 제3차 오픈 컨퍼런스 : CB-Spider - 멀티 클라우드 인프라 연동(Multi-Cloud Infrastruc...
 
cdit hci zerto '소통하는 세미나' 소개자료(201705)
cdit hci zerto '소통하는 세미나' 소개자료(201705)cdit hci zerto '소통하는 세미나' 소개자료(201705)
cdit hci zerto '소통하는 세미나' 소개자료(201705)
 
마이크로서비스 아키텍처로 개발하기
마이크로서비스 아키텍처로 개발하기마이크로서비스 아키텍처로 개발하기
마이크로서비스 아키텍처로 개발하기
 
L4교육자료
L4교육자료L4교육자료
L4교육자료
 
로그 수집, 집약
로그 수집, 집약로그 수집, 집약
로그 수집, 집약
 
Openstack Usecase(2018)
Openstack Usecase(2018)Openstack Usecase(2018)
Openstack Usecase(2018)
 
Azure databases for PostgreSQL, MySQL and MariaDB
Azure databases for PostgreSQL, MySQL and MariaDB Azure databases for PostgreSQL, MySQL and MariaDB
Azure databases for PostgreSQL, MySQL and MariaDB
 
MySQL Deep dive with FusionIO
MySQL Deep dive with FusionIOMySQL Deep dive with FusionIO
MySQL Deep dive with FusionIO
 
Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017
Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017
Photon게임서버 네트워크엔진과 GBaaS를 통한 AWS DB 서비스 구성 방법 소개 - AWS Summit Seoul 2017
 
Private cloud network architecture (2018)
Private cloud network architecture (2018)Private cloud network architecture (2018)
Private cloud network architecture (2018)
 

Maxscale 소개 1.1.1

  • 2. 목 차 I. MaxScale 소개 ― 개요 ― 특징 ― 라이센스 ― 아키텍처 II. MaxScale 구성 및 운영 ― 설치 ― maxscale.cnf 예시 ― Configure Concepts ― High Availability ― 운영 ― 성능 III. MaxScale Limitation ― configure / security ― protocol / Authenticator ― Filter / Monitor ― Router IV. MaxScale 활용 ― Router ― HA ― Flexibility & Scalability
  • 4. 개요 Database Customer Centric Front-end Transaction Focused Back-end ▪ Continuous Delivery ▪ Microservices ▪ Modular deployment ▪ Security ▪ Scalability ▪ High quality data management Application Database Customer Centric Front-end Transaction Focused Back-end ▪ Continuous Delivery ▪ Microservices ▪ Modular deployment ▪ Security ▪ Scalability ▪ High quality data management
  • 5. 개요 Database Customer Centric Front-end Transaction Focused Back-end ▪ Continuous Delivery ▪ Microservices ▪ Modular deployment ▪ Security ▪ Scalability ▪ High quality data management Application Database Customer Centric Front-end Transaction Focused Back-end ▪ Continuous Delivery ▪ Microservices ▪ Modular deployment ▪ Security ▪ Scalability ▪ High quality data management MaxScale
  • 6. 개요 query query result result …Apps… • [Database] MySQL 5.1 later MariaDB/Percona all versions ClustrixDB • [Cluster] Galera Cluster Replication MySQL Cluster • [OS] RHEL 5 later CentOS 5 later Ubuntu 12.04 later Debian 7 later openSUSE 13.1 SLES 11 later
  • 7. 특징 MaxScale is a database proxy and more specifically Database를 방해하지 않으면서, Apps에 영향을 주지 않으면서, Database와 Apps를 완벽하게 분리할 수 있고, 관리프로세스를 실행할 수 있어요. 보안성 유연성 고가용성 데이터 스트리밍 SQL-Injection / DDoS등의 공격에 대한 보호기능으로서 Secure Database Firewall Application 코드변경 없이 Scale-out Infrastructure 관리 SPOF없는 가동시간 보장과 업그레이드를 위한 최소 다운타임 제공 실시간 분석을 위해서 Data lake에 트랜잭션 데이터 스트리밍제공
  • 8. 특징 보안성 SQL-Injection, DDoS, 비인증접속 등의 보안위협으로부터 데이터 보호 Data in Motion ▪ 데이터 이동(Network)시 end-to-end SSL 제공 Data in Use ▪ MaxAdmin Security -local only access Data at Rest ▪ Firewall Filter: Whitelisting/Blacklisting ▪ DDos 공격보호를 위한 Client Connection 제한 가능 Query Firewall Filter Select from customer Where id = 5:SELECT * FROM CUSTOMERS; MaxScale 1 3 2 Client Query failed: 1141 Error: Required WHERE/HAVING clause is missing Error SQ L
  • 9. 특징 유연성 Content Aware(강화된 Proxy기능) ▪ 서버의 요구내용 인식 ▪ 서버의 구성 및 상태 인식 Query Routing ▪ Load balancing: 트랜잭션 로드밸런싱과 모니터링 ▪ Read/Write 분할처리 Replication ▪ Large Master-Slave구조에서 고성능 복제(Binlog서버) Multi-tenant Database Scaling ▪ Schema sharding을 위한 분산처리 지원 Read Write
  • 10. 특징 고가용성(HA) SPOF없는 고가용성 지원 Ensure database uptime ▪ 자동 Fail-Over ▪ New Master로 Slave들의 Master정보 변경. ▪ Master가 Fail상태일때도 Read Transaction 지원 Minimize database downtime ▪ 사용자 영향 없이 DB upgrade 지원 ▪ Tee-filter 통해 쿼리 복제하여 신규DB로 전송 Master script master_down event Failover Script CHANGE MASTER to new master; START SLAVE Slaves STOP SLAVE Promote as master binlog cache 1 4 3 2 4
  • 11. 특징 데이터 스트리밍 Slaves Binlog, Avro, JSON Master MaxScale Binary log events Avro or JSON events 실시간 분석을 위해서 data lake에 트랜잭션 데이터 스트리밍 제공. ▪ Binary Log Event에서 변경데이터를 캡처하고 이를 AVRO or JSON형식으로 변환하여 이를 실시간으로 Kafka broker통해 하둡, 카산드라 같은 빅데이터 플랫폼에 데이터를 제공하는 Producer역할 수행 Data Warehouse Slaves Binlog, Avro, JSON
  • 12. 라이센스 BSL (Business Source License) ▪ Maxscale 2.0 ~ 2.0.4 은 BSL 1.0 적용 ▪ BSL은 Closed Source 또는 Open Core 라이센스 모델의 새로운 대안입니다. BSL에서 소스 코드는 항상 자유롭게 사용할 수 있으며 특정 시점 (즉, 변경 날짜)에 오픈 소스가 될 수 있습니다. BSL의 특정 수준 이하의 사용은 항상 완전 무료입니다. 지정된 수준 (고급 사용자) 이상으로 사용하면 변경 날짜까지 공급 업체 라이선스가 필요하며 이 시점에서 모든 사용은 무료가 됩니다. (참고 https://mariadb.com/bsl-faq-mariadb ) ▪ BSL 적용받는 또다른 Project들은? + MariaDB ColumnStore Backup Restore Tool + MariaDB ColumnStore MaxScale CDC Data Adapter ▪ + MariaDB ColumnStore Kafka Data Adapter ▪ + MariaDB Kubernetes Operator https://mariadb.com/projects-using-bsl-11/ ▪ 약은 약사에게~, BSL라이센스는 MariaDB에게~
  • 13. 라이센스 GA Latest Releases (2019-07-20 현재) • MaxScale 2.3.9 : 2019-07-04 • MaxScale 2.2.21 : 2019-05-08 √ • MaxScale 2.1.17 : 2018-05-16 • MaxScale 2.0.6 : 2017-06-14 • MaxScale 1.4.5 : 2017-02-01
  • 14. 아키텍처 Applications Containers MariaDB Platform MariaDB MaxScale CDC MariaDB Server InnoDB + MyRocks MariaDB Server ColumnStore Transactional Analytical Kubernetes (Helm) Docker (Compose) C JDBC ODBC Node.js Ingest streaming data Kafka connector Administration SQL Diagnostic Manager SQLyog MariaDB Backup MariaDB Flashback Import bulk data Spark connector C/Java/Python API
  • 15. 아키텍처 MaxScale • Threading • Logging • Plugin loading • Lifetime management APIs Protocol Authenticator Filter Router Query Classifier Monitor … … … … … … MariaDBClient MySQLAuth DBFwfilter ReadWriteSplit qc_sqlite MariaDBMon • REST-API (8989) • Admin Functionality • etc. Core Utility maxadmin maxbinlog check MaxCtrl
  • 17. 아키텍처 객체 설명 종류 비고 Protocol 서버간 통신. mariadbclient mariadbbackend Filter Router앞에서 Request에 대한 정보 거부,처리,변경,기록. dbfwfilter cache regexfilter qlafilter [section가능] Routers Request의 특성에 따라 백엔드로 라우팅 제공. readconnroute readwritesplit Monitor 특정 클러스터상태, 라우팅 상태 등을 모니터링, failover. mariadbmon, mysqlmon galeramon, mmmon auroramon, csmon [section가능] Server 백엔드 서버정보 사용자정의 [section가능] Service 데이터베이스 추상화 집합(like single database) 사용자정의 [section가능] Listener MaxScale이 수신대기 포트정보. 리스너에 연결된 서비스로 전달. 사용자정의 [section가능] * section : maxscale config상의 단위 https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios 구성요소 (버전간 다소 차이가 있어요.) module
  • 18. 아키텍처 객체 설명 주요 옵션 Readconroute 매개변수/가중치에 따른 가벼운 로드밸런서. router_options (master,slave, synced, ndb,running) Readwritesplit 클러스터의 일관성을 유지하면서 읽기/쓰기 분산 로드밸런서. router_options ( 많아요 ^^;;) Binlogrouter Master와 Slave사이에서 복제 프로토콜 프록시 모듈. binlogdir Avrorouter Master or Binlogserver로부터 avro 형식파일로 자동변환 후 CDC 프로토콜에 응답가능. avrodir (https://avro.apache.org/docs/current/) Cli maxadmin cli interface SchemaRouter 데이터베이스 기반 샤딩, ignore_databases HintRouter 힌트에 따른 패킷 라우팅 ?? beta버전….(introduced in 2.2) debugcli port=4442, protocol=telnetd (admin / mariadb) cat 모든 서버에 명령을 라우팅. 실험용. * section : maxscale config상의 단위 https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios Router (버전간 다소 차이가 있어요.)
  • 19. 아키텍처 객체 설명 주요 옵션/비고 namedserverfilter 패치되는 패턴에 일치하는 SQL을 특정 Server로 라우팅. match= *from *users qlafilter 세션별로 모든 SQL 기록. match=select.*from.*customer.*where regexfilter 매치되는 패턴에 대한 SQL 변경. 정규식 String을 replace 처리. match=TYPEs*= replace=ENGINE= tee 매치되는 패턴에 대한 SQL의 이중으로 복사 전송. match=insert[ ]*into[ ]*orders topfilter 매치되는 패턴에 대한 모니터링(보고서). filebase = 경로 dbfwfilter 매치되는 패턴에 대한 SQL 차단. rules = role1.cnf mqfilter RabbitMQ 필터. 정규화된 SQL/응답을 RabbitMQ 브로커로 푸시. Filters @ 복수의 필터적용은 ‘|’ 사용 filters = top | qlafilter
  • 20. 아키텍처 객체 설명 주요 옵션/비고 소개(버전) ccrfilter 일관된 주요읽기 수행제어. 주요하지 않는 읽기는 스케일아웃. match =. * INSERT. * 2.1 insertstream 트랜잭션에 다수의 INSERT문을 LOAD DATA LOCAL INFILE~로 변환 2.1 실험용 masking 특정 컬럼의 반환값을 마스킹처리. rules = rule2.cnf 2.1 luafilter lua 스크립트에서 일부 함수를 호출하는 필터. 2.1 실험용 maxrows 결과셋으로 전달되는 rows를 제한하는 필터. max_resultset_size=64Ki 2.1 tpmfilter 트랜잭션 성능 모니터링 필터 filename=tpm.log 2.1 cache select 결과값에 대한 캐싱후 제공. max_count = 1000 2.1 binlogfilter 빈로그 복제처리의 필터링 처리.(match or exclude) exclude=/[.]orders/ 2.3 comment 요청 SQL에 주석 삽입. inject="IP=$IP" 2.3 throttlefilter 세션의 최대쿼리빈도 (초당 쿼리 수)를 구성가능한 값으로 제한에 사용 max_qps = 500 2.3 Filters( After 2.1)
  • 22. 설치 https://mariadb.com/downloads/#mariadb_platform-mariadb_maxscale MariaDB MaxScale 선택 설치하고자 하는 버전 선택 MaxScale를 설치하려는 OS 플랫폼 선택 원하는 버전 혹은 설치종류가 없을 경우 (rpm/binary)
  • 23. 설치 • 미리 download 한 RPM 패키지 혹은 yum repository를 구성하여 install • MaxScale이 DB에서 사용 할 유저 생성 • Configure 설정 (사용 할 port 방화벽 open)  기본 /etc/maxscale.cnf • MaxScale 기동 https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-installation-guide/ # rpm -ivh maxscale-2.3.9-1.centos.7.x86_64.rpm # curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash # yum install maxscale* MariaDB [(none)]> create user '[user]'@'[host]' identified by '[password]'; MariaDB [(none)]> grant select on mysql.user to '[user]'@'[host]'; MariaDB [(none)]> grant select on mysql.db to '[user]'@'[host]'; MariaDB [(none)]> grant select on mysql.table_priv to '[user]'@'[host]'; MariaDB [(none)]> grant show databases, replication_client on *.* to '[user]'@'[host]'; # service maxscale start # systemctl start maxscale
  • 24. 기본 환경구성(/etc/maxscale.cnf 예시) https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios/ [maxscale] threads=auto [Write service] type=service router=readconnroute router_options=master servers=DB1,DB2,DB3 user=max passwd=maxscalePW [DB1] type=server address=192.168.0.100 port=3306 protocol=MySQLBackend user=max passwd=maxscalePW [DB2] … [DB3] … [DB Monitor] type=monitor module=mysqlmon servers=DB1,DB2,DB3 user=max passwd=maxscalePW monitor_interval=60000 [MaxAdmin] type=service router=cli [maxadmin listener] type=listener service=MaxAdmin protocol=maxscaled socket=default 각 섹션 별 maxscale.cnf 예시 [ ] = 섹션(정해진 것이 아닌 임의의 지정) [Listener] type=listener service=Write service protocol=MySQLClient port=3306 address=0.0.0.0
  • 25. Configure Concepts https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios/#concepts Glossary Word Description connection routing MariaDB MaxScale이 클라이언트의 연결을 수락하고 단일 연결을 사용하여 해당 연결의 데이터를 단일 데이터베이스로 라우팅하는 요청을 처리하는 방법 statement routing 연결 내의 각 요청을 개별적으로 처리하는 방법 module 별도의 코드 엔티티, MariaDB MaxScale에 동적으로 로드되어 사용 가능한 기능을 향상 connection failover MariaDB MaxScale과 데이터베이스 서버 간 사용되는 연결이 실패하면 클라이언트의 개입없이 MariaDB MaxScale에 의해 다른 서버로 자동 대체 backend database MariaDB MaxScale 뒤에 위치하며 MariaDB MaxScale을 통해 응용 프로그램에 의해 액세스되는 데이터베이스를 지칭하는 용어 REST API HTTP 관리 인터페이스
  • 26. Configure Concepts https://mariadb.com/kb/en/mariadb-maxscale-23-mariadb-maxscale-configuration-usage-scenarios/#objects Objects Section Description Server MariaDB MaxScale을 통해 클라이언트를 연결할 수 있는 개별 데이터베이스 서버 Protocol MaxScale과 MaxScale 클라이언트 또는 MaxScale에 노출 된 서버 간의 통신을 담당 Monitor 특정 종류의 클러스터 상태를 모니터링하고 MaxScale의 라우터에서 해당 상태를 사용할 수 있게 함 Filter MaxScale의 요청 처리 라우터 앞에 위치하여 요청에 대한 정보를 거부, 처리, 변경 또는 기록 Router 요청의 특성 또는 라우터가 구현하는 알고리즘에 따라 요청을 backend 서버로 라우팅 (readconnroute / readwritesplit 등) Service 데이터베이스 집합을 추상화하여 클라이언트에 단일 데이터베이스로 표시 Listener MaxScale이 수신 대기하는 포트를 정의. 당 포트에 도착한 연결 요청은 리스너가 연결된 서비스로 전달 Status Description Running 정상 상태 Master Master 서버를 표시 Slave Slave 서버를 표시 Maintenance 점검이 필요한 상태 (서버에 연결이 되지 않고 수동으로 켜지지만 어떠한 이유로 연결이 차단 됨) Slave of External Master 모니터링 되지 않는 slave
  • 28. 운영 • maxadmin 사용을 위한 configure 설정 • Maxadmin cli 접속 • Command 확인 [MaxAdmin] type=service router=cli [MaxAdmin Unix Listener] type=listener service=MaxAdmin protocol=maxscaled socket=default # maxadmin MaxAdmin> # maxadmin MaxAdmin> help
  • 29. 운영 • Linux shell 에서 maxadmin cli에 접속하지 않고도 maxctrl 명령으로 동일한 요건 수행 가능 • maxctrl은 REST-API 와 통신. • maxadmin의 대체용. Ex) # maxctrl list servers # maxctrl list listener Etc.
  • 30. 성능 MaxScale 2.0.5 (up to) Hardware: Two physical servers, 16 cores / 32 hyperthreads, 12 8GB RAM and an SSD drive, connected using GBE LAN. One ru ns MaxScale and sysbench, the other 4 MariaDB servers setup a s Master and 3 Slaves. Workload: OLTP read-only, 100 simple selects per iteration, no transaction boundaries. ● direct: Sysbench uses all servers directly in round-robin fashion. ● rcr: MaxScale readonnroute router. ● rws: MaxScale readwritesplit router. https://www.slideshare.net/MariaDB/m18-maxscale
  • 31. 성능 https://www.slideshare.net/MariaDB/m18-maxscale MaxScale 2.1.0 ● The architectural changeth at allowed the removal of a l arge number of locks provide d a dramatic improvement for readconnroute. ● No change for readwritesplit. ● With small number of clients the introduced cache improved the performance, with large number no impact.
  • 34. • 2.1.2 및 이전 버전에서는 configure 파일 작성 시 한 줄에 1024 자로 제한 ― MaxScale 2.1.3에서 16384 자로 증가 ― MaxScale 2.3.0은이 제한을 16777216 자로 증가 • 2.2.12 및 이전 버전에서는 configure 파일의 섹션 이름이 49 자로 제한 ― MaxScale 2.2.13에서 1023 자로 증가 제한사항 • Maxscale의 parser는 WITH 구문을 올바르게 구문 분석하지만, WITH 절을 정의하는 SELECT에 사용 된 열, 함수 및 표를 수집하지 못함 • 결과적으로 데이터베이스 방화벽은 WITH 절의 SELECT가 금지 된 열을 참조하는 WITH 문을 차단하지 않음 Security (MariaDB 10.2 사용 시) Configure
  • 35. • XA트랜잭션 탐지 불가 ― XA 명령은 알 수 없는 명령으로 처리 ― 데이터베이스를 잠재적으로 수정할 수 있는 작업으로 취급(readwritesplit 일 경우, 마스터로 라우트 됨) ― XA 트랜잭션 내부에서 수행 된 SELECT 쿼리는 XA 트랜잭션의 일부가 아닌 서버로 라우팅 ― XA 트랜잭션 수행 시 auto commit을 비활성화 하여 수행가능 제한사항 • prepared statement를 사용하여 autocommit 모드 변경 시 문제 발생 ― 모드 변경이 되어도 maxscale은 이를 인지하지 못함 Prepared Statements Query Classification SET autocommit=0; XA START 'MyXA’; INSERT INTO test.t1 VALUES(1); XA END 'MyXA’; XA PREPARE 'MyXA’; XA COMMIT 'MyXA’; SET autocommit=1; set autocommit=1 PREPARE hide_autocommit FROM "set autocommit=0" EXECUTE hide_autocommit  변경 되었으나 인지하지 못함
  • 36. • MySQL / MariaDB 프로토콜 지원의 한계 (MariaDBClient) ― Compression은 Server handshake에 포함되지 않음 ― KILL QUERY ID <query_id> 유형 문을 지원하지 않음 (DB에서 직접실행 해야 함) ― KILL 명령은 비동기적으로 실행되고 결과는 무시되므로 사용자는 권한이 없어도 성공한 것처럼 보여짐 제한사항 • GSSAPI authenticator 제한 ― backend 연결이 GSSAPI 인증을 사용할 때만 GSSAPI 인증을 지원 ― 다른 backend 인증 모듈을 사용하는 클라이언트 측 GSSAPI 인증은 지원되지 않음 • MySQL authenticator (MySQLAuth) 제한 ― MySQL 구형 패스워드는 지원되지 않음 (MySQL 4.1 버전 이상의 인증 프로토콜 사용) ― 사용자가 연결할 호스트에 따라 다른 암호를 사용하는 경우 MariaDB MaxScale은 백엔드 데이터베이스에 연결할 때 사용해야하는 암호를 다 르게 인식하지 못함 (연결이 실패되고 사용자이름을 사용할 수 없음) ― 넷마스크 설정 시, 0 또는 255만 지원 (ex. 255.255.255.0 = 가능 / 255.255.255.192 = 미지원) Authenticator Protocol
  • 37. • Database Firewall 제한 (dbfwfilter) ― 다중 명령문을 지원하지 않음 (클라이언트에 오류가 전송됨) • Tee filter 제한 (tee) ― binary protocol prepared statements를 지원하지 않음. The execution of a prepared statements through a service that uses the tee filter is not guaranteed to succeed on the service where the filter branches to as it does on the original service. ― binary protocol prepared statements 구문이 server-generated ID로 식별 됨. The ID sent to the client from the main service is not guaranteed to be the same that is sent by the branch service. 제한사항 • 하나의 모니터만 사용 가능 ― 동일 서버를 두대이상에서 모니터링할 경우 오류로 간주됨 • Galera Cluster 모니터링 제한 (galeramon) ― wsrep_local_index를 기반으로 기본 Master가 선택 됨 ― 서버 우선 순위 메커니즘의 영향을 받을 수 있음 Monitor Filter
  • 38. • Avrorouter 제한 (avrorouter) ― avrorouter는 다음 데이터 유형, 변환 또는 SQL 문을 지원하지 않음: BIT, 정수 유형에서 문자열 유형으로 CAST 함수, CREATE TABLE ... AS SELECT 구문 ― avrorouter는 어떤 충돌 복구도 하지 않음. 즉, avroouter를 시작하기 전에 avro 파일을 유효한 블록 길이로 잘라 사용해야 함 ― binlog checksum을 지원하지 않음. • connection router 제한 (readconnroute) ― LOAD DATA LOCAL INFILE 로 binary data를 송신을 지원하지 않음 • Read/Write Splitter 제한 (readwritesplit) ― 마스터 서버로 라우팅 되는 쿼리: open transaction 내에서 쿼리가 실행 된 경우 : 구문에 저장 프로시저 또는 UDF 호출이 포함되어 있는 경우 : 하나의 쿼리 안에 여러 개의 명령문이 있는 경우 ― Readwritesplit은 JDBC 배치 명령문의 파이프 라이닝을 지원하지 않음 ― multi-statement 쿼리가 readwritesplit 라우터를 통해 실행되면 항상 마스터로 라우팅 ― 다중 명령문 쿼리 내에서 LOAD DATA LOCAL INFILE 문을 실행 불가 (MaxScale hang issue) ― USE <db name> 및 SET autocommit = 0이 포함한 몇몇의 쿼리는 복사본을 각 백엔드 서버로 보내고 마스터의 응답을 클라이언트에 전달 ― use_sql_variables_in 매개 변수를 all로 설정하면 SELECT 쿼리가 사용자 변수를 수정하면 라우팅되지 않고 클라이언트가 오류를 수신 제한사항 Router
  • 40. Router • Case ) 전통적인 물리장비(L4)의 대체. [A Service] type=service router=readconroute servers=srv1,srv2,srv3,srv4…. router_options=running #(master, slave, synced, ndb, running) • Case ) Readwritesplite 통한 Master/Slave구조의 지능적인 분산처리. [Split-Service] type=service router=readwritesplite servers=srv1,srv2,srv3,srv4 • Case ) Backend 정보의 은닉 / 보안강화 #maxscale ip – 10.10.10.1 # grant all privileges on *.* to ‘appuser’@’ 10.10.10.1’; [A Service-Listener] type=listener service=A Service protocol=MariaDBClient port = 43306 [srv1] type=server address=20.20.20.1 protocol=MariaDBBackend port = 3306
  • 41. HA • Case ) 다양한 Cluster구성에 대한 지원. #mariadbmon : Master-Slave Replication Cluster’s Monitoring #mmmon : Multi-Master Replication Cluster’s Monitoring(deprecatred) #galeramon : Galera Cluster Monitoring • Case ) Master Node 장애에 대한 Auto-Failover. [MyMonitor] type=monitor module=mariadbmon servers=server1,server2,server3 monitor_interval=2000 #2sec failcount=5 auto_failover=true #master ha auto_rejoin=true #slave join #events=master_down, slave_down #script=
  • 42. Flexibility & Scalability • Case ) Tee Filter를 통한 신규 version에 대한 검증 [A-Service] type=service router = readconroute filters=NewDBClone [NewDBClone] type=filter module=tee service=NewDB [NewDB] type=service router = readconroute servers = newsrv1, newsrv2 Case ) schmearouter를 통한 단순 Database 샤딩. [Shard-Router] type=service router=schemarouter servers=server1,server2 • Case ) binlogrouter를 통한 binlog Server role. [Replication] type=service router=binlogrouter user=maxscale password=maxpwd server_id=3 binlogdir=/var/lib/maxscale/ mariadb10-compatibility=1
  • 44. 적용사례 • Galera Cluster의 Routing Solution module=galeramon disable_master_failback=0|1 • ColumnStore 서비스의 Routing Solution • Master/Slave 구조에서의 Routing & HA Solution • Readwritesplite Router를 통한 Read Only와 Write Transaction 지능적인 분산처리. But~ • QueryLogFilter 통해서 Request에 대한 모든 SQL문을 기록해보자~(for ISMS). OMG, 로그파일이 각 세션별로 만들어져요~^^;; • 많은 모듈에 적용되는 필터링에 대한 정규표현식이 익숙하지 않아서~. Maxscale은 정규표현식에 PCRE2 (Perl-Compatibility Regular Expression)라이브러리를 사용합니다. https://www.pcre.org/current/doc/html/pcre2syntax.html • 계정 사용시 root는 사용하지 마세요. enable_root_user = 1 • Backend Server의 계정추가후 MaxAdmin 에서 maxadmin>reload dbusers 수행 필요. ( auth fail후 30초 마다 갱신)
  • 45.
  • 46. docker 구축방법, readwritesplit multi user? • Docker 이용 https://hub.docker.com/r/mariadb/maxscale/ • 인증/권한 - MaxScale 설치 host에 대한 권한 부여. - 계정 / 비번 서버마다 모두 동일해야 함.( Only one) https://mariadb.com/kb/en/mariadb-maxscale-22-mariadb-maxscale-configuration-usage-scenarios/#authentication
  • 47. 성능 , Transaction Routing • 성능 2.1에 성능이 많이 개선된 거 같아요. 2.2 추천. 2019.07.24 현재 GA버전 2.2.21 2.3.9 • Transaction Routing MaxScale도입 전에 반드시 서비스되는 SQL패턴을 인지하고 MaxScale 제약사항에 해당되는 부분이 없는지 확인해야 합니다. 반대로 Maxscale 구성 이후에 신규 작성하는 SQL/PROJECT라면 개발가이드에 MaxScale 제약사항을 배포하는게 좋겠어요.
  • 48. CDC, LB, HA • CDC https://mariadb.com/resources/blog/streaming-data-from-mariadb-server-into-mariadb-columnstore-via-mariadb-maxscale/ • Load-Balancing [RW Service] type=service weightby=rw_weight … [server1] type=server rw_weight=(가중치 수) • HA KeepAlived 이용 (https://mariadb.com/resources/blog/maxscale-ha-setup-using-keepalived-and-maxctrl/) pacemaker & corosync 이용 (https://mariadb.com/kb/en/mariadb-maxscale-22-how-to-make-mariadb-maxscale-high-available/)

Editor's Notes

  1. 취약한 시스템통합이나 DB 처리시간이 증가한다면, 고객이 실시간으로 제품을 구매하거나 쇼핑하기가 힘들겁니다. 특히 분석 처리는 운영프로세스 FLOW와 통합하는데 어려움이 있습니다. 이렇게 급변하는 환경변화에 적응하기 위해서 프로그램 개발자는 지속적으로 신규기술과 Application을 개발해야 합니다. 개발자나 DBA나 여러가지 고민거리가 생깁니다. 웹 어플리케이션에서 다양한 이기종 데이터베이스에 걸쳐서 수행되는 높은 트래픽이나 빈번한 트랜잭션을 가지는 미션 크리티컬한 작업들이 점점 증가하고 있습니다. 개발자나 DBA는 고객수요를 만족시키면서 사용자 서비스에 영향없이 운영중인 데이터베이스를 확장해야 합니다.
  2. Maxscale은 이렇게 Application과 Database사이에 위치하며 운영시스템에 유연성을 제공합니다.
  3. Maxscale은 현재 MySQL, MariaDB, Percona Server for MySQL, ClustrixDB 를 지원하고 있습니다.
  4. Maxscale은 Database Proxy 입니다. DB와 Application을 완전히 분리해서 Application에 영향을 주지않고, Application은 DB를 영향받지 않으면서 플러그인 아키텍처를 통해서 유연성을 확장할 수 있습니다. Maxscale은 보안성, 유연성, 고가용성, 데이터스트리밍의 4가지 핵심적인 특징을 가진 장점을 제공합니다.
  5. Maxscale은 3가지 상태에 대해 데이터를 보호합니다. Data in Motion 데이터가 네트워크를 통해 이동중일때, 위협에 노출되는 문제를 방지하기 위해서 데이터를 안전하게 서버 어플리케이션에서 이동할 수 있도록 end-to end SSL 기능을 제공합니다. Data in Use 데이터가 사용 중 일때, 주요관심사는 Access 제어입니다. MaxAdmin 보안은 공격자가 Maxscale구성 정보의 손상이나 백엔드 DB서버의 접속정보에 엑세스 하지 못하도록 합니다. Data at Rest 데이터 저장상태의 경우, 잠재적인 공격으로부터 보호할 필요가 있습니다. SQL-Injection공격을 방어하기 위해서, Maxscale은 Whilelist와 Blacklist 기능 모두를 제공합니다. 또한 DDoS공격방어를 위해서, 연결비율 제한 기능을 제공합니다. (Backend DB로 고정된 Connection수 구성가능) 필터링 - 규칙에 일치하는 쿼리 - 특정사용자가 규칙에 일치하는 쿼리 - 특정패턴에 일치하는 쿼리 우측 그림을 통해서 전형적인 SQL-Injection 유형을 볼 수 있습니다. 공격자는 모든고객정보를 빼내기 위해서 sub select 쿼리를 삽입하려고 합니다. 이런유형은 보통 보안위협 뿐 아니라, 성능문제를 일으킬수 있습니다. Whilelist/Blacklist를 통해서 Maxscale은 높은 보안위협수준을 제공합니다. 대량의 데이터 Access방지, MaxScale는 엔드 – 투 – 엔드 SSL 네트워크 레이어 암호화를 제공합니다 – 이는 승인되지 않은 데이터의 잡아 쿼리 및 데이터 패킷을 스니핑하는 해커를 방지 할 수있다.
  6. Maxscale은 이러한 확장요구를 위해서 3가지 유형을 제공합니다. Query Routing - 로드밸런싱 – Maxscale은 서버의 트랜잭션 부하를 모니터링하고 부하를 조절합니다. - 동적쿼리 라우팅 – DB서버 상태뿐 아니라 쿼리타입을 기준으로 성능확장을 위해서 적절한 서버로 쿼리를 라우팅 합니다. 이런방식으로 우리는 어플리케이션 레이어의 변경없이 DB를 확장할 수 있습니다. - 트래픽 프로파일 기반 라우팅 – 온라인 어플의 쿼리면 Master로, 보고용이면 Slave 쿼리를 전송합니다. Replication(Binlog Server기능) Master의 부하증가없이 다수의 slaves에 Replication을 구성하기 위한 Binlog Server기능을 제공합니다. 예를들어 Booking.com은 Binlog Server에 Slave로 25대를 Slave로 구성하여 총 1000대의 서버를 운영하고 있다고 합니다. Multi-tenant Database Scaling 각 테넌트는 자신의 스키마 샤드를 가지며, 기존 사용자기반에 영향없이 DB나 데이터 볼륨 증가에 따라 DB를 확장할 수 있습니다. Maxscale이 Schema Sharding Router역할 수행합니다. Maxscale 7개의 Filter 모듈 제공 1. Named Server Filter : 규칙적인 표현 매칭되는 쿼리 라우팅 2. Query Log ALL Filter(QLA) : 모든 쿼리 로깅 3. Regex Filter : 정규표현 매칭(5.1의 type 키워드를 Engine 키워드로 rewirte 시 유용) 4. Tee Filter : 쿼리복사본을 만들어 다른서비스로 전달용 필터(신규버전 db의 성능/기능 test에 유용). 5. Top Filter : 모든 쿼리문중 소요시간 top n개 모니터링용 필터. 6. Database Firewall Filter : 방화벽 규칙 통한 쿼리차단용 필터.(Access 제한) 7. RabbitMQ Filter : 쿼리를 추출하고 이를 표준형태로 변환하는 필터.
  7. Maxscale은 단일고장점 없이 100% 운영할수 있는 고가용성 솔루션입니다. 자동 FailOver기능을 통해서 DB업데이트를 확인합니다. 이것은 Master가 Fail인경우, Master 장애를 감지하고 Slave를 Master로 승격시킵니다. 또한 모든 Slave들을 승격된 master를 가리키도록 합니다. Maxscale은 Active/Standby와 Active/Passive 구성을 지원합니다.(Maxscale이 2대 설치) 또한 신규버전의 성능과 기능의 검증을 위하여 사용자에게 업그레이드 하는 동안 동시에 현재버전을 운영해서 db downtim을 최소화 한다. Active/Standby – VIP통하여 Traffic을 제어합니다.(Active Maxscale, Standby Maxscale 둘다 실행중인 상태) Active/Passive – Active Maxscale 실행, Passive Maxscale 중지상태에서 Active fail이면 Passive가 corosync/pacemaker에 의해 시작됨.
  8. 이에 대한 해답은 역시 실시간 분석처리가 정답입니다. 실시간 분석만이 몇초/몇분안에 분석/보고/자동화/사업목적에 부합하는 지능적인 처리가 가능합니다. Maxscale은 이 데이터가 가지는 시간의 가치를 최대화 하기위해서 데이터 스트리밍 기술을 도입했습니다. Maxscale은 Kafka Producer에 바이너리 로그 이벤트를 복제합니다. 이 데이터는 기계학습(머신러닝)이나 실시간 분석을 위한 데이터로 활용될 수 있습니다. 또한 이기능은 어플리케이션 scale-out의 성능상 이점을 제공합니다. 예를 들어서 Booking.com은 Master 1대에 25대의 이상의 slave를 운영할때 mastger 노드를 오버로드해서 여러대의 binlog server 형태가 가능합니다. 이렇게 Booking.com은 Master와 Slave Node사이에 Maxscale을 통해서 복제부하를 줄였습니다.