MaxScale is a database proxy that provides high availability and scalability for MariaDB servers. It can be used to configure load balancing of read/write connections, auto failover/switchover/rejoin using MariaDB GTID replication. Keepalived can be used with MaxScale to provide high availability by monitoring MaxScale and failing over if needed. The document provides details on setting up MariaDB replication with GTID, installing and configuring MaxScale and Keepalived. It also describes testing the auto failover functionality.
사례로 알아보는 MariaDB 마이그레이션
현대적인 IT 환경과 애플리케이션을 만들기 위해 우리는 오늘도 고민을 거듭합니다. 최근 들어 오픈소스 DB가 많은 업무에 적용되고 검증이 되면서, 점차 무거운 상용 데이터베이스를 가벼운 오픈소스 DB로 전환하는 움직임이 대기업의 미션 크리티컬 업무까지로 확산하고 있습니다. 이는 클라우드 환경 및 마이크로 서비스 개념 확산과도 일치하는 움직임입니다.
상용 DB를 MariaDB로 이관한 사례를 통해 마이그레이션의 과정과 효과를 살펴 볼 수 있습니다.
MariaDB로 이관하는 것은 어렵다는 생각을 막연히 가지고 계셨다면 본 자료를 통해 이기종 데이터베이스를 MariaDB로 마이그레이션 하는 작업이 어렵지 않게 수행될 수 있다는 점을 실제 사례를 통해 확인하시길 바랍니다.
웨비나 동영상
https://www.youtube.com/watch?v=xRsETZ5cKz8&t=52s
MySQL Administrator
Basic course
- MySQL 개요
- MySQL 설치 / 설정
- MySQL 아키텍처 - MySQL 스토리지 엔진
- MySQL 관리
- MySQL 백업 / 복구
- MySQL 모니터링
Advanced course
- MySQL Optimization
- MariaDB / Percona
- MySQL HA (High Availability)
- MySQL troubleshooting
네오클로바
http://neoclova.co.kr/
MySQL Administrator
Basic course
- MySQL 개요
- MySQL 설치 / 설정
- MySQL 아키텍처 - MySQL 스토리지 엔진
- MySQL 관리
- MySQL 백업 / 복구
- MySQL 모니터링
Advanced course
- MySQL Optimization
- MariaDB / Percona
- MySQL HA (High Availability)
- MySQL troubleshooting
네오클로바
http://neoclova.co.kr/
24시간 365일 서비스를 위한 MySQL DB 이중화.
MySQL 이중화 방안들에 대해 알아보고 운영하면서 겪은 고민들을 이야기해 봅니다.
목차
1. DB 이중화 필요성
2. 이중화 방안
- HW 이중화
- MySQL Replication 이중화
3. 이중화 운영 장애
4. DNS와 VIP
5. MySQL 이중화 솔루션 비교
대상
- MySQL을 서비스하고 있는 인프라 담당자
- MySQL 이중화에 관심 있는 개발자
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)Jean-François Gagné
To get better replication speed and less lag, MySQL implements parallel replication in the same schema, also known as LOGICAL_CLOCK. But fully benefiting from this feature is not as simple as just enabling it.
In this talk, I explain in detail how this feature works. I also cover how to optimize parallel replication and the improvements made in MySQL 8.0 and back-ported in 5.7 (Write Sets), greatly improving the potential for parallel execution on replicas (but needing RBR).
Come to this talk to get all the details about MySQL 5.7 and 8.0 Parallel Replication.
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11Kenny Gryp
Oracle's MySQL solutions make it easy to setup various database architectures and achieve high availability with the introduction MySQL InnoDB Cluster and MySQL InnoDB ReplicaSet meeting various high availability requirements. MySQL InnoDB ClusterSet provides a popular disaster recovery solution.
Completely built in-house and supported by Oracle, many enterprises large and small have adopted these solutions into business critical applications.
In this presentation the various database architecture solutions for high availability and disaster recovery will be covered and help you choose the right solutions based on your business requirements.
The document discusses the Performance Schema in MySQL. It provides an overview of what the Performance Schema is and how it can be used to monitor events within a MySQL server. It also describes how to configure the Performance Schema by setting up actors, objects, instruments, consumers and threads to control what is monitored. Finally, it explains how to initialize the Performance Schema by truncating existing summary tables before collecting new performance data.
MariaDB MaxScale is a database proxy that provides scalability, high availability, and data streaming capabilities for MariaDB and MySQL databases. It acts as a load balancer and router to distribute queries across database servers. MaxScale supports services like read/write splitting, query caching, and security features like selective data masking. It can monitor replication lag and route queries accordingly. MaxScale uses a plugin architecture and its core remains stateless to provide flexibility and high performance.
Maxscale switchover, failover, and auto rejoinWagner Bianchi
How the MariaDB Maxscale Switchover, Failover, and Rejoin works under the hood by Esa Korhonen and Wagner Bianchi.
You can watch the video of the presentation at
https://www.linkedin.com/feed/update/urn:li:activity:6381185640607809536
PostgreSQL is a very popular and feature-rich DBMS. At the same time, PostgreSQL has a set of annoying wicked problems, which haven't been resolved in decades. Miraculously, with just a small patch to PostgreSQL core extending this API, it appears possible to solve wicked PostgreSQL problems in a new engine made within an extension.
*If you see the screen is not good condition, downloading please.*
MariaDB Optimization
- 풀 테이블 스캔
- ORDER BY 처리(Using filesort)
- GROUP BY 처리
- DISTINCT 처리
- 임시 테이블(Using Tempoary)
- 인덱스 컨디션 푸시다운(Index Condition Pushdown, ICP)
- 멀티 레인지 리드(Multi Range Read)
- 인덱스 머지(Index merge)
- 테이블 조인
- 서브 쿼리
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법Ji-Woong Choi
MySQL 소개
간략한 소개
version history
MySQL 사용처
제품 군 변화
시장 변화
MySQL 구성
MySQL 클라이언트 / 서버 개념
클라이언트 프로그램
MySQL 설치
MySQL 버전
MySQL 설치
MySQL 환경 설정
환경설정, 변수 설정
MySQL 스토리지 엔진 소개
MySQL tuning 소개 및 방법
데이터 백업/복구 방법
백업
복구
MySQL Upgrade
Optimizing MariaDB for maximum performanceMariaDB plc
When it comes to optimizing the performance of a database, DBAs have to look at everything from the OS to the network. In this session, MariaDB Enterprise Architect Manjot Singh shares best practices for getting the most out of MariaDB. He highlights recommended OS settings, important configuration and tuning parameters, options for improving replication and clustering performance and features such as query result caching.
MySQL Administrator
Basic course
- MySQL 개요
- MySQL 설치 / 설정
- MySQL 아키텍처 - MySQL 스토리지 엔진
- MySQL 관리
- MySQL 백업 / 복구
- MySQL 모니터링
Advanced course
- MySQL Optimization
- MariaDB / Percona
- MySQL HA (High Availability)
- MySQL troubleshooting
네오클로바
http://neoclova.co.kr/
MySQL Administrator
Basic course
- MySQL 개요
- MySQL 설치 / 설정
- MySQL 아키텍처 - MySQL 스토리지 엔진
- MySQL 관리
- MySQL 백업 / 복구
- MySQL 모니터링
Advanced course
- MySQL Optimization
- MariaDB / Percona
- MySQL HA (High Availability)
- MySQL troubleshooting
네오클로바
http://neoclova.co.kr/
24시간 365일 서비스를 위한 MySQL DB 이중화.
MySQL 이중화 방안들에 대해 알아보고 운영하면서 겪은 고민들을 이야기해 봅니다.
목차
1. DB 이중화 필요성
2. 이중화 방안
- HW 이중화
- MySQL Replication 이중화
3. 이중화 운영 장애
4. DNS와 VIP
5. MySQL 이중화 솔루션 비교
대상
- MySQL을 서비스하고 있는 인프라 담당자
- MySQL 이중화에 관심 있는 개발자
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)Jean-François Gagné
To get better replication speed and less lag, MySQL implements parallel replication in the same schema, also known as LOGICAL_CLOCK. But fully benefiting from this feature is not as simple as just enabling it.
In this talk, I explain in detail how this feature works. I also cover how to optimize parallel replication and the improvements made in MySQL 8.0 and back-ported in 5.7 (Write Sets), greatly improving the potential for parallel execution on replicas (but needing RBR).
Come to this talk to get all the details about MySQL 5.7 and 8.0 Parallel Replication.
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11Kenny Gryp
Oracle's MySQL solutions make it easy to setup various database architectures and achieve high availability with the introduction MySQL InnoDB Cluster and MySQL InnoDB ReplicaSet meeting various high availability requirements. MySQL InnoDB ClusterSet provides a popular disaster recovery solution.
Completely built in-house and supported by Oracle, many enterprises large and small have adopted these solutions into business critical applications.
In this presentation the various database architecture solutions for high availability and disaster recovery will be covered and help you choose the right solutions based on your business requirements.
The document discusses the Performance Schema in MySQL. It provides an overview of what the Performance Schema is and how it can be used to monitor events within a MySQL server. It also describes how to configure the Performance Schema by setting up actors, objects, instruments, consumers and threads to control what is monitored. Finally, it explains how to initialize the Performance Schema by truncating existing summary tables before collecting new performance data.
MariaDB MaxScale is a database proxy that provides scalability, high availability, and data streaming capabilities for MariaDB and MySQL databases. It acts as a load balancer and router to distribute queries across database servers. MaxScale supports services like read/write splitting, query caching, and security features like selective data masking. It can monitor replication lag and route queries accordingly. MaxScale uses a plugin architecture and its core remains stateless to provide flexibility and high performance.
Maxscale switchover, failover, and auto rejoinWagner Bianchi
How the MariaDB Maxscale Switchover, Failover, and Rejoin works under the hood by Esa Korhonen and Wagner Bianchi.
You can watch the video of the presentation at
https://www.linkedin.com/feed/update/urn:li:activity:6381185640607809536
PostgreSQL is a very popular and feature-rich DBMS. At the same time, PostgreSQL has a set of annoying wicked problems, which haven't been resolved in decades. Miraculously, with just a small patch to PostgreSQL core extending this API, it appears possible to solve wicked PostgreSQL problems in a new engine made within an extension.
*If you see the screen is not good condition, downloading please.*
MariaDB Optimization
- 풀 테이블 스캔
- ORDER BY 처리(Using filesort)
- GROUP BY 처리
- DISTINCT 처리
- 임시 테이블(Using Tempoary)
- 인덱스 컨디션 푸시다운(Index Condition Pushdown, ICP)
- 멀티 레인지 리드(Multi Range Read)
- 인덱스 머지(Index merge)
- 테이블 조인
- 서브 쿼리
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법Ji-Woong Choi
MySQL 소개
간략한 소개
version history
MySQL 사용처
제품 군 변화
시장 변화
MySQL 구성
MySQL 클라이언트 / 서버 개념
클라이언트 프로그램
MySQL 설치
MySQL 버전
MySQL 설치
MySQL 환경 설정
환경설정, 변수 설정
MySQL 스토리지 엔진 소개
MySQL tuning 소개 및 방법
데이터 백업/복구 방법
백업
복구
MySQL Upgrade
Optimizing MariaDB for maximum performanceMariaDB plc
When it comes to optimizing the performance of a database, DBAs have to look at everything from the OS to the network. In this session, MariaDB Enterprise Architect Manjot Singh shares best practices for getting the most out of MariaDB. He highlights recommended OS settings, important configuration and tuning parameters, options for improving replication and clustering performance and features such as query result caching.
DynamoDB를 게임에서 사용하기 – 김성수, 박경표, AWS솔루션즈 아키텍트:: AWS Summit Online Korea 2020Amazon Web Services Korea
발표영상 다시보기: https://youtu.be/AlDhGn_-OCE
Amazon DynamoDB를 사용함에 있어서 흔히들 빠지는 실수, 그리고 이를 만회하기 위하여 필요한 제반 요소들을 살펴보는 시간을 가져보겠습니다. 제대로 설계된 DDB 테이블과 Application이 그렇지 않은 경우에 비하여 얼마나 효율적일수 있는지를 생각해봅니다.
Pivotal Greenplum Database의 Best practices 문서를 한글화하였습니다. GPDB 구축시에 한 번은 고민해야 할 사항들이 정리가 되어 있습니다. http://gpdb.docs.pivotal.io/gpdb-434.html
2. 네오클로바 - 회사소개
업체명 ㈜ 네오클로바 대표자 이 재 중
홈페이지 www.neoclova.co.kr 대표전화 02-539-4880
사업 분야 오픈소스 기반의 유지보수, 컨설팅 / 전반 Linux OS, WEB, WAS, DBMS 분야 기술 지원 및 분석 지원 서비스
주소 서울시 강서구 양천로 583(염창동 240-21) 우림블루나인 B동 1206호
회 사 설 립 년 도 2011년 11월 7일
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
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 구문 오류가 발생 할 수 있어요
✔ 주석내의 코드에 대한 구문분석을 실행
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전환 시기 다름
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은 이를 인지하지 못함
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
#2: 안녕하세요. 네오클로바 김상모입니다.
네오클로바에서 최근 진행했던 MariaDB 마이그레이션 관련한 내용들을 정리해서 소개하도록 하겠습니다.
좋은 자리를 만들어 준 MariaDB 한국지사에 고맙습니다.
최근의 IT 서비스들은 클라우드 환경이 많아지고 오픈소스 데이터베이스들의 기능과 성능이 좋아지면서 신규 프로젝트에 오픈소스 적용을 많이 하고 있습니다.
상용 데이터베이스에서 오픈소스 데이터베이스로 마이그레이션은 아직 많은 경험들이 없어서 어렵다고 생각을 할 수 있는데요.
오픈소스 데이터베이스를 이용해서 수TB 이상의 대용량 데이터베이스를 운영하는 곳들이 늘어나고 클라우드 환경에서 적합한 데이터베이스를 고려하면서 오픈소스 데이터베이스로 마이그레이션 하는 사례도 많아지고 있습니다.
오픈소스 데이터베이스중에서 오늘은 MariaDB를 중심으로 얘기를 하려고 합니다.
MariaDB는 2017년에 10.3 버전을 출시하면서 오라클 호환성을 지원하기 시작 했습니다.
MariaDB의 오라클 호환성을 일부 이용을 하면서 마이그레이션을 하고, 안정화/최적화를 위해서는 MariaDB를 제대로 이해해야 합니다.
성능과 HA를 위해서 Scale out 기반의 아키텍처를 구성해야 하고 SQL 들에 대한 튜닝이 필요합니다.
네오클로바에서 진행한 마이그레이션 사례들을 가지고 MariaDB 데이터베이스로 마이그레이션을 어떻게 하면 좋을지에 대해서 얘기 하려고 합니다.
전체 진행은 일반적인 네오클로바의 DBMS 마이그레이션 관련한 방법론과 As-Is 현황분석, To-Be DBMS 선정, 마이그레이션 수행, MariaDB 마이그레이션에 대한 순서로 진행할 예정입니다.
#56: 왜냐하면 현재 외부 감사기간이기도 해서 더욱 더 섭외가 어려운점 양해말씀드리며,
교육강의 주제는
Maxscale의 기본 특성과
MariaDB와의 중요 연계 속성 등 실사례에 적용 및 장애시 문제해결 대응/예방 방법에 관한 설명 위주로 해주시면 될 것 같고요
추가적으로 질의응답을 통해서 구체적인 설명해주셨으면합니다... 참고로 교육인원은 20명입니다.
일정 재확인하셔서 회신주시기 바랍니다.
감사합니다.