SlideShare a Scribd company logo
1 of 72
MaxScale의 활용
㈜네오클로바
2023. 11
네오클로바 - 회사소개
업체명 ㈜ 네오클로바 대표자 이 재 중
홈페이지 www.neoclova.co.kr 대표전화 02-539-4880
사업 분야 오픈소스 기반의 유지보수, 컨설팅 / 전반 Linux OS, WEB, WAS, DBMS 분야 기술 지원 및 분석 지원 서비스
주소 서울시 강서구 양천로 583(염창동 240-21) 우림블루나인 B동 1206호
회 사 설 립 년 도 2011년 11월 7일
Next Opensource Cloud Value
MariaDB
MariaDB
MariaDB 는 개방성과 커뮤니티 보존을 위해
개발되었다. 그 결과 우리는 더욱 빠른 속도로
미래의 애플리케이션을 준비할 수 있게 되었다.
Michael “Monty” Widenius
설립자 & CTO of MariaDB
MySQL 의 창시자
오픈소스의 철학
“
”
MariaDB
MariaDB
뭐가 달라요?
https://github.com/dveeden/mysql-history-graph
뭐가 달라요?
▪ 아키텍처
• Thread 방식이에요
✔ Only mysqld process (cf. mysqld_safe)
• 기본적으로 Single Core로만 SQL을 처리해요
✔ 병렬(Parallel)처리를 지원하지 않아요
 Only MySQL
✔ 일부 DDL 병렬처리 기능이 도입되고 있어요
✔ innodb_ddl_threads (8.0.27 ~)
• Nested Loop 방식의 Join을 사용해요
✔ innodb_adaptive_hash_index (mysql enable, mariadb disable)
• 다양한 스토리지 엔진을 지원해요
• 복제기능이 내장돼 있어요
✔ Async/Semi-Sync Replication
✔ 비동기임을 감안해서 HA 구성하세요
• Scale-Out > Scale-Up
뭐가 달라요?
▪ General
• AUTOCOMMIT=TRUE
✔ 어플리케이션 CONNECTION 처리에 유의
✔ 빈번한 autocommit의 변경은 성능저하 원인
• EXPLAIN PLAN
✔ 실행계획을 저장/재사용 하지 않아요
• QUERY (RESULTS) CACHE
✔ SQL 수행결과의 캐싱
✔ 지원여부는 버전별로 차이가 있어요. (MySQL 5.7.20~ deprecated)
• default ISOLATION LEVEL
✔ REPEATABLE-READ
✔ READ-COMMITTED 권고 (Oracle, SQLServer)
• Community vs Commercial
✔ 지원하는 기능이 달라요( storage engine )
✔ MySQL vs MariaDB vs Percona Server for MySQL
뭐가 달라요?
▪ 스키마
• 스키마는 데이터베이스와 동의어로 취급해요
✔ 인스턴스 > 데이터베이스 > 스키마 > 테이블
✔ 인스턴스 > 데이터베이스(스키마) > 테이블
• 서로 다른 데이터베이스의 테이블 간에도 조인이 가능
✔ 따라서 개념은 schema에 가까워요
• 소유자(owner) 개념은 없어요
• show databases , show schemas
• system schema
✔ mysql
✔ information_schema
✔ performance_schema
✔ sys
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
mysql> show schemas;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
뭐가 달라요?
▪ Tablespace (innodb)
• System Tablespace
✔ ibdataN~
✔ 하나 이상의 파일로 구성
✔ 8M단위로 자동 확장
• Table당 Tablespace
✔ Table당 파일이 생성 (innodb_file_per_table)
✔ 파티션시 개별 파티션 별로 파일이 생성 되요
✔ 미리 늘려 놓을 수 없어요 (자동 확장이 되요)
• General Tablespace (Only MySQL)
✔ 오라클처럼 여러 테이블을 하나의 Tablespace에
저장할 수도 있어요
✔ 인덱스를 별도 Tablespace에 분리 할 수는 없어요
• Undo Tablespace
• Temporary Tablespace
뭐가 달라요?
▪ Table
• General
✔ 테이블별로 다른 스토리지 엔진을 사용할 수 있어요
✔ 테이블별로 압축을 제어할 수 있어요
✔ Page수준 암호화 지원, 플러그인 (컬럼 암호화 아님)
✔ 대소문자 구분 활성화/비활성 할 수 있어요 (초기화 시점에 적용 가능)
✔ Table에 PK/UK로 AUTO_INCREMENT 컬럼을 1개 만들 수 있어요
✔ PRIMARY KEY 순서로 테이블에 저장을 해요
✔ 원격지 테이블 / 파일등에 연결 할 수 있어요 (federated , connect)
✔ 테이블을 삭제해도 권한이 취소되지 않아요 (명시적인 REVOKE 필요)
• InnoDB 제한( 16K page, row_format=DYNAMIC )
✔ 최대 크기 : 64T
✔ 최대 컬럼 수 : 1017개
✔ 최대 행 크기 : 65535 Bytes (기본 + 오버플로 페이지)
✔ 기본 페이지 : 8126 Bytes (255byte 이하 컬럼들 합)
mysql [test]> show create table t1G
*************************** 1. row
***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`nm` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL,
`rrno` varchar(13) COLLATE utf8mb4_bin NOT NULL,
`srv_yn` varchar(1) COLLATE utf8mb4_bin NOT NULL,
`reti_dt` varchar(8) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `rrno` (`rrno`,`srv_yn`,`reti_dt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_bin
1 row in set (0.001 sec)
mysql [test]> show global variables like
'innodb_default_row_format';
+---------------------------+---------+
| Variable_name | Value |
+---------------------------+---------+
| innodb_default_row_format | dynamic |
+---------------------------+---------+
1 row in set (0.001 sec)
뭐가 달라요?
▪ Table (중요)
• Basic
✔ page size default 16K vs Oracle/MSSQL/PostgreSQL 8K (innodb_page_size)
✔ 바꿀 수 있으나 바꾸지 마세요 (득보다 위험요소가 많아요)
✔ 크기는 미리 늘려 놓을 수 없어요 (자동확장이 되요)
✔ 테이블명에 대소문자 구분을 해요
• Primary Key
✔ 테이블 생성시 무조건 PK는 부여해 주세요 (복제지연(장애)과 성능저하의 원인이
됩니다)
✔ Oracle은 ROWID로 테이블과 인덱스가 연결되어 있지만, MySQL은 Primary key
로 연결돼 있어요
• Partition
✔ 개별 파티션별로 파일이 생성되요
✔ Local indexes on Partition만 지원해요
✔ 파티션 키 컬럼이 반드시 PK(UK)에 포함 되어야 해요
• CHARACTER SET / COLLATION
✔ Table/Column별 CHARSET 설정이 가능해요
✔ UTF8(utf8mb3), UTF8MB4(권고)
뭐가 달라요?
▪ Column
• AUTO_INCREMENT
✔ 테이블종속, 정수형, 자동증가
✔ PK, UK로 활용 하세요
✔ SERIAL = BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
• NULL
✔ 빈문자열 '' (Empty String) 과 NULL값은 달라요
✔ 인덱스 페이지에 값이 저장됨(인덱스 활용 가능)
✔ 정렬 시 선행 검색, 오라클은 후행 검색 되요
✔ NULL 여부를 위해서 1비트 추가 저장공간 소요
✔ 산술연산은 NULL, 그룹함수나 문자연결시에는 연산에서 제외
• COMPRESSED (Only MariaDB)
✔ 특정 컬럼만 압축이 가능해요(blob)
• Invisible ~, Generated ~ as ~,
✔ 빠르게 좋아지고 있어요
MariaDB [test]> select * from t1;
+------+------+------+
| id | no | nm |
+------+------+------+
| 1 | NULL | NULL |
| 2 | 100 | NULL |
| 3 | 200 | Lee |
+------+------+------+
3 rows in set (0.000 sec)
MariaDB [test]> select id, sum(no), min(nm)
from t1;
+------+---------+---------+
| id | sum(no) | min(nm) |
+------+---------+---------+
| 1 | 300 | Lee |
+------+---------+---------+
1 row in set (0.000 sec)
MariaDB [test]> select id, sum(no), max(nm)
from t1;
+------+---------+---------+
| id | sum(no) | max(nm) |
+------+---------+---------+
| 1 | 300 | Lee |
+------+---------+---------+
1 row in set (0.000 sec)
뭐가 달라요?
▪ Data Type
• 숫자형
✔ 정수형 세분화 지원(tinyint, smallint, mediumint, int, bigint)
✔ 부동소수점 값은 근사치로 반올림 처리에 유의 (FLOAT은 안쓰는 걸로!!)
• 문자열
✔ 가변길이는 1~2Bytes 추가 길이 필요 해요
✔ 길이단위로 해석, 단 이진문자열은 BYTE 단위
✔ UTF8 : 3BYTE, UTF8MB4 : 4BYTE
✔ 일반적으로 Character In-Senstive가 기본 Collation (utf8mb4_0900_ai_ci , utf8mb4_unicode_ci )
✔ 대체로 데이터 값의 뒤 공백을 제거하고 비교하나, COLLATION 마다 차이가 있음으로 확인필요 (PAD
속성)
• 날짜형
✔ DATE : '1000-01-01' ~ '9999-12-31'
✔ DATETIME : '1000-01-01 00:00:00.000000' ~ '9999-12-31 23:59:59.999999'
✔ TIMESTAMP: '1970-01-01 00:00:01.000000' ~ '2038-01-19 03:14:07.999999'
✔ TIME, YEAR
✔ Y2K38 (MySQL 8.0.28 fixed, MariaDB : https://jira.mariadb.org/browse/MDEV-32188 )
뭐가 달라요?
▪ Data Type
• JSON
✔ MySQL : RFC7159에 정의된 데이터유형 지원 ( JSON 객체)
✔ MariaDB : MySQL 호환성을 위한 LONGTEXT (JSON 문자열)
• 미지원
✔ XML
뭐가 달라요?
▪ VIEW
• Logical Table
✔ not supported MATERIALIZED VIEW
▪ ROUTINES
✔ security_type DEFINER/INVOKER – EXECUTE/~
• PACKAGE (Only MariaDB)
✔ MariaDB는 지원해요 (SQL_MODE=ORACLE)
• PROCEDURE / FUNCTION
✔ AS 키워드가 없어요
• TRIGGER
✔ DML_EVENT만 지원, DDL_EVENT/DATABASE_EVENT 미지원
✔ SQL문에 의한 테이블 변경시에만 활성화 됨
• EVENT
✔ ORACLE - scheduler
뭐가 달라요?
▪ SEQUENCE (Only MariaDB)
• AUTO_INCREMENT 대안
• 실제로는 InnoDB Engine (cf. Sequence Storage Engine – virtual dummy table)
• 사용법
✔ NEXT VALUE FOR sequence_name / NEXTVAL(sequence_name) / sequence_name.nextval
✔ PREVIOUS VALUE FOR sequence_name / LASTVAL(sequence_name) / sequence_name.currval
▪ Index
• Page 구조
✔ PRIMARY KEY : PK 컬럼 값들의 순으로 정렬된 테이블, PK 이름을 바꿀 수 없어요
✔ SECONDARY KEY : PK 값이 숨어 있어요 (ROWID 역할)
• Descending
✔ MySQL 8.0~, MariaDB 10.8~ 지원
✔ 이전 버전까지는 ASC로만 컬럼들 정렬해서 인덱스 생성
• FULL-TEXT Search
✔ NGRAM Parser (MySQL)
뭐가 달라요?
▪ Account
• user@host
✔ user가 접속하는 host까지가 계정정보
✔ 동일한 user라도 접속 host의 비번이 다를 수 있어요
• password management
✔ Validation Plugin을 통해서 제어
✔ MySQL / MariaDB 다름
• Drop user
✔ 소유한 객체가 있어도 삭제가 되거든요
✔ cascade 미지원
MariaDB [mysql]> show
tables;
+-----------------------
----+
| Tables_in_mysql
|
+-----------------------
----+
| column_stats
|
| columns_priv
|
| db
|
| event
|
| func
|
| general_log
|
| global_priv
|
| gtid_slave_pos
|
| help_category
|
| help_keyword
|
| help_relation
|
| help_topic
|
| index_stats
|
| innodb_index_stats
|
| innodb_table_stats
|
| plugin
뭐가 달라요?
▪ Standard SQL
• MySQL/MariaDB
✔ SELECT ~ INTO table 은 INSERT INTO table SELECT ~ 로 지원
✔ UPDATE t1 SET c1 = c1 +1, c2 = c1;
UPDATE t1 SET c2 = c1, c1 = c1 +1;
두 문장의 결과는 달라요
✔ FOREIGN KEY로 부모테이블의 UNIQUE/NOT NULL 조건이 아닌 인덱싱 컬럼도
지원
✔ 지원하는 주석처리
/*! ~~ */ (구문분석 수행)
#~
-- ~ (-- 다음 공백 있음)
✔ || (OR), && (AND)로 해석, 문자열 연결은 CONCAT() 이용
✔ TRIM()은 부분 문자열 제거 지원 (cf. Oracle – 단일문자 제거)
✔ LIMIT 절 (UPDATE ~ JOIN절의 경우는 LIMIT 사용불가)
✔ FROM절의 SUBQUERY내의 ORDER BY는 무시
✔ https://mariadb.com/kb/en/why-is-order-by-in-a-from-subquery-ignored/
select * from (
select id, nm, srv_yn, reti_dt
from t1
where rrno='23475296848'
order by srv_yn desc, reti_dt desc
limit 3
) A;
VS
select * from (
select id, nm, srv_yn, reti_dt
from t1
where rrno='23475296848'
order by srv_yn desc, reti_dt desc
) A
limit 3;
VS
select * from (
select id, nm, srv_yn, reti_dt
from t1
where rrno='23475296848'
) A
order by srv_yn desc, reti_dt desc
limit 3;
뭐가 달라요?
▪ Standard SQL
• SQL_MODE
✔ Strict Mode Disable 운영 시 느슨한 데이터 유효성 검사로 데이터 유실
될 수 있어요
• Hint
✔ 주석을 이용한 힌트 사용시에도 SQL 구문 오류가 발생 할 수 있어요
✔ 주석내의 코드에 대한 구문분석을 실행
Next Opensource Cloud Value
HA
(High Availability)
Replication
Binar
y log
Relay
log
I/O
thread
SQL thread
Primary Replica
Data changes
Write
Read
Replay
Binary log
dump thread
Write
Pacemaker
https://aws.amazon.com/ko/blogs/storage/deploying-self-managed-mariadb-high-
availability-using-amazon-ebs-multi-attach/
https://dev.mysql.com/blog-archive/mysql-now-provides-support-for-drbd/
Galera Cluster
Replication Topology
https://www.dsdata.es/images/skysql/High_Availablity_with_MariaDB_TX.pdf
MHA
Orchestrator / ProxySQL
MariaDB MaxScale
Next Opensource Cloud Value
MaxScale
MariaDB MaxScale
• DB Proxy
• BSL
• Query Routing
• MariaDB Monitoring
• Filter
• HA
MariaDB MaxScale
MaxScale
Monitor
Server State
Listener
Client
Server
Filter Filter Router
Service
MariaDB MaxScale
BSL (Business Source License)
Additional Use Grant: You may use the Licensed Work when
your application uses the Licensed Work with a total of
less than three server instances for any purpose.
https://mariadb.com/bsl-faq-mariadb/
* minor version마다 GPL2전환 시기 다름
MaxScale Router
• Readconnroute *
• Readwritesplit *
• Binlogrouter
• mirror
• SchemaRouter
• SmartRouter
• Kafka CDC
• Kafka Importer
https://mariadb.com/kb/en/maxscale-6-routers/
MaxScale Router
 ReadconnRouter
• router_options=master
• router_options=slave
• router_options=synced
• router_options=running
MaxScale Router
 ReadWriteSplit Router
MaxScale Router
 ReadWriteSplit Router
• autocommit=true (필수)
• max_slave_replication_lag (권고)
• Causal read (비권고)
MaxScale Filter
Hint *
Masking
Maxrows
Query Log All (QLA)
Top
MaxScale Filter
 Hint
• /* maxscale route to master */
• /* maxscale route to slave */
• /* maxscale route to server server3 */
• mariadb client --comments 주의
MaxScale Monitor
• MariaDB Monitor *
• Galera Monitor
• Aurora Monitor
• ColumnStore Monitor
MaxScale Monitor
 MariaDB Monitor
• Auto failover
• Auto rejoin
• Switchover
• Cooperative Monitoring
• extra_port
• L4 / JDBC설정
MaxScale Monitor
 cooperative
MaxScale Monitor
 auto failover
MaxScale Monitor
 Galera Monitor
• write(1), read(another)
• choose the node with the lowest wsrep_local_index value as the
master
MaxScale GUI
MaxScale REST API
• curl 127.0.0.1:8989/v1/servers
• curl 127.0.0.1:8989/v1/monitors
• maxctrl api get services data[].attributes.router_diagnostics
--pretty
• curl -X GET -u admin:mariadb http://127.0.0.1:8989/v1/servers
-i
https://mariadb.com/kb/en/maxscale-6-rest-api/
MaxScale Topology
VIP
MaxScale Topology
JDBC
Semi-Sync Replication
MaxScale Topology
L4
Semi-Sync Replication
MaxScale Topology
L4
Galera
MaxScale Topology
MaxScale Topology
Next Opensource Cloud Value
MaxScale
구성 및 운영
MaxScale 기본 환경구성 (maxscale.cnf 예시)
[maxscale]
threads =
auto
skip_name_resolve =
yes [Write-Listener]
type = listener
service = Write-
service
protocol =
MariaDBClient
port = 6033
[Write-service]
type = service
router =
readconnroute
router_options = master
servers =
DB1,DB2,DB3
[DB-Monitor]
type = monitor
module =
mariadbmon
servers =
DB1,DB2,DB3
user = max
passwd = maxPW
monitor_interval = 10
auto_failover = true
auto_rejoin = true
enforce_read_only_slaves =
true
servers_no_promotion =
DB3
[DB1]
type = server
address =
192.168.0.100
port = 3306
protocol =
MariaDBBackend
user = max
passwd = maxPW
[DB2]
...
[DB3]
...
[Split-Listener]
type = listener
service = Split-
service
protocol =
MariaDBClient
port = 6034
[Split-service]
type = service
router =
readwritesplit
servers =
DB1,DB2,DB3
max_slave_replication_lag
= 10s
use_sql_variables_in =
master
MaxScale Objects
Section Description
Server
MariaDB MaxScale을 통해 클라이언트를 연결할 수 있는 개별 데이터베이스 서버
서버 상태
• Running : 정상
• Master : Master 서버
• Slave : Slave 서버
• Maintenance : 수동으로 연결을 차단한 점검을 위한 서버
• Slave of External Master : 모니터링 되지 않는 Slave
Protocol MaxScale과 MaxScale 클라이언트 또는 MaxScale에 설정 된 서버 간의 통신을 담당
Monitor 특정 종류의 클러스터 상태를 모니터링하고 MaxScale의 Router에서 해당 상태를 사용할 수 있게 함
Filter MaxScale의 요청 처리 Router 앞에 위치하여 요청에 대한 정보를 거부, 처리, 변경 또는 기록
Router 요청의 특성 또는 Router가 구현하는 알고리즘에 따라 요청을 backend 데이터베이스 서버로 라우팅 (readconnroute / readwritesplit 등)
Service 데이터베이스 집합을 추상화하여 클라이언트에 단일 데이터베이스로 표시
Listener MaxScale이 수신 대기하는 포트를 정의하고 해당 포트에 도착한 연결 요청은 Listener에 연결된 Service로 전달
MariaDB 제약사항
• GTID (current_pos)
• log_slaves_updates
• Replication 구성
• extra_port
extra_max_connections
• 각 계정정보에 대해서 두세트의 권한부여가 필요함
usr1@client-host
usr1@maxscale-host
Monitor 제약사항
• mariadbmon 은 복제지연이 발생할 수 있음
• 하나의 모니터만 사용 가능
• 동일 서버를 두대이상에서 모니터링할 경우 오류로 간주됨
• Galera Cluster 모니터링 제한 (galeramon)
• wsrep_local_index를 기반으로 기본 Master가 선택 됨
• 서버 우선 순위 메커니즘의 영향을 받을 수 있음
• disable_master_failback = 1
Read/Write Splitter 제약사항
• 마스터 서버로 라우팅 되는 쿼리
• open transaction 내에서 쿼리가 실행 된 경우(autocommit=0)
• 구문에 저장 프로시저 또는 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 쿼리가 사용자 변수를
수정하면 라우팅되지 않고 클라이언트가 오류를 수신
transaction 제약사항
• XA트랜잭션 탐지 불가
• XA 명령은 알 수 없는 명령으로 처리
• 데이터베이스를 잠재적으로 수정할 수 있는 작업으로 취급
• readwritesplit 일 경우, 마스터로 라우트 됨
• XA 트랜잭션 내부에서 수행 된 SELECT 쿼리는 XA 트랜잭션의 일부가 아닌 서버로 라우팅
• XA 트랜잭션 수행 시 auto commit을 비활성화 하여 수행가능
• Prepared Statement
• prepared statement를 사용하여 autocommit 모드 변경 시 문제 발생
• 모드 변경이 되어도 maxscale은 이를 인지하지 못함
MaxScale 구성 제약사항
• connection_timeout vs wait_timeout
• log_info = false | true , log_debug = false | true
• skip_name_resolve = true
• extra_port (in server)
• max_slave_replication_lag
• maxkeys 권고
• /etc/logrotate.d/Maxscale_rotate
MaxScale 운영 제약사항
• 신규 계정 추가
• Backend Server의 계정추가 후 MaxAdmin 에서 reload dbusers 수행 필요
• users_refresh_time=30s
MaxScale maxctrl
• maxctrl --help
• maxctrl list servers
• maxctrl show monitors
• maxctrl list sessions
• maxctrl call command mariadbmon release-locks
MyMonitor1
• maxctrl call command mariadbmon switchover MariaDB-
Monitor
• maxctrl set server Maria1 maintenance
MaxScale 이용을 위한 선택
• Replication Method
• Service Module
• Understand Replication Lag
• MaxScale HA
• Application Connection
MaxScale 장애확인
• WAS Log 확인
• MaxCtrl 상태확인
• Error Log 확인
• MariaDB 상태확인
• MariaDB Error Log 확인
MariaDB가 장애인지 Maxscale이 장애인지 매우 중요함
대부분 Maxscale장애보다 MariaDB의 장애를 Maxscale이 감지함(정상)
MaxScale 장애유형
• MariaDB
• Replication 깨짐
• Disk Full
• Memory Storage Engine 이해
• SQL_SECURITY Privileges
• OOM
• Instance Down(signal 6/11
error~)
• BUG로 Crash.
InnoDB와 Replication의 이해가 필요
• Maxscale
• TCP keepalive … connection
close
• connection_timeout 초과
• auto_rejoin fail
• DB hang으로 오탐
• QLA filter log full
• memory leak
https://jira.mariadb.org/projects/MDEV/issues/
https://jira.mariadb.org/projects/MXS/issues
MaxScale 장애조치
• MariaDB 장애의 경우 Maxscale과 무관
• 서비스에서 노드를 유지관리 모드로 전환, 장애복구 후 유지관리 모드 해제
• maxctrl set server Maria1 maintenance
• 해당노드 장애복구
• maxctrl clear server Maria1 maintenance
• Master Role에 대한 수동전환이 필요한 경우
• maxctrl call command mariadbmon switchover MariaDB-Monitor
• Maxscale 설정변경 후 반영 안될때
• Maxscale stop
• /var/lib/maxscale/* 삭제
• Maxscale start
MaxScale 적용사례
• 고가용성(HA) : Active – Standby
• Maxscale은 이중화 (VIP/JDBC)
• readconnroute( router_option=master)
• 일부 고객사 운용
• Read/Write 분산 : Active – Active
• Maxscale은 이중화 (VIP/JDBC)
• readwritesplit
• 다수 고객사 운용
• Galera Cluster Router : Active – Active
• Maxscale은 이중화 (VIP/JDBC)
• galeramon
• 극히 일부 고객사 운용
MaxScale version
 MaxScale 2.5
• MariaDB-Monitor supports cooperative monitoring
• MaxGUI, a new browser based tool for configuring and managing MaxScale is introduced
• New routers, mirror and kafkacdc, A completely new binlog router implemenation
Multiple modes of operation for causal_reads
MaxScale version
 MaxScale 6
• New list queries command for MaxCtrl that lists all active
queries
• A nosqlprotocol protocol module that implements the MongoDB®
wire protocol
• If extra_port is defined for a server, it's used by default for
monitor and user account manager connections
 MaxScale 22.08
• Sessions can now be killed using maxctrl
MaxScale version
 MaxScale 23.02
• Create-Backup and Restore-From-Backup commands added to
MariaDBMonitor
• Use the built-in configuration synchronization to synchronize
the configurations of multiple MaxScale instances
• The REST-API is now supports ODBC-type connections in the /sql
endpoints
 MaxScale 23.08
• Added switchover-force command to MariaDB Monitor
감사합니다
MaxScale이해와활용-2023.11

More Related Content

What's hot

MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용I Goo Lee
 
Federated Engine 실무적용사례
Federated Engine 실무적용사례Federated Engine 실무적용사례
Federated Engine 실무적용사례I Goo Lee
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기NHN FORWARD
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바NeoClova
 
How to upgrade like a boss to MySQL 8.0 - PLE19
How to upgrade like a boss to MySQL 8.0 -  PLE19How to upgrade like a boss to MySQL 8.0 -  PLE19
How to upgrade like a boss to MySQL 8.0 - PLE19Alkin Tezuysal
 
MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)NeoClova
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Corporation
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxNeoClova
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)Altinity Ltd
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기I Goo Lee
 
Advanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suiteAdvanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suiteKenny Gryp
 
HandsOn ProxySQL Tutorial - PLSC18
HandsOn ProxySQL Tutorial - PLSC18HandsOn ProxySQL Tutorial - PLSC18
HandsOn ProxySQL Tutorial - PLSC18Derek Downey
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupNilnandan Joshi
 
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0Frederic Descamps
 
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법Ji-Woong Choi
 
Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리YoungHeon (Roy) Kim
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewRené Cannaò
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Traceoysteing
 

What's hot (20)

MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
 
Federated Engine 실무적용사례
Federated Engine 실무적용사례Federated Engine 실무적용사례
Federated Engine 실무적용사례
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
 
How to upgrade like a boss to MySQL 8.0 - PLE19
How to upgrade like a boss to MySQL 8.0 -  PLE19How to upgrade like a boss to MySQL 8.0 -  PLE19
How to upgrade like a boss to MySQL 8.0 - PLE19
 
MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly Available
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
New features in ProxySQL 2.0 (updated to 2.0.9) by Rene Cannao (ProxySQL)
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
 
Advanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suiteAdvanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suite
 
HandsOn ProxySQL Tutorial - PLSC18
HandsOn ProxySQL Tutorial - PLSC18HandsOn ProxySQL Tutorial - PLSC18
HandsOn ProxySQL Tutorial - PLSC18
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackup
 
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
preFOSDEM MySQL Day - Best Practices to Upgrade to MySQL 8.0
 
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
 
Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management Overview
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 

Similar to MaxScale이해와활용-2023.11

From MSSQL to MySQL
From MSSQL to MySQLFrom MSSQL to MySQL
From MSSQL to MySQLI Goo Lee
 
MySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptxMySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptxNeoClova
 
GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항정명훈 Jerry Jeong
 
MySQL InnoDB Cluster 소개
MySQL InnoDB Cluster 소개MySQL InnoDB Cluster 소개
MySQL InnoDB Cluster 소개rockplace
 
DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)
DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)
DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)AWSKRUG - AWS한국사용자모임
 
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)Amazon Web Services Korea
 
[스마트스터디]MongoDB 의 역습
[스마트스터디]MongoDB 의 역습[스마트스터디]MongoDB 의 역습
[스마트스터디]MongoDB 의 역습smartstudy_official
 
Maria db
Maria dbMaria db
Maria dbymtech
 
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬KTH, 케이티하이텔
 
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략KTH
 
MariaDB
MariaDBMariaDB
MariaDBymtech
 
20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)
20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)
20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)Amazon Web Services Korea
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache TajoGruter
 
Big data analysis with R and Apache Tajo (in Korean)
Big data analysis with R and Apache Tajo (in Korean)Big data analysis with R and Apache Tajo (in Korean)
Big data analysis with R and Apache Tajo (in Korean)Gruter
 
DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트:: AWS Summit Online Korea 2020
DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트::  AWS Summit Online Korea 2020DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트::  AWS Summit Online Korea 2020
DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트:: AWS Summit Online Korea 2020Amazon Web Services Korea
 
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1Seok-joon Yun
 
Gpdb best practices v a01 20150313
Gpdb best practices v a01 20150313Gpdb best practices v a01 20150313
Gpdb best practices v a01 20150313Sanghee Lee
 
그림으로 공부하는 오라클 구조
그림으로 공부하는 오라클 구조그림으로 공부하는 오라클 구조
그림으로 공부하는 오라클 구조Choonghyun Yang
 
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀EXEM
 

Similar to MaxScale이해와활용-2023.11 (20)

From MSSQL to MySQL
From MSSQL to MySQLFrom MSSQL to MySQL
From MSSQL to MySQL
 
MySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptxMySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptx
 
GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항GoldenGate for MySQL 설치 시 필요한 사항
GoldenGate for MySQL 설치 시 필요한 사항
 
MySQL InnoDB Cluster 소개
MySQL InnoDB Cluster 소개MySQL InnoDB Cluster 소개
MySQL InnoDB Cluster 소개
 
DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)
DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)
DynamoDB의 안과밖 - 정민영 (비트패킹 컴퍼니)
 
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)
 
[스마트스터디]MongoDB 의 역습
[스마트스터디]MongoDB 의 역습[스마트스터디]MongoDB 의 역습
[스마트스터디]MongoDB 의 역습
 
Maria db
Maria dbMaria db
Maria db
 
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략_데이터지능팀_성동찬
 
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
H3 2011 대형사이트 구축을 위한 MySQL 튜닝전략
 
MariaDB
MariaDBMariaDB
MariaDB
 
20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)
20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)
20140806 AWS Meister BlackBelt - Amazon Redshift (Korean)
 
AWS RDS, DYNAMO
AWS RDS, DYNAMOAWS RDS, DYNAMO
AWS RDS, DYNAMO
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache Tajo
 
Big data analysis with R and Apache Tajo (in Korean)
Big data analysis with R and Apache Tajo (in Korean)Big data analysis with R and Apache Tajo (in Korean)
Big data analysis with R and Apache Tajo (in Korean)
 
DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트:: AWS Summit Online Korea 2020
DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트::  AWS Summit Online Korea 2020DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트::  AWS Summit Online Korea 2020
DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트:: AWS Summit Online Korea 2020
 
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
[2015-06-12] Oracle 성능 최적화 및 품질 고도화 1
 
Gpdb best practices v a01 20150313
Gpdb best practices v a01 20150313Gpdb best practices v a01 20150313
Gpdb best practices v a01 20150313
 
그림으로 공부하는 오라클 구조
그림으로 공부하는 오라클 구조그림으로 공부하는 오라클 구조
그림으로 공부하는 오라클 구조
 
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 5회 엑셈 수요 세미나 자료 연구컨텐츠팀
 

MaxScale이해와활용-2023.11

  • 2. 네오클로바 - 회사소개 업체명 ㈜ 네오클로바 대표자 이 재 중 홈페이지 www.neoclova.co.kr 대표전화 02-539-4880 사업 분야 오픈소스 기반의 유지보수, 컨설팅 / 전반 Linux OS, WEB, WAS, DBMS 분야 기술 지원 및 분석 지원 서비스 주소 서울시 강서구 양천로 583(염창동 240-21) 우림블루나인 B동 1206호 회 사 설 립 년 도 2011년 11월 7일
  • 3. Next Opensource Cloud Value MariaDB
  • 4. MariaDB MariaDB 는 개방성과 커뮤니티 보존을 위해 개발되었다. 그 결과 우리는 더욱 빠른 속도로 미래의 애플리케이션을 준비할 수 있게 되었다. Michael “Monty” Widenius 설립자 & CTO of MariaDB MySQL 의 창시자 오픈소스의 철학 “ ”
  • 8. 뭐가 달라요? ▪ 아키텍처 • Thread 방식이에요 ✔ Only mysqld process (cf. mysqld_safe) • 기본적으로 Single Core로만 SQL을 처리해요 ✔ 병렬(Parallel)처리를 지원하지 않아요  Only MySQL ✔ 일부 DDL 병렬처리 기능이 도입되고 있어요 ✔ innodb_ddl_threads (8.0.27 ~) • Nested Loop 방식의 Join을 사용해요 ✔ innodb_adaptive_hash_index (mysql enable, mariadb disable) • 다양한 스토리지 엔진을 지원해요 • 복제기능이 내장돼 있어요 ✔ Async/Semi-Sync Replication ✔ 비동기임을 감안해서 HA 구성하세요 • Scale-Out > Scale-Up
  • 9. 뭐가 달라요? ▪ General • AUTOCOMMIT=TRUE ✔ 어플리케이션 CONNECTION 처리에 유의 ✔ 빈번한 autocommit의 변경은 성능저하 원인 • EXPLAIN PLAN ✔ 실행계획을 저장/재사용 하지 않아요 • QUERY (RESULTS) CACHE ✔ SQL 수행결과의 캐싱 ✔ 지원여부는 버전별로 차이가 있어요. (MySQL 5.7.20~ deprecated) • default ISOLATION LEVEL ✔ REPEATABLE-READ ✔ READ-COMMITTED 권고 (Oracle, SQLServer) • Community vs Commercial ✔ 지원하는 기능이 달라요( storage engine ) ✔ MySQL vs MariaDB vs Percona Server for MySQL
  • 10. 뭐가 달라요? ▪ 스키마 • 스키마는 데이터베이스와 동의어로 취급해요 ✔ 인스턴스 > 데이터베이스 > 스키마 > 테이블 ✔ 인스턴스 > 데이터베이스(스키마) > 테이블 • 서로 다른 데이터베이스의 테이블 간에도 조인이 가능 ✔ 따라서 개념은 schema에 가까워요 • 소유자(owner) 개념은 없어요 • show databases , show schemas • system schema ✔ mysql ✔ information_schema ✔ performance_schema ✔ sys mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ mysql> show schemas; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+
  • 11. 뭐가 달라요? ▪ Tablespace (innodb) • System Tablespace ✔ ibdataN~ ✔ 하나 이상의 파일로 구성 ✔ 8M단위로 자동 확장 • Table당 Tablespace ✔ Table당 파일이 생성 (innodb_file_per_table) ✔ 파티션시 개별 파티션 별로 파일이 생성 되요 ✔ 미리 늘려 놓을 수 없어요 (자동 확장이 되요) • General Tablespace (Only MySQL) ✔ 오라클처럼 여러 테이블을 하나의 Tablespace에 저장할 수도 있어요 ✔ 인덱스를 별도 Tablespace에 분리 할 수는 없어요 • Undo Tablespace • Temporary Tablespace
  • 12. 뭐가 달라요? ▪ Table • General ✔ 테이블별로 다른 스토리지 엔진을 사용할 수 있어요 ✔ 테이블별로 압축을 제어할 수 있어요 ✔ Page수준 암호화 지원, 플러그인 (컬럼 암호화 아님) ✔ 대소문자 구분 활성화/비활성 할 수 있어요 (초기화 시점에 적용 가능) ✔ Table에 PK/UK로 AUTO_INCREMENT 컬럼을 1개 만들 수 있어요 ✔ PRIMARY KEY 순서로 테이블에 저장을 해요 ✔ 원격지 테이블 / 파일등에 연결 할 수 있어요 (federated , connect) ✔ 테이블을 삭제해도 권한이 취소되지 않아요 (명시적인 REVOKE 필요) • InnoDB 제한( 16K page, row_format=DYNAMIC ) ✔ 최대 크기 : 64T ✔ 최대 컬럼 수 : 1017개 ✔ 최대 행 크기 : 65535 Bytes (기본 + 오버플로 페이지) ✔ 기본 페이지 : 8126 Bytes (255byte 이하 컬럼들 합) mysql [test]> show create table t1G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( `id` int(11) NOT NULL, `nm` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL, `rrno` varchar(13) COLLATE utf8mb4_bin NOT NULL, `srv_yn` varchar(1) COLLATE utf8mb4_bin NOT NULL, `reti_dt` varchar(8) COLLATE utf8mb4_bin NOT NULL, PRIMARY KEY (`id`), KEY `rrno` (`rrno`,`srv_yn`,`reti_dt`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin 1 row in set (0.001 sec) mysql [test]> show global variables like 'innodb_default_row_format'; +---------------------------+---------+ | Variable_name | Value | +---------------------------+---------+ | innodb_default_row_format | dynamic | +---------------------------+---------+ 1 row in set (0.001 sec)
  • 13. 뭐가 달라요? ▪ Table (중요) • Basic ✔ page size default 16K vs Oracle/MSSQL/PostgreSQL 8K (innodb_page_size) ✔ 바꿀 수 있으나 바꾸지 마세요 (득보다 위험요소가 많아요) ✔ 크기는 미리 늘려 놓을 수 없어요 (자동확장이 되요) ✔ 테이블명에 대소문자 구분을 해요 • Primary Key ✔ 테이블 생성시 무조건 PK는 부여해 주세요 (복제지연(장애)과 성능저하의 원인이 됩니다) ✔ Oracle은 ROWID로 테이블과 인덱스가 연결되어 있지만, MySQL은 Primary key 로 연결돼 있어요 • Partition ✔ 개별 파티션별로 파일이 생성되요 ✔ Local indexes on Partition만 지원해요 ✔ 파티션 키 컬럼이 반드시 PK(UK)에 포함 되어야 해요 • CHARACTER SET / COLLATION ✔ Table/Column별 CHARSET 설정이 가능해요 ✔ UTF8(utf8mb3), UTF8MB4(권고)
  • 14. 뭐가 달라요? ▪ Column • AUTO_INCREMENT ✔ 테이블종속, 정수형, 자동증가 ✔ PK, UK로 활용 하세요 ✔ SERIAL = BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE • NULL ✔ 빈문자열 '' (Empty String) 과 NULL값은 달라요 ✔ 인덱스 페이지에 값이 저장됨(인덱스 활용 가능) ✔ 정렬 시 선행 검색, 오라클은 후행 검색 되요 ✔ NULL 여부를 위해서 1비트 추가 저장공간 소요 ✔ 산술연산은 NULL, 그룹함수나 문자연결시에는 연산에서 제외 • COMPRESSED (Only MariaDB) ✔ 특정 컬럼만 압축이 가능해요(blob) • Invisible ~, Generated ~ as ~, ✔ 빠르게 좋아지고 있어요 MariaDB [test]> select * from t1; +------+------+------+ | id | no | nm | +------+------+------+ | 1 | NULL | NULL | | 2 | 100 | NULL | | 3 | 200 | Lee | +------+------+------+ 3 rows in set (0.000 sec) MariaDB [test]> select id, sum(no), min(nm) from t1; +------+---------+---------+ | id | sum(no) | min(nm) | +------+---------+---------+ | 1 | 300 | Lee | +------+---------+---------+ 1 row in set (0.000 sec) MariaDB [test]> select id, sum(no), max(nm) from t1; +------+---------+---------+ | id | sum(no) | max(nm) | +------+---------+---------+ | 1 | 300 | Lee | +------+---------+---------+ 1 row in set (0.000 sec)
  • 15. 뭐가 달라요? ▪ Data Type • 숫자형 ✔ 정수형 세분화 지원(tinyint, smallint, mediumint, int, bigint) ✔ 부동소수점 값은 근사치로 반올림 처리에 유의 (FLOAT은 안쓰는 걸로!!) • 문자열 ✔ 가변길이는 1~2Bytes 추가 길이 필요 해요 ✔ 길이단위로 해석, 단 이진문자열은 BYTE 단위 ✔ UTF8 : 3BYTE, UTF8MB4 : 4BYTE ✔ 일반적으로 Character In-Senstive가 기본 Collation (utf8mb4_0900_ai_ci , utf8mb4_unicode_ci ) ✔ 대체로 데이터 값의 뒤 공백을 제거하고 비교하나, COLLATION 마다 차이가 있음으로 확인필요 (PAD 속성) • 날짜형 ✔ DATE : '1000-01-01' ~ '9999-12-31' ✔ DATETIME : '1000-01-01 00:00:00.000000' ~ '9999-12-31 23:59:59.999999' ✔ TIMESTAMP: '1970-01-01 00:00:01.000000' ~ '2038-01-19 03:14:07.999999' ✔ TIME, YEAR ✔ Y2K38 (MySQL 8.0.28 fixed, MariaDB : https://jira.mariadb.org/browse/MDEV-32188 )
  • 16. 뭐가 달라요? ▪ Data Type • JSON ✔ MySQL : RFC7159에 정의된 데이터유형 지원 ( JSON 객체) ✔ MariaDB : MySQL 호환성을 위한 LONGTEXT (JSON 문자열) • 미지원 ✔ XML
  • 17. 뭐가 달라요? ▪ VIEW • Logical Table ✔ not supported MATERIALIZED VIEW ▪ ROUTINES ✔ security_type DEFINER/INVOKER – EXECUTE/~ • PACKAGE (Only MariaDB) ✔ MariaDB는 지원해요 (SQL_MODE=ORACLE) • PROCEDURE / FUNCTION ✔ AS 키워드가 없어요 • TRIGGER ✔ DML_EVENT만 지원, DDL_EVENT/DATABASE_EVENT 미지원 ✔ SQL문에 의한 테이블 변경시에만 활성화 됨 • EVENT ✔ ORACLE - scheduler
  • 18. 뭐가 달라요? ▪ SEQUENCE (Only MariaDB) • AUTO_INCREMENT 대안 • 실제로는 InnoDB Engine (cf. Sequence Storage Engine – virtual dummy table) • 사용법 ✔ NEXT VALUE FOR sequence_name / NEXTVAL(sequence_name) / sequence_name.nextval ✔ PREVIOUS VALUE FOR sequence_name / LASTVAL(sequence_name) / sequence_name.currval ▪ Index • Page 구조 ✔ PRIMARY KEY : PK 컬럼 값들의 순으로 정렬된 테이블, PK 이름을 바꿀 수 없어요 ✔ SECONDARY KEY : PK 값이 숨어 있어요 (ROWID 역할) • Descending ✔ MySQL 8.0~, MariaDB 10.8~ 지원 ✔ 이전 버전까지는 ASC로만 컬럼들 정렬해서 인덱스 생성 • FULL-TEXT Search ✔ NGRAM Parser (MySQL)
  • 19. 뭐가 달라요? ▪ Account • user@host ✔ user가 접속하는 host까지가 계정정보 ✔ 동일한 user라도 접속 host의 비번이 다를 수 있어요 • password management ✔ Validation Plugin을 통해서 제어 ✔ MySQL / MariaDB 다름 • Drop user ✔ 소유한 객체가 있어도 삭제가 되거든요 ✔ cascade 미지원 MariaDB [mysql]> show tables; +----------------------- ----+ | Tables_in_mysql | +----------------------- ----+ | column_stats | | columns_priv | | db | | event | | func | | general_log | | global_priv | | gtid_slave_pos | | help_category | | help_keyword | | help_relation | | help_topic | | index_stats | | innodb_index_stats | | innodb_table_stats | | plugin
  • 20. 뭐가 달라요? ▪ Standard SQL • MySQL/MariaDB ✔ SELECT ~ INTO table 은 INSERT INTO table SELECT ~ 로 지원 ✔ UPDATE t1 SET c1 = c1 +1, c2 = c1; UPDATE t1 SET c2 = c1, c1 = c1 +1; 두 문장의 결과는 달라요 ✔ FOREIGN KEY로 부모테이블의 UNIQUE/NOT NULL 조건이 아닌 인덱싱 컬럼도 지원 ✔ 지원하는 주석처리 /*! ~~ */ (구문분석 수행) #~ -- ~ (-- 다음 공백 있음) ✔ || (OR), && (AND)로 해석, 문자열 연결은 CONCAT() 이용 ✔ TRIM()은 부분 문자열 제거 지원 (cf. Oracle – 단일문자 제거) ✔ LIMIT 절 (UPDATE ~ JOIN절의 경우는 LIMIT 사용불가) ✔ FROM절의 SUBQUERY내의 ORDER BY는 무시 ✔ https://mariadb.com/kb/en/why-is-order-by-in-a-from-subquery-ignored/ select * from ( select id, nm, srv_yn, reti_dt from t1 where rrno='23475296848' order by srv_yn desc, reti_dt desc limit 3 ) A; VS select * from ( select id, nm, srv_yn, reti_dt from t1 where rrno='23475296848' order by srv_yn desc, reti_dt desc ) A limit 3; VS select * from ( select id, nm, srv_yn, reti_dt from t1 where rrno='23475296848' ) A order by srv_yn desc, reti_dt desc limit 3;
  • 21. 뭐가 달라요? ▪ Standard SQL • SQL_MODE ✔ Strict Mode Disable 운영 시 느슨한 데이터 유효성 검사로 데이터 유실 될 수 있어요 • Hint ✔ 주석을 이용한 힌트 사용시에도 SQL 구문 오류가 발생 할 수 있어요 ✔ 주석내의 코드에 대한 구문분석을 실행
  • 22. Next Opensource Cloud Value HA (High Availability)
  • 23. Replication Binar y log Relay log I/O thread SQL thread Primary Replica Data changes Write Read Replay Binary log dump thread Write
  • 27. MHA
  • 30. Next Opensource Cloud Value MaxScale
  • 31. MariaDB MaxScale • DB Proxy • BSL • Query Routing • MariaDB Monitoring • Filter • HA
  • 33. MariaDB MaxScale BSL (Business Source License) Additional Use Grant: You may use the Licensed Work when your application uses the Licensed Work with a total of less than three server instances for any purpose. https://mariadb.com/bsl-faq-mariadb/ * minor version마다 GPL2전환 시기 다름
  • 34. MaxScale Router • Readconnroute * • Readwritesplit * • Binlogrouter • mirror • SchemaRouter • SmartRouter • Kafka CDC • Kafka Importer https://mariadb.com/kb/en/maxscale-6-routers/
  • 35. MaxScale Router  ReadconnRouter • router_options=master • router_options=slave • router_options=synced • router_options=running
  • 37. MaxScale Router  ReadWriteSplit Router • autocommit=true (필수) • max_slave_replication_lag (권고) • Causal read (비권고)
  • 39. MaxScale Filter  Hint • /* maxscale route to master */ • /* maxscale route to slave */ • /* maxscale route to server server3 */ • mariadb client --comments 주의
  • 40. MaxScale Monitor • MariaDB Monitor * • Galera Monitor • Aurora Monitor • ColumnStore Monitor
  • 41. MaxScale Monitor  MariaDB Monitor • Auto failover • Auto rejoin • Switchover • Cooperative Monitoring • extra_port • L4 / JDBC설정
  • 44. MaxScale Monitor  Galera Monitor • write(1), read(another) • choose the node with the lowest wsrep_local_index value as the master
  • 46. MaxScale REST API • curl 127.0.0.1:8989/v1/servers • curl 127.0.0.1:8989/v1/monitors • maxctrl api get services data[].attributes.router_diagnostics --pretty • curl -X GET -u admin:mariadb http://127.0.0.1:8989/v1/servers -i https://mariadb.com/kb/en/maxscale-6-rest-api/
  • 53. Next Opensource Cloud Value MaxScale 구성 및 운영
  • 54. MaxScale 기본 환경구성 (maxscale.cnf 예시) [maxscale] threads = auto skip_name_resolve = yes [Write-Listener] type = listener service = Write- service protocol = MariaDBClient port = 6033 [Write-service] type = service router = readconnroute router_options = master servers = DB1,DB2,DB3 [DB-Monitor] type = monitor module = mariadbmon servers = DB1,DB2,DB3 user = max passwd = maxPW monitor_interval = 10 auto_failover = true auto_rejoin = true enforce_read_only_slaves = true servers_no_promotion = DB3 [DB1] type = server address = 192.168.0.100 port = 3306 protocol = MariaDBBackend user = max passwd = maxPW [DB2] ... [DB3] ... [Split-Listener] type = listener service = Split- service protocol = MariaDBClient port = 6034 [Split-service] type = service router = readwritesplit servers = DB1,DB2,DB3 max_slave_replication_lag = 10s use_sql_variables_in = master
  • 55. MaxScale Objects Section Description Server MariaDB MaxScale을 통해 클라이언트를 연결할 수 있는 개별 데이터베이스 서버 서버 상태 • Running : 정상 • Master : Master 서버 • Slave : Slave 서버 • Maintenance : 수동으로 연결을 차단한 점검을 위한 서버 • Slave of External Master : 모니터링 되지 않는 Slave Protocol MaxScale과 MaxScale 클라이언트 또는 MaxScale에 설정 된 서버 간의 통신을 담당 Monitor 특정 종류의 클러스터 상태를 모니터링하고 MaxScale의 Router에서 해당 상태를 사용할 수 있게 함 Filter MaxScale의 요청 처리 Router 앞에 위치하여 요청에 대한 정보를 거부, 처리, 변경 또는 기록 Router 요청의 특성 또는 Router가 구현하는 알고리즘에 따라 요청을 backend 데이터베이스 서버로 라우팅 (readconnroute / readwritesplit 등) Service 데이터베이스 집합을 추상화하여 클라이언트에 단일 데이터베이스로 표시 Listener MaxScale이 수신 대기하는 포트를 정의하고 해당 포트에 도착한 연결 요청은 Listener에 연결된 Service로 전달
  • 56. MariaDB 제약사항 • GTID (current_pos) • log_slaves_updates • Replication 구성 • extra_port extra_max_connections • 각 계정정보에 대해서 두세트의 권한부여가 필요함 usr1@client-host usr1@maxscale-host
  • 57. Monitor 제약사항 • mariadbmon 은 복제지연이 발생할 수 있음 • 하나의 모니터만 사용 가능 • 동일 서버를 두대이상에서 모니터링할 경우 오류로 간주됨 • Galera Cluster 모니터링 제한 (galeramon) • wsrep_local_index를 기반으로 기본 Master가 선택 됨 • 서버 우선 순위 메커니즘의 영향을 받을 수 있음 • disable_master_failback = 1
  • 58. Read/Write Splitter 제약사항 • 마스터 서버로 라우팅 되는 쿼리 • open transaction 내에서 쿼리가 실행 된 경우(autocommit=0) • 구문에 저장 프로시저 또는 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 쿼리가 사용자 변수를 수정하면 라우팅되지 않고 클라이언트가 오류를 수신
  • 59. transaction 제약사항 • XA트랜잭션 탐지 불가 • XA 명령은 알 수 없는 명령으로 처리 • 데이터베이스를 잠재적으로 수정할 수 있는 작업으로 취급 • readwritesplit 일 경우, 마스터로 라우트 됨 • XA 트랜잭션 내부에서 수행 된 SELECT 쿼리는 XA 트랜잭션의 일부가 아닌 서버로 라우팅 • XA 트랜잭션 수행 시 auto commit을 비활성화 하여 수행가능 • Prepared Statement • prepared statement를 사용하여 autocommit 모드 변경 시 문제 발생 • 모드 변경이 되어도 maxscale은 이를 인지하지 못함
  • 60. MaxScale 구성 제약사항 • connection_timeout vs wait_timeout • log_info = false | true , log_debug = false | true • skip_name_resolve = true • extra_port (in server) • max_slave_replication_lag • maxkeys 권고 • /etc/logrotate.d/Maxscale_rotate
  • 61. MaxScale 운영 제약사항 • 신규 계정 추가 • Backend Server의 계정추가 후 MaxAdmin 에서 reload dbusers 수행 필요 • users_refresh_time=30s
  • 62. MaxScale maxctrl • maxctrl --help • maxctrl list servers • maxctrl show monitors • maxctrl list sessions • maxctrl call command mariadbmon release-locks MyMonitor1 • maxctrl call command mariadbmon switchover MariaDB- Monitor • maxctrl set server Maria1 maintenance
  • 63. MaxScale 이용을 위한 선택 • Replication Method • Service Module • Understand Replication Lag • MaxScale HA • Application Connection
  • 64. MaxScale 장애확인 • WAS Log 확인 • MaxCtrl 상태확인 • Error Log 확인 • MariaDB 상태확인 • MariaDB Error Log 확인 MariaDB가 장애인지 Maxscale이 장애인지 매우 중요함 대부분 Maxscale장애보다 MariaDB의 장애를 Maxscale이 감지함(정상)
  • 65. MaxScale 장애유형 • MariaDB • Replication 깨짐 • Disk Full • Memory Storage Engine 이해 • SQL_SECURITY Privileges • OOM • Instance Down(signal 6/11 error~) • BUG로 Crash. InnoDB와 Replication의 이해가 필요 • Maxscale • TCP keepalive … connection close • connection_timeout 초과 • auto_rejoin fail • DB hang으로 오탐 • QLA filter log full • memory leak https://jira.mariadb.org/projects/MDEV/issues/ https://jira.mariadb.org/projects/MXS/issues
  • 66. MaxScale 장애조치 • MariaDB 장애의 경우 Maxscale과 무관 • 서비스에서 노드를 유지관리 모드로 전환, 장애복구 후 유지관리 모드 해제 • maxctrl set server Maria1 maintenance • 해당노드 장애복구 • maxctrl clear server Maria1 maintenance • Master Role에 대한 수동전환이 필요한 경우 • maxctrl call command mariadbmon switchover MariaDB-Monitor • Maxscale 설정변경 후 반영 안될때 • Maxscale stop • /var/lib/maxscale/* 삭제 • Maxscale start
  • 67. MaxScale 적용사례 • 고가용성(HA) : Active – Standby • Maxscale은 이중화 (VIP/JDBC) • readconnroute( router_option=master) • 일부 고객사 운용 • Read/Write 분산 : Active – Active • Maxscale은 이중화 (VIP/JDBC) • readwritesplit • 다수 고객사 운용 • Galera Cluster Router : Active – Active • Maxscale은 이중화 (VIP/JDBC) • galeramon • 극히 일부 고객사 운용
  • 68. MaxScale version  MaxScale 2.5 • MariaDB-Monitor supports cooperative monitoring • MaxGUI, a new browser based tool for configuring and managing MaxScale is introduced • New routers, mirror and kafkacdc, A completely new binlog router implemenation Multiple modes of operation for causal_reads
  • 69. MaxScale version  MaxScale 6 • New list queries command for MaxCtrl that lists all active queries • A nosqlprotocol protocol module that implements the MongoDB® wire protocol • If extra_port is defined for a server, it's used by default for monitor and user account manager connections  MaxScale 22.08 • Sessions can now be killed using maxctrl
  • 70. MaxScale version  MaxScale 23.02 • Create-Backup and Restore-From-Backup commands added to MariaDBMonitor • Use the built-in configuration synchronization to synchronize the configurations of multiple MaxScale instances • The REST-API is now supports ODBC-type connections in the /sql endpoints  MaxScale 23.08 • Added switchover-force command to MariaDB Monitor

Editor's Notes

  1. 안녕하세요. 네오클로바 김상모입니다. 네오클로바에서 최근 진행했던 MariaDB 마이그레이션 관련한 내용들을 정리해서 소개하도록 하겠습니다. 좋은 자리를 만들어 준 MariaDB 한국지사에 고맙습니다. 최근의 IT 서비스들은 클라우드 환경이 많아지고 오픈소스 데이터베이스들의 기능과 성능이 좋아지면서 신규 프로젝트에 오픈소스 적용을 많이 하고 있습니다. 상용 데이터베이스에서 오픈소스 데이터베이스로 마이그레이션은 아직 많은 경험들이 없어서 어렵다고 생각을 할 수 있는데요. 오픈소스 데이터베이스를 이용해서 수TB 이상의 대용량 데이터베이스를 운영하는 곳들이 늘어나고 클라우드 환경에서 적합한 데이터베이스를 고려하면서 오픈소스 데이터베이스로 마이그레이션 하는 사례도 많아지고 있습니다. 오픈소스 데이터베이스중에서 오늘은 MariaDB를 중심으로 얘기를 하려고 합니다. MariaDB는 2017년에 10.3 버전을 출시하면서 오라클 호환성을 지원하기 시작 했습니다. MariaDB의 오라클 호환성을 일부 이용을 하면서 마이그레이션을 하고, 안정화/최적화를 위해서는 MariaDB를 제대로 이해해야 합니다. 성능과 HA를 위해서 Scale out 기반의 아키텍처를 구성해야 하고 SQL 들에 대한 튜닝이 필요합니다. 네오클로바에서 진행한 마이그레이션 사례들을 가지고 MariaDB 데이터베이스로 마이그레이션을 어떻게 하면 좋을지에 대해서 얘기 하려고 합니다. 전체 진행은 일반적인 네오클로바의 DBMS 마이그레이션 관련한 방법론과 As-Is 현황분석, To-Be DBMS 선정, 마이그레이션 수행, MariaDB 마이그레이션에 대한 순서로 진행할 예정입니다.
  2. https://www.slideshare.net/neoclova/mysqlmariadb202212pptx
  3. - Cloud Platform별 제약사항 존재함. + NCP : 1H
  4. 왜냐하면 현재 외부 감사기간이기도 해서 더욱 더 섭외가 어려운점 양해말씀드리며,  교육강의 주제는 Maxscale의 기본 특성과 MariaDB와의 중요 연계 속성 등 실사례에 적용 및 장애시 문제해결 대응/예방 방법에 관한 설명 위주로 해주시면 될 것 같고요 추가적으로 질의응답을 통해서 구체적인 설명해주셨으면합니다... 참고로 교육인원은 20명입니다.  일정 재확인하셔서 회신주시기 바랍니다. 감사합니다.