[๊ฐ€์ƒํ™” - Container] Docker Container๋ฅผ ์ด์šฉํ•œ MariaDB ์„ค์น˜ํ•˜๊ธฐ

2023. 7. 11. 06:00ใ†System ์ž‘์—…์‹ค/Docker

728x90
๋ฐ˜์‘ํ˜•

 




 

 

 

๐Ÿš€ Docker Container๋ฅผ ์ด์šฉํ•œ MariaDB ์„ค์น˜ํ•˜๊ธฐ

    ๐Ÿ”ฝ Maria DB

        ๐Ÿ“ฆ Docker Container - ์„ค์น˜ํ•˜๊ธฐ

์ฃผ๋‹ˆ๋Š” Docker Container ์ค‘ Maria DB Docker Container๋ฅผ ๋ฐ›๊ณ  ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ ํƒํ•˜์˜€์–ด์š”.


์ด Image๋ฅผ ์ด์šฉํ•˜์—ฌ Data Base๋ฅผ ์ค€๋น„ํ•ด ๋ณด๋„๋ก ํ• ๊ฒŒ์š”.


usermod -aG docker {๊ณ„์ • ์ด๋ฆ„}

 


์ฐธ๊ณ ๋กœ ์œ„์™€ ๊ฐ™์ด Docker ๊ถŒํ•œ์ด ์—†์–ด Error๊ฐ€ ๋‚˜๋ฉด sudo ๋ช…๋ น์„ ํ†ตํ•ด ํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ, ๊ต‰์žฅํžˆ ๋ฒˆ์žก์Šค๋Ÿฝ๊ธฐ ๋•Œ๋ฌธ์—
๊ด€๋ฆฌ์šฉ ๊ณ„์ •์—๋Š” ์œ„์™€ ๊ฐ™์ด ๊ถŒํ•œ์„ ์„ค์ •ํ•ด ์ฃผ๊ณ , newgrp {๊ทธ๋ฃน ์ด๋ฆ„} ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด sudo ๋ช…๋ น ์—†์ด Docker ๋ช…๋ น์„ ์“ธ ์ˆ˜ ์žˆ๊ฒŒ ํ•  ์ˆ˜ ์žˆ์–ด์š”.

 

 

docker pull mariadb

 


๊ทธ๋Ÿฐ ๋’ค ์œ„์™€ ๊ฐ™์ด MariaDB Docker Image๋ฅผ ๋‚ด๋ ค ๋ฐ›์•„ ์ค๋‹ˆ๋‹ค.


docker images

 


Image๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ๋‚ด๋ ค ๋ฐ›์•„์ง„๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์ด ์ „ ๊ธ€๋“ค์—์„œ ์ฃผ๋‹ˆ๋Š” Docker ๊ธฐ๋™์„ ์œ„ํ•ด Shell Script๋ฅผ ๋งŒ๋“ค๊ณ , ๊ธฐ๋™ํ•˜์˜€๋Š”๋ฐ,
์ด๋ฒˆ์—” Docker-compose๋ฅผ ์ด์šฉํ•ด๋ณด๋ ค๊ณ  ํ•ด์š”.

๊ทธ ์ „์— MariaDB Container์— File์„ Docker Host Server์—์„œ ์ง์ ‘ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก

Directory Mapping์„ ์œ„ํ•œ Directory๋“ค์„ ๋งŒ๋“ค์–ด ์ค„๊ฒŒ์š”.

tree -d {Directory Path}

 


์ฃผ๋‹ˆ์“ฐ๋Š” ์ด๋ ‡๊ฒŒ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ๋Š”๋ฐ, /data ๋ถ€ํ„ฐ /giggal-mng-mariadb๊นŒ์ง€๋Š” OS ์˜์—ญ ์ €์žฅ์†Œ ๋ถ€์กฑ์œผ๋กœ ์ƒˆ๋กœ์šด ๊ฐ€์ƒ Storage๋ฅผ ์ถ”๊ฐ€ํ•ด ์ฃผ์—ˆ๊ณ , ๊ทธ ๊ณณ์— Data๊ฐ€ ์Œ“์ด๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•จ์ด์—์š”.

์ฃผ๋‹ˆ์“ฐ์ฒ˜๋Ÿผ ๋”ฐ๋กœ HDD๋ฅผ ๋งŒ๋“ค์ง€ ์•Š์•˜๋‹ค๋ฉด ๊ทธ ์ดํ›„์ธ db๋ถ€ํ„ฐ ๋งŒ๋“ค์–ด๋„ ํฌ๊ฒŒ ์ƒ๊ด€ ์—†์–ด์š”.

vim docker-compose.yml

 


์ฃผ๋‹ˆ๊ฐ€ ๋งŒ๋“  Docker-compose.yml File์ด์—์š”.


์ด๋ฒˆ์—๋Š” ์œ„์—์„œ ๋งŒ๋“ค์—ˆ๋˜ Directory ์ค‘ conf.d ์•ˆ์— my.cnf File์„ ๋งŒ๋“ค์–ด Maria DB Config File์„ ์ž‘์„ฑํ•ด ์ค„๊ฒŒ์š”.

vim ./db/conf.d/my.cnf

 


์ฃผ๋‹ˆ๊ฐ€ ์ค€๋น„ํ•œ Config File์€ ์œ„์™€ ๊ฐ™์•„์š”.

 

 

๐Ÿ’ก MySQL | Maria DB ์„ค์ • ๊ด€๋ จ
##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## mysqld ๋ฐ๋ชฌ ํ”„๋กœ์„ธ์Šค ๊ด€๋ จ ์„ค์ •๋“ค
##---------------------------------------------------------------------------
[mysqld]
core-file                                     	 # core dump ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๋„๋ก ํ•˜๊ธฐ ์œ„ํ•œ ์„ค์ •
user = junyss                                	 # MariaDB ์—”์ง„์˜ owner (user id) = DB๋ฅผ ์‹คํ–‰์‹œํ‚ฌ OS ๊ณ„์ •

port = 3306                                   	 # DB ํฌํŠธ
socket = /junyss/example/mariadb/mysqld.sock   # ์†Œ์ผ“ํŒŒ์ผ ๊ฒฝ๋กœ(๋กœ์ปฌ์„œ๋ฒ„ ์ ‘์†์— ์‚ฌ์šฉ), ๋ฆฌ๋ชจํŠธ ์„œ๋ฒ„์—๋Š” ip์™€ port๋ฅผ ์ด์šฉํ•ด์„œ TCP/IP ํ”„๋กœํ† ์ฝœ๋กœ ์ ‘๊ทผ
pid-file = /junyss/example/mariadb/mysqld.pid  # MariaDB ์„œ๋ฒ„๊ฐ€ ์ž์‹ ์˜ ํ”„๋กœ์„ธ์Šค ID๋ฅผ ๊ธฐ๋กํ•˜๋Š” ํŒŒ์ผ ๊ฒฝ๋กœ (์œ ๋‹‰์Šค ํ˜น์€ ๋ฆฌ๋ˆ…์Šค์—์„œ๋งŒ ์‚ฌ์šฉ)

basedir = /engn/mysvc/mariadb-<MaridDB Version>       # MariaDB ์—”์ง„ ๊ฒฝ๋กœ
datadir = /data/mysvc/MARIASVC                		  # DB์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์ƒ์„ฑ๋  ๊ธฐ๋ณธ ๊ฒฝ๋กœ
tmpdir = /data/mysvc/tmpdir_MARIASVC          		  # ๋””์Šคํฌ์— ์ž„์‹œํ…Œ์ด๋ธ”์ด ์ƒ์„ฑ๋  ๋•Œ ์‚ฌ์šฉ๋  ๊ฒฝ๋กœ

#secure_file_priv = /tmp                      		  # LOAD_FILE() ํ•จ์ˆ˜ ๋ฐ LOAD DATA ์™€ SELECT ... INTO OUTFILE ๋ช…๋ น๋ฌธ์ด ํŠน์ • ๋””๋ ‰ํ† ๋ฆฌ์— ์žˆ๋Š” ํŒŒ์ผ์—์„œ๋งŒ ๋™์ž‘์„ ํ•˜๋„๋ก ํ•œ์ •

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## Logging ์„ค์ •
##---------------------------------------------------------------------------
log-warnings = 3                            # 0 ๋น„ํ™œ์„ฑํ™”
                                            # 1 ์ด์ƒ: ์ฟผ๋ฆฌ๋ฌธ ๋‹จ์œ„์˜ ๊ฒฝ๊ณ  ๋‚ด์šฉ๊นŒ์ง€ ์—๋Ÿฌ๋กœ๊ทธ์— ๊ธฐ๋ก

log_output = FILE,TABLE                     # ๋กœ๊ทธ ๊ธฐ๋ก ์œ ํ˜• (ํŒŒ์ผ๊ณผ ํ…Œ์ด๋ธ”์— ๊ธฐ๋ก)
log-error = /junyss/example/mariadb/log/error/mysqld.err # ์—๋Ÿฌ ๋กœ๊ทธํŒŒ์ผ ๊ฒฝ๋กœ

general_log = OFF                           # ์ œ๋„ˆ๋Ÿด ๋กœ๊ทธ ๋น„ํ™œ์„ฑํ™”
                                            # DB์—์„œ ์ผ์–ด๋‚˜๋Š” ๋ชจ๋“  ์ž‘์—…์— ๋Œ€ํ•œ ๋กœ๊ทธ๋ฅผ ๋‚จ๊ธฐ๊ฒŒ ๋˜๋ฏ€๋กœ ํ•„์š”ํ•  ๋•Œ๋งŒ ON์œผ๋กœ ์„ค์ •ํ•ด์„œ ์‚ฌ์šฉ
general_log_file = /junyss/example/mariadb/general/mysvc01-general.log    # ์ œ๋„ˆ๋Ÿด ๋กœ๊ทธํŒŒ์ผ ๊ฒฝ๋กœ

slow_query_log = ON                         # ๋Š๋ฆฐ ์ฟผ๋ฆฌ ๊ธฐ๋ก ํ™œ์„ฑํ™”
long_query_time = 0.5                       # ๋Š๋ฆฐ ์ฟผ๋ฆฌ์˜ ๊ธฐ์ค€ ์‹œ๊ฐ„(์ดˆ)
log-slow-verbosity = 'query_plan,innodb'
log_queries_not_using_indexes = OFF         # ์ธ๋ฑ์Šค๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์€ ์ฟผ๋ฆฌ ๊ธฐ๋ก ์—ฌ๋ถ€
slow_query_log_file = /junyss/example/mariadb/slow/mysvc01-slow.log # ๋Š๋ฆฐ ์ฟผ๋ฆฌ ๋กœ๊ทธํŒŒ์ผ ๊ฒฝ๋กœ


##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## DB ๊ธฐ๋ณธ ์„ค์ •
##---------------------------------------------------------------------------

skip-name-resolve                           # ์—ญDNS ๊ฒ€์ƒ‰ ๋น„ํ™œ์„ฑํ™” (IP ๊ธฐ๋ฐ˜์œผ๋กœ ์ ‘์†์„ ํ•˜๊ฒŒ ๋˜๋ฉด hostname lookup ๊ณผ์ • ์ƒ๋žต)

default_storage_engine='InnoDB'             # ๊ธฐ๋ณธ ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„ ์„ค์ •
lower_case_table_names = 1                  # ํ…Œ์ด๋ธ”๋ช…์„ ์†Œ๋ฌธ์ž๋กœ ์ฒ˜๋ฆฌ
sysdate-is-now                              # SYSDATE ๊ตฌ๋ฌธ์„ NOW์™€ ๋™์ผํ•˜๊ฒŒ ์ฒ˜๋ฆฌ

sql_mode="TRADITIONAL,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI_QUOTES"
# sql_mode ์„ค๋ช… : SQL๋ฌธ ์‚ฌ์šฉ ์ œํ•œ = ์ฟผ๋ฆฌ ์ ๊ฒ€ ์ˆ˜์ค€
# TRADITIONAL = STRICT_TRANS_TABLES,STRICT_ALL_TABLES = ์ž˜๋ชป๋œ ๊ฐ’์ด ์ปฌ๋Ÿผ์— ์ž…๋ ฅ๋˜๊ฑฐ๋‚˜ ์—…๋ฐ์ดํŠธ๋  ๋•Œ ์—๋Ÿฌ๋ฅผ ๋ฐ˜ํ™˜ํ•จ
#              ,NO_ZERO_IN_DATE,NO_ZERO_DATE = ๋‚ ์งœํƒ€์ž…์— 0000-00-00 ์ž…๋ ฅ ๋ชป ํ•˜๊ฒŒ ํ•จ
#              ,ERROR_FOR_DIVISION_BY_ZERO = 0์œผ๋กœ ๋‚˜๋ˆŒ ๋•Œ๋Š” ์˜ค๋ฅ˜ ๋ฐœ์ƒ์‹œํ‚ด
#              ,NO_AUTO_CREATE_USER = ๊ถŒํ•œ ๋ถ€์—ฌ ๋ฌธ์žฅ์ด ์‹คํ–‰๋œ๋‹ค๊ณ  ํ•ด์„œ ์ž๋™์œผ๋กœ ์œ ์ €๋ฅผ ์ƒ์„ฑํ•˜์ง€ ์•Š๊ฒŒ ํ•จ
#              ,NO_ENGINE_SUBSTITUTION = ๊ธฐ๋ณธ ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„์˜ ์ž๋™ ๋Œ€์ฒด๋ฅผ ๋ฐฉ์ง€
# IGNORE_SPACE : ํ”„๋กœ์‹œ์ €๋‚˜ ํ•จ์ˆ˜๋ช…๊ณผ ๊ด„ํ˜ธ ์‚ฌ์ด์˜ ๊ณต๋ฐฑ ๋ฌด์‹œ
# ONLY_FULL_GROUP_BY : ๊ทธ๋ฃนํ•‘ ์ž‘์—…์„ ํ•  ๋•Œ GROUP BY ์ ˆ์— ๊ทธ๋ฃนํ•‘ ํ‚ค ์ปฌ๋Ÿผ๋“ค์ด ๋‹ค ์žˆ์–ด์•ผ๋งŒ ํ•จ
# ANSI_QUOTES : ํ™‘๋”ฐ์˜ดํ‘œ๋งŒ ๋ฌธ์ž์—ด ๊ฐ’ ํ‘œ์‹œ๋กœ ์‚ฌ์šฉ, ์Œ๋”ฐ์˜ดํ‘œ๋Š” ๋ฌธ์ž์—ด ๋ฆฌํ„ฐ๋ฅผ ํ‘œ๊ธฐ์— ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Œ
# PAD_CHAR_TO_FULL_LENGTH : MariaDB/MySQL์€ ๊ธฐ๋ณธ์ ์œผ๋กœ CHAR ํƒ€์ž…๋„ VARCHAR ์ฒ˜๋Ÿผ ๋ฌธ์ž์—ด ๋’ค ๊ณต๋ฐฑ ๋ฌธ์ž๋ฅผ ์ œ๊ฑฐํ•˜๋Š”๋ฐ, ๊ณต๋ฐฑ์„ ์ œ๊ฑฐํ•˜์ง€ ์•Š๊ณ  ์ฑ„์šฐ๊ฒŒ ํ•˜๋ ค๋ฉด ์„ค์ •ํ•จ

#feedback = ON                              # MariaDB๋กœ ์—๋Ÿฌ ๋‚ด์šฉ ๋ณด๋‚ด๊ธฐ
event_scheduler = ON                        # ์ด๋ฒคํŠธ์Šค์ผ€์ค„๋Ÿฌ(cron, Oracle์˜ Job๊ณผ ๊ฐ™์€ ์—ญํ• ) ํ™œ์„ฑํ™”
performance_schema = ON                     # performance_schema ํ™œ์„ฑํ™”
#performance_schema_max_digest_length=10240 # digest์˜ ์ตœ๋Œ€ ๊ธธ์ด (digest:์ •ํ˜•ํ™”์‹œํ‚จ ์ฟผ๋ฆฌ๋ฌธ, ์ƒ์ˆ˜๋ถ€๋ถ„ ๋“ฑ์„ ํŒจํ„ดํ™”์‹œํ‚จ๋‹ค.)
plugin-load = server_audit


##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## ๋ฌธ์ž์—ด ์„ค์ •
##---------------------------------------------------------------------------
skip-character-set-client-handshake         # ํด๋ผ์ด์–ธํŠธ์—์„œ ๋ณด๋‚ด์ง€๋Š” ๋ฌธ์ž์…‹ ์ •๋ณด๋ฅผ ๋ฌด์‹œํ•˜๊ณ  ์„œ๋ฒ„์˜ ๋ฌธ์ž์…‹ ์‚ฌ์šฉ
character_set_server = utf8mb4
collation_server = utf8mb4_bin
init_connect='SET collation_connection = utf8mb4_bin'
init_connect='SET NAMES utf8mb4'


##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## Transaction ์„ค์ •
##---------------------------------------------------------------------------
autocommit = ON                             # autocommit ํ™œ์„ฑํ™” ์—ฌ๋ถ€
transaction_isolation = "READ-COMMITTED"    # replication์„ ํ•  ๋•Œ๋Š” "๋ ˆ์ฝ”๋“œ ๊ธฐ๋ฐ˜ ๋ณต์ œ"๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ํ•จ
# transaction_isolation ์„ค๋ช…
# . READ UNCOMMITTED
# ๋‹ค๋ฅธ ํŠธ๋žœ์žญ์…˜์ด Commit ์ „ ์ƒํƒœ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Œ
# Binary Log๊ฐ€ ์ž๋™์œผ๋กœ Row Based๋กœ ๊ธฐ๋ก๋จ (Statement์„ค์ • ๋ถˆ๊ฐ€, Mixed ์„ค์ • ์‹œ ์ž๋™ ๋ณ€ํ™˜)
# . READ-COMMITTED
# Commit๋œ ๋‚ด์—ญ์„ ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ์ƒํƒœ๋กœ, ํŠธ๋žœ์žญ์…˜์ด ๋‹ค๋ฅด๋”๋ผ๋„ ํŠน์ • ํƒ€ ํŠธ๋žœ์žญ์…˜์ด Commit์„ ์ˆ˜ํ–‰ํ•˜๋ฉด ํ•ด๋‹น ๋ฐ์ดํ„ฐ๋ฅผ Readํ•  ์ˆ˜ ์žˆ์Œ
# Binary Log๊ฐ€ ์ž๋™์œผ๋กœ Row Based๋กœ ๊ธฐ๋ก๋จ (Statement์„ค์ • ๋ถˆ๊ฐ€, Mixed ์„ค์ • ์‹œ ์ž๋™ ๋ณ€ํ™˜)
# . REPEATABLE READ (๊ธฐ๋ณธ)
# MySQL InnoDB ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„์˜ Default Isolation Level
# Select ์‹œ ํ˜„์žฌ ๋ฐ์ดํ„ฐ ๋ฒ„์ „์˜ Snapshot์„ ๋งŒ๋“ค๊ณ , ๊ทธ Snapshot์œผ๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์กฐํšŒ
# ๋ฐ์ดํ„ฐ์— ๊ด€ํ•ด์„œ ์•”๋ฌต์ ์œผ๋กœ Lock๊ณผ ๋น„์Šทํ•œ ํšจ๊ณผ๊ฐ€ ๋‚˜ํƒ€๋‚จ. ์ฆ‰, Select ์ž‘์—…์ด ์ข…๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ํ•ด๋‹น ๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ ์ž‘์—… ๋ถˆ๊ฐ€
# ๋™์ผ ํŠธ๋žœ์žญ์…˜ ๋‚ด์—์„œ ๋ฐ์ดํ„ฐ ์ผ๊ด€์„ฑ์„ ๋ณด์žฅํ•˜๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค์‹œ ์ฝ๊ธฐ ์œ„ํ•ด์„œ๋Š” ํŠธ๋žœ์žญ์…˜์„ ๋‹ค์‹œ ์‹œ์ž‘ํ•ด์•ผ ํ•จ
# . SERIALIZABLE
# ๊ฐ€์žฅ ๋†’์€ Isolation Level๋กœ ํŠธ๋žœ์žญ์…˜์ด ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ SELECT ๋ฌธ์žฅ์ด ์‚ฌ์šฉํ•˜๋Š” ๋ชจ๋“  ๋ฐ์ดํ„ฐ์— Shared Lock์ด ๊ฑธ๋ฆผ
# ๋‹ค๋ฅธ ํŠธ๋žœ์žญ์…˜์—์„œ๋Š” ํ•ด๋‹น ์˜์—ญ์— ๊ด€ํ•œ ๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์ž…๋ ฅ๋„ ๋ถˆ๊ฐ€

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## ๋ณด์•ˆ ์„ค์ •
##---------------------------------------------------------------------------
#skip-external-locking                      # ์™ธ๋ถ€(TCP/IP) ์ž ๊ธˆ ๋น„ํ™œ์„ฑํ™”
enable-secure-auth                          # ์„œ๋ฒ„๋กœ ๊ตฌ๋ฒ„์ „(4.1๋ฒ„์ „ ์ดํ•˜) ํฌ๋ฉง์œผ๋กœ ๋œ ํŒจ์Šค์›Œ๋“œ ์ „๋‹ฌ ๋น„ํ™œ์„ฑํ™”
symbolic-links = OFF                        # ์‹ฌ๋ณผ๋ฆญ ๋งํฌ ๋น„ํ™œ์„ฑํ™”


##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## Connection ์„ค์ •
##---------------------------------------------------------------------------
thread_handling = one-thread-per-connection # ์“ฐ๋ ˆ๋“œํ’€(Thread Pool) ์‚ฌ์šฉ ์—ฌ๋ถ€
                                            # ์“ฐ๋ ˆ๋“œํ’€์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด pool-of-threads ์œผ๋กœ ์„ค์ •

max_connections = 250                       # ํ—ˆ์šฉ ๊ฐ€๋Šฅํ•œ ์ตœ๋Œ€ ๋™์‹œ ์ ‘์†์ˆ˜, ๊ฐ๊ฐ์˜ ์ปค๋„ฅ์…˜์€ ์ตœ์†Œ thread_stack์˜ ์‚ฌ์ด์ฆˆ๋งŒํผ์˜ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ
max_connect_errors = 1000                   # ๊ณ„์†์ ์œผ๋กœ ๋ฌธ์ œ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ํด๋ผ์ด์–ธํŠธ๋ฅผ ๋ช‡๋ฒˆ์งธ ์žฌ์‹œ๋„ํ›„ blockํ• ์ง€ ์ง€์ •
                                            # ํ•œ๋ฒˆ block๋˜๋ฉด, ์„œ๋ฒ„๋ฅผ ์žฌ์‹œ์ž‘ํ•˜๊ฑฐ๋‚˜ flush host๋ช…๋ น์„ ์‹คํ–‰ํ•˜๊ธฐ ์ „๊นŒ์ง€ ์ ‘์† ๋ถˆ๊ฐ€
back_log = 100                              # max_connections ์ด์ƒ์˜ connection์ด ๋Œ€๋Ÿ‰์œผ๋กœ ๋ชฐ๋ฆด ๋•Œ ํ์— ๋Œ€๊ธฐ๊ฐ€๋Šฅํ•œ ์ปค๋„ฅ์…˜์˜ ๊ฐฏ์ˆ˜
thread_cache_size = 100                     # ์žฌ ์‚ฌ์šฉ์„ ์œ„ํ•ด ๋ณด๊ด€ํ•  ์“ฐ๋ž˜๋“œ ์ˆ˜, thread_created๊ฐ€ ๋†’์„ ๊ฒฝ์šฐ ์ฆ๊ฐ€๋จ
                                            # THREADS_CONNECTED ์ƒํƒœ๊ฐ’์˜ ํ”ผํฌ๋ณด๋‹ค ์•ฝ๊ฐ„ ๋‚ฎ๊ฒŒ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•จ
wait_timeout = 28800                        # ์ ‘์†ํ•œ ํ›„ ์ฟผ๋ฆฌ๊ฐ€ ๋“ค์–ด์˜ฌ ๋–„๊นŒ์ง€ ๋Œ€๊ธฐํ•˜๋Š” ์‹œ๊ฐ„(์ดˆ) = noninteractive ์ปค๋„ฅ์…˜ ๋‹ซ๊ธฐ๊นŒ์ง€์˜ ์‹œ๊ฐ„
lock_wait_timeout = 28800                   # metadata lock์„ ํš๋“ํ•˜๊ธฐ ์œ„ํ•ด ๋Œ€๊ธฐํ•˜๋Š” ์‹œ๊ฐ„(์ดˆ), ๊ธฐ๋ณธ์€ 1๋…„์ž„
interactive_timeout = 3600                  # "mysql>"๊ณผ ๊ฐ™์€ ์ฝ˜์†”์ด๋‚˜ ํ„ฐ๋ฏธ๋„ ์ƒ์—์„œ ํด๋ผ์ด์–ธํŠธ์˜ ์ ‘์†์„ ์‹œ๊ฐ„(์ดˆ), ๊ธฐ๋ณธ 8์‹œ๊ฐ„์ด์ง€๋งŒ 1์‹œ๊ฐ„ ์„ค์ • ๊ถŒ์žฅ
connect_timeout = 10                        # mysqld ๋ฐ๋ชฌ์ด ํด๋ผ์ด์–ธํŠธ๋กœ ๋ถ€ํ„ฐ ์ ‘์†์š”์ฒญ์„ ๋ฐ›๋Š” ๊ฒฝ์šฐ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์‹œ๊ฐ„(์ดˆ)

#net_retry_count = 10                       # ํ†ต์‹ ์ด ์ž˜๋ชป๋˜์–ด ์‹คํŒจํ•  ๋•Œ, ๋ช‡ ๋ฒˆ๊นŒ์ง€ ์žฌ์‹œ๋„ํ• ์ง€
net_read_timeout = 60                       # ์ปค๋„ฅ์…˜์œผ๋กœ๋ถ€ํ„ฐ ์ฝ๊ธฐ๊ฐ€ ์•ˆ ๋œ๋‹ค๊ณ  ํŒ๋‹จํ•˜๊ธฐ ์ „์— ๋ฐ์ดํ„ฐ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์‹œ๊ฐ„(์ดˆ)
net_write_timeout = 60                      # ์ปค๋„ฅ์…˜์œผ๋กœ ์“ฐ๊ธฐ๊ฐ€ ์•ˆ ๋œ๋‹ค๊ณ  ํŒ๋‹จํ•˜๊ธฐ ์ „์— ๊ธฐ๋‹ค๋ฆฌ๋Š” ์‹œ๊ฐ„(์ดˆ)

open_files_limit = 3000                     # mysql์ด ์˜คํ”ˆํ• ์ˆ˜ ์žˆ๋Š” file(์ •ํ™•ํžˆ๋Š” file descripter)๊ฐœ์ˆ˜
                                            # ๊ฐ€๋Šฅํ•˜๋ฉด 5000์œผ๋กœ ์„ค์ •ํ•˜๋Š”๋ฐ OS limit์— ๋”ฐ๋ผ ์žฌ์กฐ์ • ๋ ์ˆ˜ ์žˆ๋‹ค
                                            # ์‹ค์ œ๋กœ๋Š” ์ด ๊ฐ’์— ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š๊ณ , OS์˜ nofile(open files) ์ œํ•œ์ด ์ ์šฉ๋จ
table_open_cache = 4000                     # DB์ „์ฒด์—์„œ ์˜คํ”ˆํ•  ์ˆ˜ ์žˆ๋Š” ํ…Œ์ด๋ธ” ๊ฐฏ์ˆ˜
table-definition-cache = 4000               # ์บ์‹ฑํ•ด ๋†“์„ (.frm ํŒŒ์ผ์—์„œ ์ถ”์ถœํ•œ)ํ…Œ์ด๋ธ” ์ •์˜ ๊ฐฏ์ˆ˜, ํ…Œ์ด๋ธ”์ด ๋งŽ์œผ๋ฉด ํฌ๊ฒŒ ์„ค์ •

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## Thread Pool ์„ค์ • - thread_handling = pool-of-threads ์ผ ๋•Œ๋งŒ ์˜๋ฏธ ์žˆ์Œ
##---------------------------------------------------------------------------
# thread_pool_size = 4                      # ์“ฐ๋ ˆ๋“œ ๊ทธ๋ฃน ๊ฐฏ์ˆ˜, ๊ธฐ๋ณธ์€ CPU ๊ฐฏ์ˆ˜์™€ ๊ฐ™์Œ
# (sleep์ด๋‚˜ wait ์ƒํƒœ์ธ ์“ฐ๋ ˆ๋“œ ์ œ์™ธํ•˜๊ณ ) CPU๋ฅผ ๋™์‹œ์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์“ฐ๋ ˆ๋“œ ๊ฐฏ์ˆ˜
# ๋ฆฌ๋ˆ…์Šค๋‚˜ ์œ ๋‹‰์Šค ๊ณ„์—ด์ผ ๋•Œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” ์„ค์ •
# thread_pool_max_threads = 500             # ์“ฐ๋ ˆ๋“œํ’€์— ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ€ ์“ฐ๋ ˆ๋“œ ๊ฐฏ์ˆ˜
# thread_pool_idle_timeout = 60             # idle ์ƒํƒœ์ธ ์“ฐ๋ ˆ๋“œ๋ฅผ ์ •๋ฆฌํ•˜๊ธฐ ์ „์— ๋Œ€๊ธฐํ•˜๋Š” ์‹œ๊ฐ„(์ดˆ)
# thread_pool_stall_limit = 500             # ์“ฐ๋ ˆ๋“œ ๊ต์ฐฉ ์ƒํƒœ ๊ฒ€์‚ฌ ๊ฐ„๊ฒฉ(๋ฐ€๋ฆฌ์ดˆ)
# ์“ฐ๋ ˆ๋“œ ๊ฐฏ์ˆ˜๊ฐ€ thread_pool_max_threads์— ๋„๋‹ฌํ•˜๋ฉด ์“ฐ๋ ˆ๋“œ๋Š” ๋” ์ด์ƒ ์ƒ์„ฑ๋˜์ง€ ์•Š๋Š”๋‹ค.

# thread_pool_oversubscribe = 3             # internal ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ž„์˜๋กœ ์ˆ˜์ •ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ข‹์Œ
# thread_pool_size * thread_pool_oversubscribe = DB์—์„œ ๋™์‹œ์— active๋˜์–ด CPU๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์“ฐ๋ ˆ๋“œ ๊ฐฏ์ˆ˜

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## Connection ๋ฉ”๋ชจ๋ฆฌ ์„ค์ •
##---------------------------------------------------------------------------
sort_buffer_size = 256K         # (์ธ๋ฑ์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š”) ์ •๋ ฌ์— ํ•„์š”ํ•œ ๋ฒ„ํผ์˜ ํฌ๊ธฐ, ORDER BY ๋˜๋Š” GROUP BY ์—ฐ์‚ฐ ์†๋„์™€ ๊ด€๋ จ
join_buffer_size = 256K         # ์กฐ์ธ์ด ํ…Œ์ด๋ธ”์„ ํ’€์Šค์บ” ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฒ„ํผํฌ๊ธฐ, ๋“œ๋ฆฌ๋ธ ํ…Œ์ด๋ธ”์ด FULL SCANํ•  ๋•Œ ์‚ฌ์šฉ๋จ
read_buffer_size = 256K         # ํ…Œ์ด๋ธ” ์Šค์บ”์— ํ•„์š”ํ•œ ๋ฒ„ํผํฌ๊ธฐ
read_rnd_buffer_size = 256K     # ๋””์Šคํฌ ๊ฒ€์ƒ‰์„ ํ”ผํ•˜๊ธฐ์œ„ํ•œ ๋žœ๋ค ์ฝ๊ธฐ ๋ฒ„ํผํฌ๊ธฐ, ์ •๋ ฌ ๋Œ€์ƒ์ด ์ปค์„œ two pass ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์“ธ ๋•Œ๋งŒ ์‚ฌ์šฉ

#thread_stack = 256K            # ์“ฐ๋ ˆ๋“œ ํ•˜๋‚˜์˜ ์Šคํƒ ์‚ฌ์ด์ฆˆ (๊ธฐ๋ณธ 64bit ์‹œ์Šคํ…œ์˜ ๊ธฐ๋ณธ 256KB)

net_buffer_length = 16K         # ํด๋ผ์ด์–ธํŠธ์— ๋ณด๋‚ด๋Š” ์ดˆ๊ธฐ ๋ฉ”์‹œ์ง€์˜ ๋ฐ”์ดํŠธ ์ˆ˜
max_allowed_packet = 16M        # ํ•œ ํŒจํ‚ท์˜ ์ตœ๋Œ€ ํฌ๊ธฐ
group_concat_max_len = 32M      # GROUP_CONCAT() ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ€ ํฌ๊ธฐ

max_heap_table_size = 32M       # MEMORY ํ…Œ์ด๋ธ”์˜ ์ตœ๋Œ€ ํฌ๊ธฐ
tmp_table_size = 1M             # ๋ฉ”๋ชจ๋ฆฌ์— ์ƒ์„ฑ๋  ์ž„์‹œ ํ…Œ์ด๋ธ”์˜ ์ตœ๋Œ€ ํฌ๊ธฐ, ์ด ๊ฐ’์„ ์ดˆ๊ณผํ•˜๋ฉด ๋””์Šคํฌ์— ์ž„์‹œ ํ…Œ์ด๋ธ”์„ ์”€

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## ์ฟผ๋ฆฌ ์บ์‹œ ์„ค์ •
##---------------------------------------------------------------------------
query_cache_size = 32M          # ์ฟผ๋ฆฌ ๊ฒฐ๊ณผ๋ฅผ ์บ์‹ฑํ•˜๊ธฐ ์œ„ํ•ด ํ• ๋‹นํ•˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ํฌ๊ธฐ (DB์ „์ฒด)
query_cache_limit = 2M          # ์ฟผ๋ฆฌ ๊ฒฐ๊ณผ๊ฐ€ ์ด ๊ฐ’๋ณด๋‹ค ํฌ๋ฉด ์บ์‹ฑ ์•ˆ ํ•จ (๊ธฐ๋ณธ์€ 1M)
query_cache_type = DEMAND       # ์ฟผ๋ฆฌ์—์„œ ํžŒํŠธ๋กœ ์ฟผ๋ฆฌ ์บ์‹œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฒ ๋‹ค๊ณ  ์„ค์ •ํ•œ ๊ฒฝ์šฐ์—๋งŒ ์ฟผ๋ฆฌ ์บ์‹œ ์‚ฌ์šฉ
                                # 0 or OFF : ์ฟผ๋ฆฌ ์บ์‹œ ์‚ฌ์šฉ ์•ˆ ํ•จ, ์ฟผ๋ฆฌ ์บ์‹œ๋ฅผ ์•ˆ ์“ฐ๋ ค๋ฉด query_cache_size๋„ 0์œผ๋กœ ์„ค์ •ํ•ด์•ผ ํ•จ
                                # 1 or ON : SQL_NO_CACHE๋ฅผ ์„ค์ •ํ•˜์ง€ ์•Š์€ ๋ชจ๋“  ์ฟผ๋ฆฌ์˜ ๊ฒฐ๊ณผ๋ฅผ ์บ์‹ฑํ•จ
                                # 2 or DEMAND : SQL_CACHE๋กœ ์„ค์ •ํ•œ ์ฟผ๋ฆฌ์˜ ๊ฒฐ๊ณผ๋งŒ ์บ์‹ฑํ•จ

##---------------------------------------------------------------------------
# Author: ์ฃผ๋‹ˆ์“ฐ
# MariaDB ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ€ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์ด์ฆˆ
# innodb_buffer_pool_size + innodb_additional_mem_pool_size + innodb_log_buffer_size + key_buffer_size + query_cache_size
# + max_connections * ( read_buffer_size + read_rnd_buffer_size + sort_buffer_size + join_buffer_size + thread_stack + binlog_cache_size)
##---------------------------------------------------------------------------

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## InnoDB ์„ค์ •
##---------------------------------------------------------------------------
#innodb_page_size = 16K
#innodb_use_sys_malloc = ON                            # OS์—์„œ ์ œ๊ณต๋˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น๊ธฐ๋Šฅ ์‚ฌ์šฉ ์—ฌ๋ถ€, ON: InnoDB์—์„œ OS ์ž์›์„ ์‚ฌ์šฉ
                                                       # InnoDB์˜ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น๊ธฐ๋Šฅ๊ณผ OS์—์„œ ์ œ๊ณต๋˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ๊ธฐ๋Šฅ ์ค‘ ๋” ํšจ์œจ์ด ๋†’์€ ์ชฝ์„ ์„ ํƒํ•  ์ˆ˜ ์žˆ์Œ
innodb_buffer_pool_size = 512M                         # InnoDB ์—”์ง„์œผ๋กœ ๋œ ํ…Œ์ด๋ธ”๊ณผ ์ธ๋ฑ์Šค๋ฅผ ์บ์‹œํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”๋ชจ๋ฆฌ ๋ฒ„ํผ ํฌ๊ธฐ
                                                       # ์ดˆ๊ธฐ ์‹œ์Šคํ…œ ์ „์ฒด ๋ฌผ๋ฆฌ ๋ฉ”๋ชจ๋ฆฌ์˜ 40% ์ˆ˜์ค€์œผ๋กœ ์„ค์ •ํ•˜๊ณ  ์‚ฌ์šฉ๋Ÿ‰์— ๋”ฐ๋ผ ์ฆ๊ฐ
innodb_buffer_pool_instances = 2                       # ๋ฒ„ํผํ’€์˜ ๊ฐฏ์ˆ˜, ์ ์ ˆํ•œ ๊ฐฏ์ˆ˜๋กœ ๋‚˜๋ˆ„๋ฉด ๋ฎคํ…์Šค(mutex) ๊ฒฝํ•ฉ์ด ์ค„์–ด๋“ค์–ด DB ๋™์‹œ ์ฒ˜๋ฆฌ ์„ฑ๋Šฅ์„ ๋†’์—ฌ์คŒ
                                                       # ๊ฐ๊ฐ์˜ ๋ฒ„ํผํ’€์€ ๊ฐ๊ฐ์˜ ํ”Œ๋Ÿฌ์‰ฌ ๋ฆฌ์ŠคํŠธ ๋ฎคํ…์Šค(mutex)๋ฅผ ๊ฐ€์ง (์•„๋งˆ LRU๋ฆฌ์ŠคํŠธ๋„ ๊ฐ€์งˆ ๋“ฏ)
                                                       # ๊ฐ ๋ฒ„ํผํ’€์€ InnoDB ์—”์ง„์ด ์ž๋™์œผ๋กœ ์ ์ ˆํžˆ ๋ฐฐ๋ถ„ํ•ด์„œ ์‚ฌ์šฉํ•จ
#innodb_additional_mem_pool_size = 16M                 # DEPRECATED๋จ, ๋ฐ์ดํ„ฐ ๋””๋ ‰ํ† ๋ฆฌ ์ •๋ณด์™€ ๋‚ด๋ถ€ ๋ฐ์ดํƒ€ ๊ตฌ์กฐ๋ฅผ ์ €์žฅํ•˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ํ’€์˜ ํฌ๊ธฐ

innodb_data_file_path=ibdata1:32M;ibdata2:32M:autoextend # ์‹œ์Šคํ…œํ…Œ์ด๋ธ”์ŠคํŽ˜์ด์Šค - ํŒŒ์ผ๋ช…:์ดˆ๊ธฐํฌ๊ธฐ:์ž๋™์ฆ๊ฐ€:์ตœ๋Œ€ํฌ๊ธฐ
innodb_file_per_table = 1                              # ํ…Œ์ด๋ธ” ๋‹จ์œ„๋กœ ํ…Œ์ด๋ธ”์ŠคํŽ˜์ด์Šค ํ• ๋‹น, ํ™œ์„ฑ์‹œ ํ…Œ์ด๋ธ”๋ณ„๋กœ .frm, .ibd ๊ฐ๊ฐ ์ƒ์„ฑ
innodb_data_home_dir = /data/mysvc/MARIASVC            # ํ…Œ์ด๋ธ” ์ƒ์„ฑ ๊ธฐ๋ณธ ๊ฒฝ๋กœ
#innodb_autoextend_increment = 100                     # ํ…Œ์ด๋ธ”์ŠคํŽ˜์ด์Šค ์ž๋™ ํ™•์ •์‹œ ํฌ๊ธฐ

innodb_log_buffer_size = 4M                            # ๋กœ๊ทธ(redo) ๋ฒ„ํผ ํฌ๊ธฐ
                                                       # ํด์ˆ˜๋ก ๋””์Šคํฌ ์‚ฌ์šฉ๋Ÿ‰์ด ์ค„์–ด์„œ ์„ฑ๋Šฅ์ด ํ–ฅ์ƒ๋˜์ง€๋งŒ ์‹œ์Šคํ…œ ๋‹ค์šด์‹œ ์†์‹ค๋˜๋Š” ํŠธ๋žœ์žญ์…˜ ์–‘๋„ ์ฆ๊ฐ€๋จ
                                                       # ํฌ๊ธฐ๊ฐ€ ์ž‘์œผ๋ฉด ๋กœ๊ทธ๋ฒ„ํผ๋ฅผ ๋กœ๊ทธํŒŒ์ผ๋กœ ์“ฐ๊ธฐ ์œ„ํ•œ ๋ถ€ํ•˜๊ฐ€ ๋งŽ์ด ๋ฐœ์ƒํ•  ์ˆ˜๋„ ์žˆ์Œ
innodb_log_group_home_dir = /data001/mysvc01/MARIASVC  # ๋กœ๊ทธ(redo) ๊ฒฝ๋กœ
innodb_log_files_in_group = 3                          # ๋กœ๊ทธ(redo) ํŒŒ์ผ ๊ฐฏ์ˆ˜
innodb_log_file_size = 64M                             # ๋กœ๊ทธ(redo) ํŒŒ์ผ ํฌ๊ธฐ
                                                       # ์ผ๋ฐ˜์ ์œผ๋กœ (innodb_buffer_pool_size/innodb_log_files_in_group)๋ฅผ ์ ์ • ๊ฐ’์œผ๋กœ ๋ณธ๋‹ค.

innodb-support-xa = OFF                                # ํŠธ๋ Œ์ ์…˜ two-phase commit ์ง€์›, ๋””์Šคํฌ ํ”Œ๋Ÿฌ์‹œ ํšŸ์ˆ˜๋ฅผ ์ค„์—ฌ ์„ฑ๋Šฅํ•ญ์ƒ
                                                       # ๋ถ„์‚ฐ๋ฐ์ดํ„ฐ ๊ธฐ๋Šฅ (2-PhaseCommit)

innodb_buffer_pool_dump_at_shutdown = 1                # DB shutdownํ•  ๋•Œ innodb_log_buffer์— ์žˆ๋˜ ๋‚ด์šฉ์„ dump ํŒŒ์ผ๋กœ ๋‚ด๋ฆผ
innodb_buffer_pool_filename = innodb_buffer_pool_dump  # DB shutdownํ•  ๋•Œ innodb_log_buffer์— ์žˆ๋˜ ๋‚ด์šฉ์„ ๋‹ด์„ dump ํŒŒ์ผ๋ช…
innodb_buffer_pool_load_at_startup = 1                 # DB startupํ•  ๋•Œ dumpํŒŒ์ผ๋กœ ๋ฐ›์•„ ๋†จ๋˜ ๋‚ด์šฉ์„ innodb_log_buffer์— ์˜ฌ๋ฆผ

innodb_thread_concurrency = 4             # InnoDB๊ฐ€ ๋™์‹œ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•œ ์ตœ๋Œ€ ์‹œ์Šคํ…œ ์“ฐ๋ž˜๋“œ ์ˆ˜
                                          # CPU์˜ 2~4๋ฐฐ ๊ถŒ์žฅ, 0์œผ๋กœ ์„ค์ •ํ•˜๋ฉด ๋™์‹œ์„ฑ์ด ๋น„ํ™œ์„ฑํ™” ๋จ
#innodb_thread_sleep_delay=0              # InnoDB queue์— ๋“ค์–ด๊ฐ€๊ธฐ์ „์— ์–ผ๋งˆ๋‚˜ sleepํ• ๊ฒƒ์ธ๊ฐ€
                                          # innodb_thread_concurency์— ๋„๋‹ฌํ•˜๋ฉด ์ƒˆ๋กœ์šด ์“ฐ๋ ˆ๋“œ๋Š” innodb_thread_sleep_delay ๋™์•ˆ Sleep ํ•จ
                                          # innodb_thread_concurency = 0 ์ด๋ฉด ์ด ๊ฐ’์Œ ๋ฌด์‹œ๋จ
#innodb_adaptive_max_sleep_delay = 150000 # 0 ์ด์ƒ์˜ ๊ฐ’์œผ๋กœ ์ง€์ •ํ•˜๋ฉด, InnoDB๊ฐ€ innodb_thread_sleep_delay๋ฅผ ์ž๋™์œผ๋กœ ์กฐ์ •
#innodb_concurrency_tickets = 500         # ํ•œ๋ฒˆ ์Šค์ผ€์ค„๋ง๋œ ์“ฐ๋ ˆ๋“œ๋Š” ์„ค์ •๋œ ํ‹ฐ์ผ“๊ฐœ์ˆ˜๋งŒํผ ์ž์œ ๋กญ๊ฒŒ InnoDB๋ฅผ ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ๋‹ค
                                          # ์—ฌ๋Ÿฌ ์“ฐ๋ ˆ๋“œ๊ฐ€ innodb_thread_concurrency์— ๋„๋‹ฌํ•˜๋ฉด ํ•˜๋‚˜์˜ ์“ฐ๋ ˆ๋“œ๋งŒ ํ์— ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ์Œ
                                          # ํ•˜๋‚˜์˜ ์“ฐ๋ ˆ๋“œ๊ฐ€ InnoDB์— ๋“ค์–ด๊ฐ€๊ฒŒ ๋˜๋ฉด, innodb_concurrency_tickets์˜ ๊ฐ’๊ณผ ์ผ์น˜ํ•˜๋Š” “์ž์œ  ํ‹ฐ์ผ“”์˜ ์ˆซ์ž๊ฐ€ ์ฃผ์–ด์ง€๊ณ ,
                                          # ์“ฐ๋ ˆ๋“œ๊ฐ€ ์ž์‹ ์˜ ํ‹ฐ์ผ“์„ ์‚ฌ์šฉํ•˜๊ธฐ ์ „ ๊นŒ์ง€๋Š” ์ž์œ ๋กญ๊ฒŒ InnoDB์— ๋“ค์–ด๊ฐ€๊ณ  ๋‚˜์˜ฌ ์ˆ˜๊ฐ€ ์žˆ๋‹ค.
                                          # ์ด๋Ÿฐ ํ›„์—๋Š”, ์“ฐ๋ ˆ๋“œ๋Š” ๋‹ค์‹œ๊ธˆ ์ผ๊ด€์„ฑ ๊ฒ€์‚ฌ๋ฅผ ํ•˜๊ณ  InnoDB์— ๋‹ค์‹œ ๋“ค์–ด๊ฐ€๋ ค๊ณ  ์‹œ๋„ํ•˜๊ฒŒ ๋œ๋‹ค

# InnoDB๋Š” IO request๋ฅผ background threads์— ๊ฐ€๋Šฅํ•œํ•œ ๋™๋“ฑํ•˜๊ฒŒ ๋ถ„๋ฐฐํ•˜๊ณ , ๋™์ผํ•œ extent์— ๋Œ€ํ•œ read requests๋Š” ๋™์ผํ•œ thread์—๊ฒŒ ํ• ๋‹นํ•จ
innodb_read_io_threads = 4           # InnoDB ์ฝ๊ธฐ ์ž‘์—…์„ ์œ„ํ•œ I/O ์“ฐ๋ ˆ๋“œ์˜ ์ˆ˜, ์ฃผ๋ชฉ์ : read-ahead requests
                                     # SHOW ENGINE INNODB STATUS ์—์„œ pending read requests๊ฐ€ 64 x innodb_read_io_threads์ด์ƒ์ด๋ผ๋ฉด, 
                                     # innodb_read_io_threads๋ฅผ ๋” ํ• ๋‹นํ•˜๋Š” ๊ฒƒ์„ ๊ณ ๋ ค
innodb_write_io_threads = 4          # InnoDB ์“ฐ๊ธฐ ์ž‘์—…์„ ์œ„ํ•œ I/O ์“ฐ๋ ˆ๋“œ์˜ ์ˆ˜
# read-ahead ๋ž€?
# ํ•˜๋‚˜์˜ extent(64๊ฐœ pages group)์„ ๋ชจ๋‘ buffer pool์— prefetchํ•˜๋Š” ์ž‘์—…. (asynchronous request์ž„)
# ์ด๋“ค ํŽ˜์ด์ง€๋„ ๊ณง ์ฝํ˜€์งˆ๊ฑฐ๋ผ๋Š” ๊ฐ€์ •ํ•˜์— ๋ชจ๋‘ ๋ฒ„ํผ์— ์˜ฌ๋ฆฌ๋Š” ๊ฒƒ
# ์•Œ๊ณ ๋ฆฌ์ฆ˜)
# linear read-ahead technique: ๋ฒ„ํผํ’€ ์•ˆ์— ์ˆœ์ฐจ์ ์œผ๋กœ ์ฝํ˜€์ง„ ํŽ˜์ด์ง€ ๊ฐœ์ˆ˜๋กœ ํŒ๋‹จ
#                              ๋งŒ์•ฝ ํ•˜๋‚˜์˜ extent๋‚ด์—์„œ ์ˆœ์ฐจ์ ์œผ๋กœ ์ฝํ˜€์ง„ ํŽ˜์ด์ง€ ๊ฐœ์ˆ˜๊ฐ€ innodb_read_ahead_threshold ์ด์ƒ์ด๋ฉด ๋‹ค์Œ extent์ „์ฒด ํŽ˜์ด์ง€๋ฅผ read-ahead
# random read-ahead technique: ๋ฒ„ํผํ’€ ์•ˆ์— ์กด์žฌํ•˜๋Š” ํŽ˜์ด์ง€ ๊ฐœ์ˆ˜๋กœ ํŒ๋‹จ(์ˆœ์ฐจ์ ์ธ์ง€ ์—ฌ๋ถ€์™€ ๋ฌด๊ด€ํ•จ)
#                              ๋งŒ์•ฝ ํ•œ extent๋‚ด์˜ 13๊ฐœ์˜ ์—ฐ์†๋œ ํŽ˜์ด์ง€๊ฐ€ ๋ฒ„ํผํ’€์— ์กด์žฌํ•œ๋‹ค๋ฉด, ํ•ด๋‹น extent์˜ ๋‚˜๋จธ์ง€ pages๋“ค์„ read-aheadํ•œ๋‹ค

innodb_lock_wait_timeout = 1200      # ํŠธ๋žœ์žญ์…˜ ๋ฝ(record lock)์„ ๋Œ€๊ธฐํ•˜๋Š” ์‹œ๊ฐ„(์ดˆ)

#innodb_flush_neighbors = 1          # InnoDB ๋ฒ„ํผํ’€์—์„œ ํŽ˜์ด์ง€ ํ”Œ๋Ÿฌ์‹œ๋ฅผ ํ•  ๋•Œ(=๋””์Šคํฌ๋กœ ๊ธฐ๋กํ•  ๋•Œ), ์ธ์ ‘ํ•œ ๋”ํ‹ฐ ํŽ˜์ด์ง€๋„ (๋‹จ์ผ I/O๋กœ) ํ”Œ๋Ÿฌ์‹œํ•  ์ง€ ๊ฒฐ์ •ํ•˜๋Š” ๋ณ€์ˆ˜
                                     # ๋žœ๋ค์•ก์„ธ์Šค ์“ฐ๊ธฐ ์„ฑ๋Šฅ์ด ๋–จ์–ด์ง€๋Š” HDD์—์„œ๋Š” ์ข‹์œผ๋‚˜, SSD์—์„œ๋Š” ๋น„ํ™œ์„ฑํ™”ํ•˜๋Š” ๊ฒƒ์ด ์„ฑ๋Šฅ์— ์œ ๋ฆฌํ•จ
                                     # 0: ํ•ด์ œ, 1: ๊ฐ™์€ extent์•ˆ์— ์—ฐ์†๋œ ๋”ํ‹ฐ ํŽ˜์ด์ง€๋ฅผ ๊ฐ™์ด ํ”Œ๋Ÿฌ์‹œํ•จ, 2: ๊ฐ™์€ extent์•ˆ์— ๋ชจ๋“  ๋”ํ‹ฐ ํŽ˜์ด์ง€๋ฅผ ํ”Œ๋Ÿฌ์‹œํ•จ

#innodb_io_capacity = 100            # ๋ฐฑ๊ทธ๋ผ์šด๋“œ ํ”Œ๋Ÿฌ์‹ฑ ์†๋„ ์ œ์–ด๋ฅผ ์œ„ํ•œ ๋ณ€์ˆ˜, ํฐ ๊ฐ’์„ ์ง€์ •ํ•˜๋ฉด I/O ๋Œ€์—ญํญ์„ ์ ์œ ํ•˜๋ฏ€๋กœ ํ™˜๊ฒฝ์— ๋งž์ถฐ์„œ ์„ค์ •ํ•  ๊ฒƒ
                                     # InnoDB ๋ฉ”์ธ ์“ฐ๋ ˆ๋“œ๊ฐ€ I/O ์ž‘์—…์„ ํ•  ์ˆ˜ ์žˆ๋Š” capa, ์‹œ์Šคํ…œ์˜ I/O ์ˆ˜์ค€์— ์˜์กด์ ์ž„
                                     # ์ผ๋ฐ˜์ ์œผ๋กœ 7200 RPMs ํ•˜๋“œ ๋“œ๋ผ์ด๋ธŒ์ธ ๊ฒฝ์šฐ 100์œผ๋กœ ์„ค์ •
                                     # RAID ๊ตฌ์„ฑ์ด๋‚˜ SSD ์‚ฌ์šฉ ๋“ฑ์— ๋”ฐ๋ผ์„œ ๋” ๋†’์€ ๊ฐ’์œผ๋กœ ์„ค์ •
                                     # Raid1: 200. Raid10: 200 x write arrays. SSD: 5000. FusionIO: 20000

innodb_flush_log_at_trx_commit = 0   # InnoDB์—์„œ ์ปค๋ฐ‹๋  ๋•Œ๋งˆ๋‹ค ๋กœ๊ทธ(redo)๋ฅผ ๋””์Šคํฌ์— ํ”Œ๋Ÿฌ์‹œํ• ์ง€๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ์˜ต์…˜
# fsync() ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋นˆ๋„์— ๊ด€ํ•œ ์˜ต์…˜
# 0 : ์ปค๋ฐ‹๋  ๋•Œ๋งˆ๋‹ค ๋””์Šคํฌ ํ”Œ๋Ÿฌ์‹œ๋ฅผ ํ•˜์ง€๋Š” ์•Š์Œ, OS์—์„œ ์ ์ ˆํ•œ ์‹œ์ (์ผ๋ฐ˜์ ์œผ๋กœ 4~5์ดˆ ๊ฐ„๊ฒฉ)๋งˆ๋‹ค ๋ฐ์ดํ„ฐ ๋™๊ธฐํ™”๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ๋จ
#     ์ž˜ ๋ชป ๋˜๋ฉด 4~5์ดˆ๊ฐ„์˜ ๋ฐ์ดํ„ฐ๋Š” ์œ ์‹ค๋  ์ˆ˜๋„ ์žˆ์Œ
# 1 : ํŠธ๋žœ์žญ์…˜์ด ์ปค๋ฐ‹๋  ๋•Œ๋งˆ๋‹ค ๋กœ๊ทธ ํŒŒ์ผ์— ๊ธฐ๋ก๋˜๊ณ  ๋””์Šคํฌ ํ”Œ๋Ÿฌ์‹œ๊ฐ€ ์‹คํ–‰ (๊ฐ€์žฅ ์•ˆ์ „, ๊ฐ€์žฅ ๋Š๋ฆผ)
# 2 : ์ปค๋ฐ‹๋˜๋ฉด ๊ฐ•์ œ๋กœ ๋กœ๊ทธ ๋ฒ„ํผ๋ฅผ ๋กœ๊ทธ ํŒŒ์ผ์— ์“ฐ์ง€๋งŒ, 1์ดˆ๊ฐ€ ์ง€๋‚˜๊ธฐ ์ „์—๋Š” ๋””์Šคํฌ์— ์ €์žฅ๋˜์ง€ ์•Š์Œ

innodb_flush_method = O_DIRECT
# InnoDB๊ฐ€ dafa files, log files๋กœ data๋ฅผ flush(๋””์Šคํฌ์— ๊ธฐ๋กํ•˜๊ณ  ๋™๊ธฐํ™”ํ•˜๋Š” ์ž‘์—…)ํ•˜๋Š” ๋ฐฉ๋ฒ•
# ------------------+----------+----------+-----------+-----------------+-----
# Method            | log file | log file | data file | data file flush | ์„ค๋ช…
# Method            | open     | fulsh    | open      | data file flush | ์„ค๋ช…
# ------------------+----------+----------+-----------+-----------------+-----
# fsync             | normal   | fsync()  | normal    | fsync()         | ๊ธฐ๋ณธ
# O_DSYNC           | O_SYNC   | O_SYNC   | normal    | fsync()         | synchronized(๋™๊ธฐ) I/O๋กœ์„œ, write์ž‘์—…์‹œ hardware๋‹จ๊นŒ์ง€ fsyncํ•จ
# O_DIRECT          | normal   | fsync()  | O_DIRECT  | fsync()         | OS caching์„ ํ•˜์ง€ ์•Š๊ณ  direct I/O๋กœ innodb_buffer_pool์—์„œ file๋กœ I/Oํ•จ
# O_DIRECT_NO_FSYNC | normal   | fsync()  | O_DIRECT  | skip fsync()    | O_DIRECT์™€ ๋™์ผํ•œ๋ฐ data file ๋™๊ธฐํ™”๋ฅผ ์œ„ํ•œ fsync ํ˜ธ์ถœ์„ ์ƒ๋žตํ•จ
# ------------------+----------+----------+-----------+-----------------+-----
# fsync = ๋ฐ์ดํ„ฐ์™€ ๋ฉ”ํƒ€์ •๋ณด๋ฅผ ํ•จ๊ป˜ ๋ณ€๊ฒฝํ•˜๋Š” ๋ฐฉ์‹ (ํŒŒ์ผ๋ฉ”ํƒ€์ •๋ณด๋Š” ํŒŒ์ผ๋ณ€๊ฒฝ์ผ์‹œ,์ˆ˜์ •์ž ๋“ฑ์„ ์˜๋ฏธํ•จ, fdatasync "๋ฐ์ดํ„ฐ๋งŒ ๋ณ€๊ฒฝ, ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋Š” ๋ฌด์‹œ")
# O_DIRECT = pache cache, buffer cache๋Š” directlyํ•˜๊ฒŒ write bypassํ•˜์ง€๋งŒ, inode cache, directory cache, metadata๋Š” ๋”ฐ๋กœ fsync()๋ฅผ ํ˜ธ์ถœํ•ด์„œ flush ํ•ด์ค˜์•ผ ํ•จ
#            (์บ์‹œ๋ฉ”๋ชจ๋ฆฌ ์žฅ์ฐฉ๋œ)RAID ์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ์—†๊ฑฐ๋‚˜ SAN์„ ์‚ฌ์šฉํ•  ๋•Œ๋Š” O_DIRECT๋ฅผ ์‚ฌ์šฉ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ข‹์Œ
#            double buffering(InnoDB buffer pool๊ณผ OS file system cache์— ๋‘๋ฒˆ ์บ์‰ฌ)์„ ํ•˜์ง€ ์•Š๊ธฐ ๋–„๋ฌธ์— ์„ฑ๋Šฅํ–ฅ์ƒ์„ ๊ธฐ๋Œ€ํ•  ์ˆ˜ ์žˆ๋‹ค.
# O_DIRECT_NO_FSYNC = ๋ช‡๋ช‡ file system์—์„œ๋Š” O_DIRECT๊ฐ€ fsync()์—†์ด๋„ metadata๊นŒ์ง€ synchronize๋˜๋Š” ๊ฑธ ๋ณด์žฅํ•จ. ๊ทธ๋ž˜์„œ InnoDB๊ฐ€ O_DIRECT_NO_FSYNC๋ฅผ ์ถ”๊ฐ€ํ•จ

# ๋””์Šคํฌ์— ๋ฐ์ดํ„ฐ๋ฅผ ์“ฐ๋Š” ๋ฐฉ๋ฒ• = 1๋‹จ๊ณ„ "์šด์˜์ฒด๋กœ์˜ ๋ฒ„ํผ๋กœ ๊ธฐ๋ก" + 2๋‹จ๊ณ„ "๋ฒ„ํผ์˜ ๋‚ด์šฉ์„ ๋””์Šคํฌ๋กœ ๋ณต์‚ฌ"
#   - ๋™๊ธฐ(Sync) I/O = 1๋‹จ๊ณ„์™€ 2๋‹จ๊ณ„๋ฅผ ํ•จ๊ป˜ ์‹คํ–‰
#   - ๋น„๋™๊ธฐ(Async) I/O = 1๋‹จ๊ณ„์™€ 2๋‹จ๊ณ„๋ฅผ ๋‹ค๋ฅธ ์‹œ์ ์— ์‹คํ–‰
#   - direct I/O = 1๋‹จ๊ณ„ ๋ฌด์‹œ, 2๋‹จ๊ณ„ "๋ฒ„ํผ์˜ ๋‚ด์šฉ์„ ๋””์Šคํฌ๋กœ ๋ณต์‚ฌ"๋งŒ ์‹คํ–‰

innodb_adaptive_hash_index = ON
# Adaptive Hase Index
# 1. workload์™€ ์ถฉ๋ถ„ํ•œ buffer pool memory์˜ ์ ์ ˆํ•œ ์กฐํ•ฉํ•˜์—์„œ, ํŠธ๋žœ์žญ์…˜ ํŠน์„ฑ์ด๋‚˜ ์‹ ๋ขฐ์„ฑ์— ์œ„๋ฐฐ๋˜์ง€ ์•Š๋Š” ์„ ์—์„œ, InnoDB๋ฅผ in-memory DB์ฒ˜๋Ÿผ ๋™์ž‘ํ•˜๊ฒŒ ํ•จ
# 2. ๋™์ž‘
# 1) MySQL์€ search ํŒจํ„ด์„ ๊ณ ๋ คํ•˜์—ฌ index prefix(์ธ๋ฑ์Šค ํ‚ค์˜ ๊ฐ’ ์•ž๋ถ€๋ถ„)๋กœ hash index๋ฅผ ๋งŒ๋“ ๋‹ค
# 2) ์ž์ฃผ access๋˜๋Š” ์ธ๋ฑ์Šค ํŽ˜์ด์ง€์— ๋Œ€ํ•ด์„œ๋งŒ ๋ถ€๋ถ„์ ์œผ๋กœ ์ƒ์„ฑ๋  ์ˆ˜๋„ ์žˆ๋‹ค.
# 3) InnoDB๋Š” index search ํŒจํ„ด์„ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๋Š” ๋ฉ”์ปค๋‹ˆ์ฆ˜์„ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์„œ ํ•ด๋‹น ์ฟผ๋ฆฌ๊ฐ€ hash index๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ด์ต์ด๋ผ๊ณ  ํŒ๋‹จ๋˜๋ฉด, ์ž๋™์œผ๋กœ hash index๋ฅผ ์ƒ์„ฑํ•œ๋‹ค
# 4) ๋งŒ์•ฝ ํ…Œ์ด๋ธ” ์ „์ฒด๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ์— ๋“ค์–ด๊ฐˆ์ˆ˜ ์žˆ๋Š” ์‚ฌ์ด์ฆˆ์ธ ๊ฒฝ์šฐ, hash index๋Š” ์ฟผ๋ฆฌ ์†๋„๋ฅผ ํ–ฅ์ƒ์‹œํ‚จ๋‹ค.
#    ์ธ๋ฑ์Šค๋ฅผ pointer์™€ ๊ฐ™์ด ๋™์ž‘ํ•˜๊ฒŒ ํ•ด์„œ ์›ํ•˜๋Š” ๋กœ์šฐ๋ฅผ ๋ฐ”๋กœ ๋‹ค์ด๋ ‰ํŠธํ•˜๊ฒŒ ์ฐพ์„์ˆ˜ ์žˆ๋‹ค.
# 5) ์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” ๋ฐ์ดํ„ฐ๋Š” ํ•ด์‹œ๋ฅผ ํ†ตํ•ด์„œ ์ง์ ‘ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๊ธฐ์—, Mutex Lock์œผ๋กœ ์ธํ•œ ์ง€์—ฐ์€ ํ™•์—ฐํ•˜๊ฒŒ ์ค„์–ด๋“ฆ
# 6) heavy workloadํ•˜์—์„œ๋Š”(๋™์‹œ ๋Œ€๋Ÿ‰ ๋ฐฐ์น˜ ์ž‘์—… ๋“ฑ), adaptive has index๋ฅผ ์ ‘๊ทผํ• ๋•Œ ํš๋“ํ•˜๋Š” read/write lock์ด contention์˜ ์›์ธ์ด ๋˜๊ธฐ๋„ ํ•œ๋‹ค
# 7) LIKE % ์ฟผ๋ฆฌ์˜ ๊ฒฝ์šฐ์—๋Š” Adaptive Hase Index๊ฐ€ ๋ณ„ ์ด๋“์ด ์•ˆ ๋œ๋‹ค
# 3. ๋ชจ๋‹ˆํ„ฐ๋ง
# 1) ํ• ๋‹น๋˜๋Š” ๋ฉ”๋ชจ๋ฆฌ๋Š” Innodb_Buffer_Pool_Size์˜ 1/64๋งŒํผ์œผ๋กœ ์ดˆ๊ธฐํ™”(์ตœ์†Œ๊ฐ€ ๊ทธ๋ ‡๊ณ  ์ตœ๋Œ€๋Š” ์•Œ ์ˆ˜ ์—†์Œ)
#    ์ง€๋‚˜์น˜๊ฒŒ ์ปค์ง€์ง€ ์•Š๋„๋ก ์ƒํƒœ์˜ ์ฃผ๊ธฐ์  ํ™•์ธ ํ•„์š” (SHOW GLOBAL STATUS LIKE 'Innodb%adaptive%';)
# 2) SHOW ENGINE INNODB STATUS ์—์„œ SEMAPHORE ์„น์…˜์— RW-latch๋ฅผ ๋Œ€๊ธฐํ•˜๋Š” thread๊ฐ€ ์—ฌ๋Ÿฌ๊ฐœ ์žˆ๋‹ค๋ฉด, disableํ•˜๋Š” ๊ฒƒ์ด ๋” ์ข‹์„ ์ˆ˜๋„ ์žˆ๋‹ค.
# 3) ํ…Œ์ด๋ธ” DROP์€ ์ตœ๋Œ€ํ•œ ํŠธ๋ž˜ํ”ฝ์ด ์—†๋Š” ์ƒˆ๋ฒฝ์—, Adaptive Hash Index๋ฅผ ์ˆœ๊ฐ„ OFF/ON์„ ํ•˜์—ฌ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ํ•ด์ œํ•˜๊ณ , ํ…Œ์ด๋ธ”์„ DROPํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.

innodb_adaptive_hash_index_partitions = 2
# adaptive_hash_index๋ฅผ ๋ช‡ ๊ฐœ๋กœ ๋‚˜๋ˆ ์“ธ์ง€ ๊ฒฐ์ •ํ•˜๋Š” ๋ณ€์ˆ˜
# ๊ธฐ๋ณธ์€ 1 ์ด๋ฉฐ, 1์ผ ๋•Œ๋Š” ๋‹จ์ผ Mutex๋กœ ๊ด€๋ฆฌ๋˜๊ธฐ ๋•Œ๋ฌธ์— ํ…Œ์ด๋ธ”์„ DROPํ•˜๊ฒŒ ๋˜๋ฉด adaptive_hash_index์—์„œ ๊ด€๋ จ ์ •๋ณด๋ฅผ ์ •๋ฆฌํ•˜๋ ค๊ณ  ํ•˜๋ฉด์„œ
# adaptive_hash_index ๋•์„ ๋ณด๋˜ ์ฟผ๋ฆฌ๋“ค๊นŒ์ง€ ์˜ํ–ฅ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Œ
# ๋ณ€์ˆ˜๊ฐ’์„ ํฌ๊ฒŒ ์„ค์ •ํ•˜๋ฉด Mutex๊ฐ€ ์—ฌ๋Ÿฌ ๊ฐœ๊ฐ€ ๋˜๋ฉด์„œ ํ…Œ์ด๋ธ”์„ DROPํ•  ๋•Œ adaptive_hash_index์—์„œ Mutex ๊ฒฝํ•ฉ์œผ๋กœ ์ธํ•ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ๋ฅผ ์ค„์ผ ์ˆ˜ ์žˆ์Œ
# InnoDB ๋‚ด๋ถ€์ ์œผ๋กœ๋Š” ํ…Œ์ด๋ธ” DROP์‹œ Sleep์—†์ด ์ฃฝ์œผ๋ผ๊ณ  Hash Index์—์„œ ๊ด€๋ จ ๋…ธ๋“œ๋ฅผ ๋ชจ๋‘ ์‚ญ์ œํ•œ ํ›„ ํ…Œ์ด๋ธ”์ด ์ œ๊ฑฐ
# ๊ฐœ์ธ์ ์ธ ์ƒ๊ฐ์œผ๋กœ๋Š” CPU ๊ฐœ์ˆ˜ ์ •๋„๋ฉด ์ ๋‹นํ•  ๋“ฏ ํ•จ

#innodb_change_buffering = all       # change buffering ์„ค์ •
# change buffering = insert buffering + delete buffering + purge buffering
# all : ๊ธฐ๋ณธ: buffer inserts, delete-marking operations, and purges.
# none : Do not buffer any operations.
# inserts : Buffer insert operations.
# deletes : Buffer delete-marking operations.
# changes : Buffer both inserts and delete-marking.
# purges : Buffer the physical deletion operations that happen in the background.
# Innodb๋Š” ์ธ๋ฑ์Šค leaf node๋ฅผ ์—…๋ฐ์ดํŠธํ•˜์ง€ ์•Š๊ณ  buffer๋งŒ ํ•ด๋‘ , ๋ฒ„ํผ์— ์ž„์‹œ๋กœ ์ €์žฅํ•ด ๋‘๊ณ  ๋‚˜์ค‘์— ์—ฌ์œ ๊ฐ€ ๋  ๋•Œ ์‹ค์ œ ์ธ๋ฑ์Šค์— ๋ณ‘ํ•ฉํ•จ
# secondary index์˜ leaf node๋ฅผ updateํ•˜๋ ค๋ฉด, ๋””์Šคํฌ๋กœ๋ถ€ํ„ฐ index page๋ฅผ ์ฝ์–ด์„œ ๋ณ€๊ฒฝํ•ด์•ผํ•˜๋Š”๋ฐ ์ด๋Š” ๋ถ€์ˆ˜์ ์œผ๋กœ ์ถ”๊ฐ€ IO๊ฐ€ ํ•„์š”ํ•œ ์ž‘์—…์ด๊ธฐ ๋•Œ๋ฌธ
# ์ €์žฅ: change buffer๋Š” system tablespace์— ์œ„์น˜ํ•จ
# ์กฐ๊ฑด: non-uniqueํ•œ ์ธ๋ฑ์Šค์— ๋Œ€ํ•œ ๋ณ€๊ฒฝ์‚ฌํ•ญ ์ €์žฅ, ๋ณ€๊ฒฝ์ž‘์—…์— ํ•ด๋‹นํ•˜๋Š” page๊ฐ€ buffer pool์— ์กด์žฌํ•˜์ง€ ์•Š์„๋•Œ๋งŒ change buffer์— ๋ณ€๊ฒฝ์„ ์ €์žฅ
# merge ์ž‘์—…)
# background thread์— ์˜ํ•œ ์ฃผ๊ธฐ์ ์œผ๋กœ ๋ณ‘ํ•ฉ
# ํ•ด๋‹น page๊ฐ€ ๋‹ค๋ฅธ read operation์— ์˜ํ•ด์„œ buffer pool๋กœ ๋ถˆ๋ ค์ฝํ˜€์กŒ์„ ๋•Œ

#innodb_change_buffer_max_size=25    # ๋ฒ„ํผํ’€์—์„œ change_buffer๊ฐ€ ์ฐจ์ง€ํ•  ๋น„์œจ

#innodb_old_blocks_pct = 37          # LRU ๋ฆฌ์ŠคํŠธ ์˜์—ญ์˜ ๋ฒ”์œ„(ํผ์„ผํŠธ)
#innodb_old_blocks_time = 1000       # LRU ๋ฆฌ์ŠคํŠธ์—์„œ MRU ๋ฆฌ์ŠคํŠธ๋กœ ์˜ฎ๊ธฐ๊ธฐ ์ „์— ๋Œ€๊ธฐํ•˜๋Š” ์‹œ๊ฐ„(๋ฐ€๋ฆฌ์ดˆ)
# MRU: Most Recently used list, LRU: Last Recently used list
# ๋ฒ„ํผํ’€์˜ ํŽ˜์ด์ง€๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๋ฆฌ์ŠคํŠธ = MRU ๋ฆฌ์ŠคํŠธ + LRU ๋ฆฌ์ŠคํŠธ

innodb_autoinc_lock_mode = 1
# auto_increment ์นผ๋Ÿผ์— ๋“ค์–ด๊ฐˆ ๊ฐ’์„ ์œ„ํ•œ lock ์„ค์ •
# 0 : insert ํ•  ๋•Œ ๋งˆ๋‹ค auto increment lock ์‚ฌ์šฉ, insert ... select ... ์ฒ˜๋Ÿผ ๋Œ€๋Ÿ‰ ๋ฐ์ดํ„ฐ ์ž…๋ ฅํ•  ๋•Œ๋Š” lock ๋Œ€๊ธฐ๊ฐ€ ๊ธธ์–ด์ง
# 1 : insert ... select ... ์ฒ˜๋Ÿผ ๋Œ€๋Ÿ‰ ๋ฐ์ดํ„ฐ ์ž…๋ ฅํ•  ๋•Œ ๋ฏธ๋ฆฌ ์ผ์ •๋Ÿ‰์˜ ์ž๋™ ์ฆ๊ฐ€๊ฐ’์„ ๋งŒ๋“ค์–ด ์‚ฌ์šฉ
#     ๋ฏธ๋ฆฌ ๋งŒ๋“  ์ผ์ •๋Ÿ‰์˜ ์ž๋™ ์ฆ๊ฐ€๊ฐ’์ด ๋‹ค ์‚ฌ์šฉ๋˜์ง€ ์•Š์œผ๋ฉด ๋‚˜๋จธ์ง€๋Š” ๋ฒ„๋ฆผ
# 2: auto increment lock์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  mutex ์‚ฌ์šฉ, auto_increment ๊ฐ’์ด ์œ ๋‹ˆํฌํ•จ์€ ๋ณด์žฅํ•˜์ง€๋งŒ ์ˆœ์„œ๋Š” ๋ณด์žฅํ•˜์ง€ ๋ชป ํ•จ

#innodb_max_dirty_pages_pct=75       # ๋ฒ„ํผํ’€์— ๋‚จ์•„ ์žˆ์„ ์ˆ˜ ์žˆ๋Š” ๋”ํ‹ฐ ํŽ˜์ด์ง€์˜ ๋น„์œจ (์ด ๋น„์œจ์ด ๋„˜์–ด๊ฐ€๋ฉด ์ฒดํฌํฌ์ธํŠธ๊ฐ€ ์ˆ˜ํ–‰๋จ)
                                     # ๋”ํ‹ฐํŽ˜์ด์ง€(dirty page) = SQL ์กฐ์ž‘์œผ๋กœ ๋ณ€๊ฒฝ๋์ง€๋งŒ ์•„์ง ๋””์Šคํฌ์— ์“ฐ์—ฌ์ง€์ง€ ์•Š์€ ๋ฐ์ดํ„ฐ ํŽ˜์ด์ง€
#innodb_adaptive_flushing=ON         # InnoDB ์—”์ง„์ด ๋ฆฌ๋‘ ๋กœ๊ทธ์˜ ๋ฐœ์ƒ๋Ÿ‰์„ ๋ชจ๋‹ˆํ„ฐ๋ง ํ•˜๋ฉด์„œ ๋ฒ„ํผ ํ’€์˜ ๋”ํ‹ฐํŽ˜์ด์ง€๋ฅผ ๋””์Šคํฌ๋กœ ์“ฐ๋Š” ์ž‘์—… ์†๋„๋ฅผ ์กฐ์ ˆํ•˜๊ฒŒ ํ•จ
                                     # ON ์ด ์•„๋‹ˆ๋ฉด ๋”ํ‹ฐํŽ˜์ด์ง€์˜ ๋น„์œจ์ด innodb_max_dirty_pages_pct๋ฅผ ๋„˜์–ด์„œ๋Š” ์ˆœ๊ฐ„ ๊ณต๊ฒฉ์ ์ธ ๋””์Šคํฌ ์“ฐ๊ธฐ ์ผ์–ด๋‚  ์ˆ˜ ์žˆ์Œ
#innodb_use_native_aio=ON            # ๋ฆฌ๋ˆ…์Šค์™€ ์œˆ๋„์šฐ ํ”Œ๋žซํผ์— ํ•œํ•ด ๋„ค์ดํ‹ฐ๋ธŒ ๋น„๋™๊ธฐ I/O ๋ฐฉ์‹์ด ์ œ๊ณต๋จ (I/O์š”์ฒญ ๋™์‹œ์„ฑ ์ฆ๋Œ€ ํšจ๊ณผ)
                                     # libaio ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ๊ณ , ์ด ๊ฐ’์„ "ON"์œผ๋กœ ์„ค์ •ํ•ด์•ผ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•จ

innodb_doublewrite = 1               # doublewrite buffer์™€ data file์— ์ด์ค‘ ์“ฐ๊ธฐ ํ™œ์„ฑํ™” (๊ธฐ๋ณธ: ํ™œ์„ฑ)
# ๋ชฉ์ : ์‹œ์Šคํ…œ crash, ์ „์›๊ณต๊ธ‰์ค‘๋‹จ ๋“ฑ ์žฅ์• ์‹œ ๋ณด๋‹ค ์•ˆ์ „ํ•œ ๋ฆฌ์ปค๋ฒ„๋ฆฌ
#       OS์˜ ๊ธฐ๋ณธIO ๋‹จ์œ„(๋ณดํ†ต 4K)์™€ DB์˜ ๊ธฐ๋ณธIO๋‹จ์œ„(๋ณดํ†ต 16K)๊ฐ€ ๋‹ค๋ฆ„์œผ๋กœ ์ธํ•ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” page currupt๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ
#       (16K๊ฐ€ OS๋ฅผ ํ†ตํ•ด ๋‹ค ์จ์ง€๊ธฐ ์ „์— ์‹œ์Šคํ…œ crash๊ฐ€ ๊ฐ€ ๋˜๋„, ์•ˆ์ „ํ•˜๊ฒŒ ๋ณต๊ตฌํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์คŒ)
#       InnoDB๋Š” full pages๋ฅผ ๋กœ๊น…ํ•˜์ง€๋Š” ์•Š์œผ๋ฏ€๋กœ ํ•„์š”ํ•จ
#       InnoDB๋Š” log file์— page number, ๋ณ€๊ฒฝ๋‚ด์šฉ, log sequence ์ •๋ณด๋ฅผ ๊ธฐ๋กํ•จ
# Doublewrite Buffer ๋Š”?
# 1. ๊ธฐ๋ณธ์ ์œผ๋กœ system tablespace์— ์œ„์น˜ํ•จ
# 2. Flush ์ด๋ฒคํŠธ ๋ฐœ์ƒ์‹œ Doublewrite Buffer๋ฅผ ๋จผ์ € ์“ฐ๊ณ , ๊ทธ ๋‹ค์Œ์— ๋Œ€์ƒ ํŽ˜์ด์ง€์˜ ๋‚ด์šฉ์„ ๋ณ€๊ฒฝํ•จ 
#    (๋Œ€์ƒ ํŽ˜์ด์ง€์˜ ๋ณ€๊ฒฝ ์ž‘์—…์€ fsync()๋ฅผ callํ•ด์„œ ์ง„ํ–‰๋จ)
# 3. Doublewrite Buffer์— ๊ธฐ๋ก๋˜๋Š” ๋‚ด์šฉ์€ ํ•ด๋‹น ํŽ˜์ด์ง€ ์ •๋ณด์™€ operation ์ •๋ณด์ž„
# 4. ์—ฌ๋Ÿฌ ๊ฐœ์˜ dirty page๋ฅผ ๊ฐ๊ฐ์˜ ๋ฐ์ดํ„ฐํŒŒ์ผ์— ํ”Œ๋Ÿฌ์‰ฌํ•˜๋ ค๋ฉด ๋žœ๋คI/O๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ ์‹œ๊ฐ„์ด ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๋ฏ€๋กœ 
#     dirty page๋ฅผ ๋ชจ์•„์„œ ์‹œ์Šคํ…œ ํ…Œ์ด๋ธ”์ŠคํŽ˜์ด์Šค ๋‚ด ํ•˜๋‚˜์˜ ์—ฐ์†์ ์ธ extent์— ์“ฐ๊ณ  ๋‹จ์ผ I/O๋กœ ์ฒ˜๋ฆฌ
# 5. fsync() ํšŸ์ˆ˜ ์ค„์ž„ - ๋งค page๋งˆ๋‹ค fsync()๋ฅผ ์ฝœํ•˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ, multiple page๋ฅผ ํ•œ๋ฒˆ์— ์“ฐ๊ณ  fsync()
# 6. ์ผ๋ฐ˜์ ์œผ๋กœ doublewrite๋ฅผ ํ™œ์„ฑํ™”์— ์˜ํ•ด์„œ ๋ฐœ์ƒํ•˜๋Š” ์„ฑ๋Šฅ ์ €ํ•˜๋Š” 5% ์ •๋„๋กœ ๋ณธ๋‹ค.

#innodb_sync_spin_loops = 30         # ์“ฐ๋ ˆ๋“œ๊ฐ€ ์ง€์—ฐ๋˜๊ธฐ ์ „์— (suspended) ํ’€์–ด ์ฃผ๊ธฐ ์œ„ํ•ด InnoDB ๋ฎคํ…์Šค(mutex)๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š” ์“ฐ๋ ˆ๋“œ์˜ ๋Œ€๊ธฐ ์‹œ๊ฐ„
                                     # spin loop: CPU๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ ๋ฝ์ด ํ•ด์ œ๋๋Š”์ง€ ๊ฒ€์‚ฌํ•˜๋Š” ๊ฒƒ
                                     # ๋™์ผํ•œ ์ฟผ๋ฆฌ๊ฐ€ ๋™์‹œ๋‹ค๋ฐœ์ ์œผ๋กœ ์œ ์ž…๋˜์–ด ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ์—์„œ ๋ฉ”๋ชจ๋ฆฌ๋‚ด์˜ ๊ฐ™์€ ๋ฐ์ดํ„ฐ ๋ธ”๋ก์— ์ ‘๊ทผํ•˜์—ฌ ๋ฎคํ…์Šค ๊ฒฝํ•ฉ์ด ๋ฐœ์ƒ,
                                     # CPU ๋ถ€ํ•˜๊ฐ€ ๋†’์•„์ง€๋Š” ๊ฒฝ์šฐ์—๋Š” ์ด ๊ฐ’์„ ์ค„์—ฌ๊ฐ€๋ฉด ๋ถ€ํ•˜๊ฐ€ ์ค„์–ด๋“ค ์ˆ˜๋„ ์žˆ์Œ (10์ •๋„๊นŒ์ง€๋Š” ๊ดž์ฐฎ์„ ๋“ฏ)

#innodb_table_locks = 1              # LOCK TABLES์€ AUTOCOMMIT=0๊ฒฝ์šฐ์—, InnoDB๋กœ ํ•˜์—ฌ๊ธˆ ๋‚ด๋ถ€์ ์œผ๋กœ ํ…Œ์ด๋ธ”์„ ์ž ๊ธˆ
#innodb_max_purge_lag = 0            # ํผ์ง€ ์—ฐ์‚ฐ (purge operation)์ด ๋ž˜๊น…(lagging)๋  ๋•Œ INSERT, UPDATE ๋ฐ DELETE ์—ฐ์‚ฐ์„ ์ง€์—ฐ ์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•์„ ์ œ์–ด
                                     # ๋””ํดํŠธ๊ฐ’ 0์ผ์‹œ ์ง€์—ฐ ์—†์Œ

#innodb_commit_concurrency = 0       # ๋™์‹œ์— commit ์ฒ˜๋ฆฌ๋ฅผ ํ•  ์ˆ˜ ์žˆ๋Š” ์“ฐ๋ ˆ๋“œ์˜ ์ˆซ์ž. ๊ฐ’์ด 0์ด ๋˜๋ฉด ๋™์‹œ์„ฑ ์ œ์–ด(concurrency control)๊ฐ€ ๋น„ํ™œ์„ฑํ™”

#innodb_purge_threads = 1            # purge ์ž‘์—…์„ ์‹คํ–‰ํ•  ์“ฐ๋ ˆ๋“œ์˜ ์ˆ˜ (๊ธฐ๋ณธ1~์ตœ๋Œ€32)
# InnoDB์˜ purge ์ž‘์—…
# ์˜ˆ์ „) ์ฃผ๊ธฐ์ ์œผ๋กœ ์ˆ˜ํ–‰๋˜๋Š” ๊ฐ€๋น„์ง€ ์ปฌ๋ ‰์…˜ ์ž‘์—…์˜ ํ•œ ์ข…๋ฅ˜, ๋งˆ์Šคํ„ฐ ์“ฐ๋ ˆ๋“œ์— ์˜ํ•ด ๋™์ž‘๋จ, purgeํ•˜๋Š” ๋™์•ˆ ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ž‘์—…๋“ค์€ ๋Œ€๊ธฐํ•ด์•ผ ํ•จ
# MySQL 5.5์ดํ›„) ๊ฐœ๋ณ„์˜ ์“ฐ๋ ˆ๋“œ์—์„œ ์ˆ˜ํ–‰๋˜๋ฉด์„œ ๋” ๋†’์€ ๋™์‹œ์„ฑ ๋ณด์žฅ

innodb_file_format = barracuda       # InnoDB ํŒŒ์ผ ํฌ๋ฉง: ํ…Œ์ด๋ธ”์••์ถ• ๋“ฑ์˜ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด barracuda ์‚ฌ์šฉ
innodb_file_format_max = barracuda
innodb_large_prefix = ON             # ์ธ๋ฑ์Šค ํ‚ค ์นผ๋Ÿผ์˜ prefix๋ฅผ 767 bytes ์ด์ƒ์œผ๋กœ ์„ค์ • (์ตœ๋Œ€ 3072 bytes๊นŒ์ง€ ์„ค์ • ๊ฐ€๋Šฅ)
innodb_open_files = 4000             # DB์ „์ฒด์—์„œ ๋™์‹œ์— ์—ด์–ด ๋†“์„ ์ˆ˜ ์žˆ๋Š” InnoDB ํ…Œ์ด๋ธ”์˜ .ibd ํŒŒ์ผ์˜ ์ˆ˜

#innodb_stats_persistent = 1 (ON)    # ํ†ต๊ณ„์ •๋ณด๋ฅผ ์ฃผ๊ธฐ์ ์œผ๋กœ  mysql.innodb_table_stats, mysql.innodb_index_stats ํ…Œ์ด๋ธ”์— ์˜๊ตฌํžˆ ์ €์žฅ
#innodb_stats_auto_recalc = 1 (ON)   # ์ฃผ๊ธฐ์ ์œผ๋กœ ํ†ต๊ณ„ ์ •๋ณด๋ฅผ ๊ฐฑ์‹ 
#innodb_stats_persistent_sample_pages = 20 # mysql.innodb_table_stats, mysql.innodb_index_stats ํ…Œ์ด๋ธ”์— ์˜๊ตฌํžˆ ์ €์žฅํ•  ํ†ต๊ณ„์ •๋ณด ์ˆ˜์ง‘์— ์‚ฌ์šฉํ•  ์ƒ˜ํ”Œ ํŽ˜์ด์ง€ ์ˆ˜
#innodb_stats_sample_pages = 8       # ํ†ต๊ณ„์ •๋ณด ์ˆ˜์ง‘์— ์‚ฌ์šฉํ•  ์ƒ˜ํ”Œ ํŽ˜์ด์ง€ ์ˆ˜
#innodb_stats_on_metadata = OFF      # ๋‹ค์Œ ๋ช…๋ น๋“ค์ด ์‹คํ–‰๋  ๋•Œ ํ†ต๊ณ„ ์ •๋ณด ๊ฐฑ์‹  ํ™œ์„ฑํ™”
                                     # SHOW TABLE STATUS, SHOW INDEX, INFORMATION_SCHEMA.TABLES ์กฐํšŒ, INFORMATION_SCHEMA.STATISTICS ์กฐํšŒ

innodb_show_verbose_locks = 1        # "SHOW ENGINE INNODB STATUS"์— ๋ฝ์ด ์žกํžŒ ๋ ˆ์ฝ”๋“œ ํ‘œ์‹œ
innodb_print_all_deadlocks = ON      # ์—๋Ÿฌ ๋กœ๊ทธ์— InnoDB ๋ฐ๋“œ๋ฝ ์ •๋ณด ๊ธฐ๋ก ํ™œ์„ฑํ™”

#innodb_status_output = ON;          # ์—๋Ÿฌ ๋กœ๊ทธ์— "SHOW ENGINE INNODB STATUS" ๊ฒฐ๊ณผ ํฌํ•จ ์„ค์ •
innodb_status_output_locks = ON      # InnoDB Status๋ฅผ ๋ณด๋Š” ๋ถ€๋ถ„("SHOW ENGINE INNODB STATUS" ํ˜น์€ ์—๋Ÿฌ๋กœ๊ทธ)์— lock ์ •๋ณด๋„ ํ•จ๊ป˜ ํ‘œ์‹œ๋˜๋„๋ก ํ•จ

#innodb_force_recovery = 0
# ํฌ๋ž˜์‹œ ๋ณต๊ตฌ ๋ชจ๋“œ ์„ค๋ช… : ํฐ ๊ฐ’์€ ์ž‘์€ ๊ฐ’์˜ ๋‚ด์šฉ์„ ํฌํ•จํ•จ
# 1 (SRV_FORCE_IGNORE_CORRUPT) ์„œ๋ฒ„๊ฐ€ ๊นจ์ง„ ํŽ˜์ด์ง€๋ฅผ ๋ฐœ๊ฒฌํ•œ๋‹ค๊ณ  ํ•˜๋”๋ผ๋„ ๊ณ„์† ๊ตฌ๋™ํ•˜๋„๋ก ๋งŒ๋“ฆ
# 2 (SRV_FORCE_NO_BACKGROUND) ๋ฉ”์ธ ์“ฐ๋ ˆ๋“œ๊ฐ€ ๊ตฌ๋™๋˜์ง€ ๋ชป ํ•˜๋„๋ก ํ•จ
# 3 (SRV_FORCE_NO_TRX_UNDO) ๋ณต๊ตฌ ๋‹ค์Œ์— ํŠธ๋žœ์ ์…˜ ๋กค๋ฐฑ์„ ์‹คํ–‰ํ•˜์ง€ ์•Š์Œ
# 4 (SRV_FORCE_NO_IBUF_MERGE) ์‚ฝ์ž… ๋ฒ„ํผ ๋ณ‘ํ•ฉ ์—ฐ์‚ฐ (insert buffer merge operations)๊นŒ์ง€ ๊ธˆ์ง€
# 5 (SRV_FORCE_NO_UNDO_LOG_SCAN) ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์‹œ์ž‘ํ•  ๋•Œ UNDO log๋ฅผ ๊ฒ€์‚ฌํ•˜์ง€ ์•Š์Œ
# 6 (SRV_FORCE_NO_LOG_REDO) ๋ณต๊ตฌ ์—ฐ๊ฒฐ์—์„œ ๋กœ๊ทธ ๋กค-ํฌ์›Œ๋“œ (roll-forward)๋ฅผ ์‹คํ–‰ํ•˜์ง€ ์•Š์Œ

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## MyISAM ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„ ๊ด€๋ จ ์„ค์ •
## InnoDB๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  MyISAM๋งŒ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด key_buffer_size๋ฅผ ํฌ๊ฒŒ ์„ค์ •
##---------------------------------------------------------------------------
key_buffer_size = 16M                  # MyISAM ํ…Œ์ด๋ธ”์ด ๊ฑฐ์˜ ์—†๊ณ , ๋ฐ์ดํ„ฐ๋„ ๋งค์šฐ ์ ์œผ๋ฏ€๋กœ ์•„์ฃผ ์ž‘๊ฒŒ ์„ค์ •
bulk_insert_buffer_size = 1M
myisam-recover-options = BACKUP,FORCE  # MyISAM ํ…Œ์ด๋ธ”์„ ์—ด ๋•Œ ์ž๋™ ๋ณต๊ตฌ ์˜ต์…˜
myisam_sort_buffer_size = 1M           # ์ธ๋ฑ์Šค ์ •๋ ฌ์‹œ ํ• ๋‹น๋˜๋Š” ๋ฒ„ํผ์˜ ํฌ๊ธฐ
myisam_max_sort_file_size = 64M        # ์ธ๋ฑ์Šค ์žฌ ์ƒ์„ฑ์‹œ ์‚ฌ์šฉํ•  ์ž„์‹œ ํŒŒ์ผ์˜ ์ตœ๋Œ€ ํฌ๊ธฐ
#myisam_repair_threads = 1             # ์ •๋ ฌ ๋ณต๊ตฌ์‹œ ์‚ฌ์šฉ๋  ์“ฐ๋ ˆ๋“œ ๊ฐฏ์ˆ˜
#ft_min_word_len                       # MyISAM ํ˜น์€ InnoDB ํ…Œ์ด๋ธ” FULLTEXT ์ธ๋ฑ์Šค๋ฅผ ๋งŒ๋“ค ๋•Œ ํฌํ•จ๋  ๋‹จ์–ด์˜ ์ตœ์†Œ ๊ธธ์ด (mgroonga์™€๋Š” ๊ด€๋ จ ์—†๋Š” ์„ค์ •)
                                       # ์ด ๊ฐ’์„ ๋ณ€๊ฒฝํ•˜๋ฉด "REPAIR TABLE ํ…Œ์ด๋ธ”์ด๋ฆ„ QUICK" ์œผ๋กœ ์žฌ ๊ตฌ์ถ•ํ•ด์•ผํ•จ

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## Aria ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„ ๊ด€๋ จ ์„ค์ •
## internal temporary table์ด ์ƒ์„ฑ๋  ๋•Œ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ Aria ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„์„ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ์ง€๋‚˜์น˜๊ฒŒ ์ž‘๊ฒŒ ์„ค์ •ํ•˜์ง€ ๋ง ๊ฒƒ
## ์˜ˆ: aria_pagecache_buffer_size = 1M
##---------------------------------------------------------------------------
aria_pagecache_buffer_size = 32M
aria_sort_buffer_size = 32K
aria_log_file_size = 64M


##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## ํ†ต๊ณ„ ๋ฐ Optimizing ๊ด€๋ จ ์„ค์ •
##---------------------------------------------------------------------------
use_stat_tables = NEVER                 # ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„ ํ†ต๊ณ„ ์ •๋ณด์™€ ํ†ตํ•ฉ ํ†ต๊ณ„ ์ •๋ณด๋ฅผ ์ด์šฉํ•˜๋Š” ์šฐ์„ ์ˆœ์œ„๋ฅผ ๊ฒฐ์ •
# NEVER: ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„ ํ†ต๊ณ„์ •๋ณด๋งŒ ์ˆ˜์ง‘
# COMPLEMENTARY : ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„ ํ†ต๊ณ„์ •๋ณด๋ฅผ ์šฐ์„  ์‚ฌ์šฉํ•˜๊ณ  ์ •๋ณด๊ฐ€ ๋ถ€์กฑํ•˜๋ฉด ํ†ตํ•ฉ ํ†ต๊ณ„ ์ •๋ณด ์‚ฌ์šฉ
# PREFERABLY: ํ†ตํ•ฉ ํ†ต๊ณ„์ •๋ณด๋ฅผ ์šฐ์„  ์‚ฌ์šฉ ์‚ฌ์šฉํ•˜๊ณ  ์ •๋ณด๊ฐ€ ์—†์œผ๋ฉด ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„ ํ†ต๊ณ„ ์ •๋ณด ์‚ฌ์šฉ
# ํ†ตํ•ฉ ํ†ต๊ณ„์ •๋ณด๋ž€? mysql.table_stat, mysql.column_stat, mysql.index_stat

histogram_size = 20                    # ํžˆ์Šคํ† ๊ทธ๋žจ์„ ์ €์žฅํ•  ๊ณต๊ฐ„ ํฌ๊ธฐ(bytes๋‹จ์œ„), ํžˆ์Šคํ† ๊ทธ๋žจ ์ •๋ณด๋Š” mysql.column_stat ์ €์žฅ
# 0 ~ 255 ๊นŒ์ง€ ์„ค์ • ๊ฐ€๋Šฅ, 0์ด๋ฉด ํžˆ์Šคํ† ๊ทธ๋žจ ์ˆ˜์ง‘ ์•ˆ ํ•จ
# MariaDB๋Š” Height-Balanced Histogram ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์‚ฌ์šฉ, ๋ฒ„ํ‚ท์— ์ €์žฅ๋œ ์ตœ๋Œ€๊ฐ’์„ 1byte ํ• ๋‹นํ•ด์„œ ์ €์žฅ
histogram_type = SINGLE_PREC_HB         # 
# SINGLE_PREC_HB : histogram_size   ๋งŒํผ ๋ฒ„ํ‚ท ์ƒ์„ฑ
# DOUBLE_PREC_HB : histogram_size/2 ๋งŒํผ ๋ฒ„ํ‚ท ์ƒ์„ฑ (๋ฒ„ํ‚ท๋‹น 2byte๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€์‹  ์ •ํ™•์„ฑ์„ ํ™•๋Œ€ํ–ˆ๊ธฐ ๋•Œ๋ฌธ)

#optimizer_prune_level = 1               # ์กฐ์ธ ์ˆœ์„œ ๊ฒฐ์ • ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์„ ํƒ (1: Greedy ๋ฐฉ์‹, 2: Exhaustive ๋ฐฉ์‹)
optimizer_search_depth = 20             # Greedy ๋ฐฉ์‹์—์„œ ์ฟผ๋ฆฌ์— ์žˆ๋Š” ํ…Œ์ด๋ธ” ์ค‘ ๋ช‡๊ฐœ ํ…Œ์ด๋ธ”์˜ ์กฐ์ธ ์ˆœ์„œ ์ตœ์ ํ™”๋ฅผ ์ฐพ์„ ์ง€ ๊ฒฐ์ • (๊ธฐ๋ณธ 62)
optimizer_use_condition_selectivity = 4 # ์˜ตํ‹ฐ๋งˆ์ด์ € ์„ ํƒ๋„(1~5)
# 1: MariaDB 5.5 ๋ฒ„์ „์—์„œ ์‚ฌ์šฉํ•˜๋˜ ์„ ํƒ๋„ ์˜ˆ์ธก ๋ฐฉ์‹์„ ์œ ์ง€(๋””ํดํŠธ ๊ฐ’)
# 2: ์ธ๋ฑ์Šค๊ฐ€ ์ƒ์„ฑ๋œ ์นผ๋Ÿผ์˜ ์กฐ๊ฑด์— ๋Œ€ํ•ด์„œ๋งŒ ์„ ํƒ๋„ ํŒ๋‹จ
# 3: ๋ชจ๋“  ์นผ๋Ÿผ์˜ ์กฐ๊ฑด์— ๋Œ€ํ•ด์„œ ์„ ํƒ๋„ ํŒ๋‹จ(ํžˆ์Šคํ† ๊ทธ๋žจ ์‚ฌ์šฉ ์•ˆํ•จ)
# 4: ๋ชจ๋“  ์นผ๋Ÿผ์˜ ์กฐ๊ฑด์— ๋Œ€ํ•ด์„œ ์„ ํƒ๋„ ํŒ๋‹จ(ํžˆ์Šคํ† ๊ทธ๋žจ ์‚ฌ์šฉ)
# 5: 4์— ์ถ”๊ฐ€์ ์œผ๋กœ ๋ฒ”์œ„ ๊ฒ€์ƒ‰์ด ์•„๋‹Œ ์กฐ๊ฑด์— ๋Œ€ํ•ด์„œ๋Š” ์ƒ˜ํ”Œ๋ง ์ •๋ณด๋ฅผ ์ด์šฉํ•ด ์„ ํƒ๋„๋ฅผ ํŒ๋‹จ

userstat = ON                           # Enable INFORMATION_SCHEMA.%_STATISTICS tables

##---------------------------------------------------------------------------
## Author: ์ฃผ๋‹ˆ์“ฐ
## Binary Logs
##---------------------------------------------------------------------------
server_id = 1

# Binary Log ์„ค๋ช…
# 1. ์จ์ง€๋Š” ์‹œ์ 
# 1) ํŠธ๋žœ์žญ์…˜์„ ์ง€์›ํ•˜๋Š” ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„(์˜ˆ: InnoDB)
#    commit ๋œ ํ›„ lock์ด ํ•ด์ง€ ๋˜์ง€ ์•Š์€ ์ƒํƒœ์—์„œ ์ฟผ๋ฆฌ๋ฅผ ๋กœ๊น…
#    commit ์ „์—๋Š” ์ฟผ๋ฆฌ ์ •๋ณด๊ฐ€ cache๋˜๊ณ  commit ๋  ๋•Œ ๋ชจ๋“  ์ฟผ๋ฆฌ ์ •๋ณด๊ฐ€ ๋กœ๊น…๋จ
# 2) ํŠธ๋žœ์žญ์…˜์„ ์ง€์›ํ•˜๋Š” ์•Š๋Š” ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„(์˜ˆ: MyISAM)
#    ์ฟผ๋ฆฌ ์‹คํ–‰ ์งํ›„ ๋ฐ”๋กœ ๋กœ๊น…๋จ
#    ํŠธ๋žœ์žญ์…˜ ์•ˆ์— ํŠธ๋žœ์žญ์…˜์„ ์ง€์›ํ•˜์ง€ ์•Š๋Š” ํ…Œ์ด๋ธ”์ด ์„ž์ด๋ฉด, ํŠธ๋žœ์žญ์…˜์ด ๋กค๋ฐฑ๋˜๋„ ๊ทธ ํ…Œ์ด๋ธ”์˜ ๋ฐ์ดํ„ฐ๋Š” ๋กค๋ฐฑ ์•ˆ ๋จ
# 2. ํ™œ์„ฑํ™” ๋ฐฉ๋ฒ•
# log_bin ์„ค์ •

log_bin = /data/mysvc/binary_MARIASVC/mysvc-bin  # binary log ๊ฒฝ๋กœ

#binlog_cache_size = 256K                            # ์“ฐ๋ ˆ๋“œ ๋ณ„๋กœ binary logging๊ณผ ๊ด€๋ จ๋œ ๋‚ด์šฉ์„ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ์บ์‹œ ์‚ฌ์ด์ฆˆ๋กœ ํŠธ๋žœ์žญ์…˜ ์ง€์› ๊ตฌ๋ฌธ๋งŒ์„ ์œ„ํ•ด ์‚ฌ์šฉ๋จ
                                                     # ํฐ ๋‹ค์ค‘๋ฌธ ํŠธ๋žœ์žญ์…˜์„ ๋ฒˆ๋ฒˆํžˆ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์ด ์‚ฌ์ด์ฆˆ๋ฅผ ํฌ๊ฒŒ ์žก์•„์„œ ํผํฌ๋จผ์Šค๋ฅผ ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ์Œ
                                                     # ์ตœ๋Œ€ ์‚ฌ์ด์ฆˆ: max_binlog_cache_size๋กœ ์„ค์ •๊ฐ€๋Šฅ
#binlog_stmt_cache_size = 32K                        # ์“ฐ๋ ˆ๋“œ ๋ณ„๋กœ binary logging๊ณผ ๊ด€๋ จ๋œ ๋‚ด์šฉ์„ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ์บ์‹œ ์‚ฌ์ด์ฆˆ๋กœ ํŠธ๋žœ์žญ์…˜ ์ง€์›ํ•˜์ง€ ์•Š๋Š” ๊ตฌ๋ฌธ๋งŒ์„ ์œ„ํ•ด ์‚ฌ์šฉ๋จ
                                                     # ์ตœ๋Œ€ ์‚ฌ์ด์ฆˆ: max_binlog_stmt_cache_size๋กœ ์„ค์ •๊ฐ€๋Šฅ

#binlog_checksum = NONE                              # NONE: binary log์˜ ์ด๋ฒคํŠธ๊ฐ€ ์ œ๋Œ€๋กœ ์ž‘์„ฑ๋๋Š”์ง€ ๊ฐ๊ฐ์˜ ์ด๋ฒคํŠธ ๊ธธ์ด๋ฅผ ์ฒดํฌํ•ด์„œ ํ™•์ธ

max_binlog_size = 256M                               # binary log file ์ตœ๋Œ€ ํฌ๊ธฐ

binlog_format = ROW                                  # binary log์— ๊ธฐ๋กํ•  ๋ฐ์ดํ„ฐ ์œ ํ˜•
# transaction_isolation์ด "READ-COMMITTED" ์ด์ƒ์ด๋ฉด "MIXED" ์ด์ƒ์œผ๋กœ ์„ค์ •ํ•ด์•ผ ํ•จ
# STATEMENT: ๋ช…๋ น๋ฌธ ๊ธฐ๋ก
# MIXED : ๋ช‡๋ช‡ ์ผ๊ด€์„ฑ์„ ๋ณด์žฅํ•˜์ง€ ๋ชป ํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ROW ํฌ๋ฉง์œผ๋กœ, ๊ทธ ์™ธ์—๋Š” STATEMENT ํฌ๋ฉง์œผ๋กœ ๊ธฐ๋ก
# ROW: ์‹ค์ œ ๋ ˆ์ฝ”๋“œ ๊ธฐ๋ก

sync_binlog = 0                                      # DB์˜ binary log ๋™๊ธฐํ™” ๋นˆ๋„ ์„ค์ •
# 0: binary log๋ฅผ ๊ธฐ๋กํ•˜์ง€๋งŒ ์ง์ ‘์ ์œผ๋กœ ํ”Œ๋Ÿฌ์‹œ(๋™๊ธฐํ™”)๋ฅผ ์‹คํ–‰ํ•˜์ง€ ์•Š๊ณ , OS์— ๋งก๊น€ (๋ฆฌ๋ˆ…์Šค ๊ณ„์—ด์€ 3~5์ดˆ ๊ฐ„๊ฒฉ์œผ๋กœ ์ž๋™ ํ”Œ๋Ÿฌ์‹œํ•จ)
# 1: binary log์˜ ์“ฐ๊ธฐ๊ฐ€ ๋ฐœ์ƒํ•  ๋•Œ๋งˆ๋‹ค ๋””์Šคํฌ ๋™๊ธฐํ™” ์ˆ˜ํ–‰
#    binary log ์†์‹ค์€ ์—†์ง€๋งŒ ์žฆ์€ ๋””์Šคํฌ I/O๋กœ ๋Š๋ ค์งˆ ์ˆ˜ ์žˆ์Œ
# 1 ์ด์ƒ์˜ ๊ฐ’: ์„ค์ •๋œ ํšŸ์ˆ˜๋งŒํผ binary log ์“ฐ๊ธฐ๊ฐ€ ๋ฐœ์ƒํ•  ๋•Œ๋งˆ๋‹ค DB๊ฐ€ binary log ํŒŒ์ผ์˜ ๋™๊ธฐํ™”๋ฅผ ์‹คํ–‰
#              ์„ค์ •๋œ ๊ฐ’์ด ํด์ˆ˜๋ก ์†์‹ค๋  ์ˆ˜ ์žˆ๋Š” binary log์˜ ์–‘์ด ๋งŽ์•„์ง€๊ณ  binary log์˜ ์“ฐ๊ธฐ ์„ฑ๋Šฅ์€ ์ข‹์•„์ง

expire_logs_days = 1                                 # binary log ๋ณด๊ด€๊ธฐ๊ฐ„(์ผ), ์ด ๊ธฐ๊ฐ„์ด ์ง€๋‚˜๋ฉด ์ž๋™ ์‚ญ์ œ
log_bin_trust_function_creators = 1                  # Routine ์ƒ์„ฑ์ž ์‹ ๋ขฐ, replication ํ™˜๊ฒฝ์—์„œ๋Š” ์ด ์„ค์ •์„ ํ•ด์•ผ๋งŒ Routine ์ƒ์„ฑ์ด ๊ฐ€๋Šฅํ•จ
#binlog-annotate-row-events = ON                     # ์ฃผ์„๋„ binary log์— ๋‚จ๋„๋ก ์ฒ˜๋ฆฌ

#sql_log_bin = 0
# mysqld์— ์ ์šฉ๋˜๋Š” ์‹œ์Šคํ…œ๋ณ€์ˆ˜๋Š” ์•„๋‹ˆ๊ณ , ์“ฐ๋ ˆ๋“œ๋ ˆ๋ฒจ์—์„œ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ’์ž„
# ํ•ด๋‹น ์“ฐ๋ ˆ๋“œ์—์„œ binary log๊ฐ€ ์•ˆ ๋‚จ๊ฒŒ ํ•˜๊ณ  ์‹ถ์„ ๋•Œ๋Š” 0์œผ๋กœ ์„ค์ • ๊ฐ€๋Šฅ, SUPER ๊ถŒํ•œ ํ•„์š”ํ•จ

 ##--------------------------------------------------------------------------- ## Author: ์ฃผ๋‹ˆ์“ฐ ## ์Šฌ๋ ˆ์ด๋ธŒ(Slave) ์„ค์ • - replication ํ™˜๊ฒฝ์—์„œ slave์ผ ๋•Œ๋งŒ ์˜๋ฏธ ์žˆ์Œ ##--------------------------------------------------------------------------- #relay_log = /junyss/example/mariadb/relay # ๋ฆด๋ ˆ์ด ๋กœ๊ทธ ๊ฒฝ๋กœ #relay_log_purge = TRUE #read_only # ์ผ๊ธฐ ์ „์šฉ DB๋กœ ์„ค์ • ##--------------------------------------------------------------------------- ## Author: ์ฃผ๋‹ˆ์“ฐ ## ์Šฌ๋ ˆ์ด๋ธŒ(Slave)์ด๋ฉด์„œ ๋งˆ์Šคํ„ฐ(Master)์ธ ๊ฒฝ์šฐ ##--------------------------------------------------------------------------- #log-slave-updates # ํ˜„์žฌ ๋ณต์ œ๋˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ๋ฐ”์ด๋„ˆ๋ฆฌ ๋กœ๊ทธ์— ์ €์žฅ ##--------------------------------------------------------------------------- ## Author: ์ฃผ๋‹ˆ์“ฐ ## mysqld_safe ๋ฐ๋ชฌ์—๋งŒ ์ ์šฉ๋˜๋Š” ์„ค์ • ##--------------------------------------------------------------------------- [mysqld_safe] log-error=/junyss/example/mariadb/log/error/mysqld.err # ์—๋Ÿฌ๋กœ๊ทธ ํŒŒ์ผ๊ฒฝ๋กœ pid-file = /junyss/example/mariadb/mysqld.pid # ํ”„๋กœ์„ธ์Šค ID ํŒŒ์ผ๊ฒฝ๋กœ socket = /junyss/example/mariadb/mysqld.sock # ์†Œ์ผ“ํŒŒ์ผ ๊ฒฝ๋กœ nice = 0 ##--------------------------------------------------------------------------- ## Author: ์ฃผ๋‹ˆ์“ฐ ## mysqldump ํˆด์„ ์ด์šฉํ•œ DB ์ ‘์†์‹œ์—๋งŒ ์ ์šฉ๋˜๋Š” ์„ค์ • ##--------------------------------------------------------------------------- [mysqldump] max-allowed-packet = 1G default-character-set = 'utf8mb4' quick # ๋ฒ„ํผ๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ๋ง๊ณ , direct๋กœ ๋คํ”„๋ฐ›๊ธฐ ##--------------------------------------------------------------------------- ## Author: ์ฃผ๋‹ˆ์“ฐ ## myisamchk ํˆด์„ ์ด์šฉํ•œ DB ์ ‘์†์‹œ์—๋งŒ ์ ์šฉ๋˜๋Š” ์„ค์ • ##--------------------------------------------------------------------------- [myisamchk] key-buffer-size = 10M sort-buffer-size = 10M read-buffer-size = 8M write-buffer-size = 8M ##--------------------------------------------------------------------------- ## Author: ์ฃผ๋‹ˆ์“ฐ ## mysql ํด๋ผ์ด์–ธํŠธ ํˆด์„ ์ด์šฉํ•œ DB ์ ‘์†์‹œ์—๋งŒ ์ ์šฉ๋˜๋Š” ์„ค์ • ##--------------------------------------------------------------------------- [mysql] default-character-set = 'utf8mb4' no-auto-rehash # ์ž๋™ ์™„์„ฑ ๊ธฐ๋Šฅ ๋น„ํ™œ์„ฑํ™” local-infile = ON # local file์„ ์ด์šฉํ•œ LOAD DATA ์ž‘์—…์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•จ enable-secure-auth # ์„œ๋ฒ„๋กœ ๊ตฌ๋ฒ„์ „(4.1๋ฒ„์ „ ์ดํ•˜) ํฌ๋ฉง์œผ๋กœ ๋œ ํŒจ์Šค์›Œ๋“œ ์ „๋‹ฌ ๋น„ํ™œ์„ฑํ™” prompt=(\U){\h}[\d]\_\R:\m:\\s>\_ # SQL ํ”„๋กฌํ”„ํŠธ ์„ค์ • pager=less -n -i -F -X -E # ๋ฐ์ดํ„ฐ ์ถœ๋ ฅ์‹œ ํŽ˜์ด์ง•์ฒ˜๋ฆฌ show-warnings # ๊ฒฝ๊ณ  ๋ฐœ์ƒ์‹œ ๋ฉ”์„ธ์ง€ ์ž๋™ ์ถœ๋ ฅ #safe-updates # ๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ ๋˜๋Š” ์‚ญ์ œ์‹œ where์ ˆ์„ ํ•„์ˆ˜๋กœ ๊ฐ–๋„๋ก ์ฒ˜๋ฆฌ #i-am-a-dummy ##--------------------------------------------------------------------------- ## xtrabackup (innobackupex) ํˆด์„ ์ด์šฉํ•œ DB ์ ‘์†์‹œ์—๋งŒ ์ ์šฉ๋˜๋Š” ์„ค์ • ##--------------------------------------------------------------------------- [xtrabackup] default-character-set = 'utf8' # clientlib 5.1๋กœ xtrabackup binary๊ฐ€ build๋œ ๊ฒฝ์šฐ, ํ•ด๋‹น lib์—๋Š” utf8mb4๊ฐ€ ์—†์–ด์„œ ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ # ์˜ค๋ฅ˜๋‚ด์šฉ: "Can't initialize character set utf8mb4" # lib 5.5๋กœ xtrabackup์„ ๋‹ค์‹œ ์ปดํŒŒ์ผํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ์—†์ง€๋งŒ workaround๋กœ ์œ„์™€ ๊ฐ™์€ ์˜ต์…˜์„ ์„ค์ •ํ•ด๋„ ๋จ # ์œ„ ์„ค์ •์€ ํŠน๋ณ„ํ•œ ์˜๋ฏธ๋Š” ์—†์œผ๋ฉฐ lib 5.1์—๋Š” utf8์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์ง„ ์•Š์Œ ##--------------------------------------------------------------------------- ## Author: ์ฃผ๋‹ˆ์“ฐ ## ๋ชจ๋“  ํด๋ผ์ด์–ธํŠธ ํˆด์„ ์ด์šฉํ•œ DB ์ ‘์†์‹œ์— ์ ์šฉ๋˜๋Š” ์„ค์ • ##--------------------------------------------------------------------------- [client] port = 3306 socket = /junyss/example/mariadb/mysqld.sock default-character-set=utf8mb4โ€‹โ€‹
 

 

728x90

vim env

 


๊ทธ๋Ÿฐ ๋’ค ์œ„์™€ ๊ฐ™์ด MariaDB ์šฉ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ File์„ ์žก์„ํ•ด ์ฃผ์—ˆ์–ด์š”.

docker-compose up -d

 


์œ„์™€ ๊ฐ™์ด docker-compose File์„ ํ†ตํ•ด Container๋ฅผ ๊ธฐ๋™ํ•ด ์ฃผ์—ˆ์–ด์š”.
Docker Container ์•ˆ์œผ๋กœ ์ง„์ž…ํ•ด์„œ ์ž˜ ์„ค์น˜ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ด ๋ณผ๊ฒŒ์š”.

 

 

 

    ๐Ÿ”ฝ MariaDB

        ๐Ÿ“ฆ ์ดˆ๊ธฐ ๊ตฌ์„ฑ ๋ฐ ํ™•์ธ

์ด์ œ MariaDB์— ์ ‘์†ํ•ด์„œ ์ •์ƒ ์„ค์น˜ ์—ฌ๋ถ€์™€ ์™ธ๋ถ€์—์„œ ์ ‘์†ํ•  ์ˆ˜ ์žˆ๋Š” ๊ณ„์ •์„ ๋งŒ๋“ค๊ณ , DB Tool์„ ์ด์šฉํ•ด์„œ ์ ‘์†ํ•ด ๋ณผ๊ฒŒ์š”.

 


์ •์ƒ์ ์œผ๋กœ ์„ค์น˜๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.


create user '๊ณ„์ • ์ด๋ฆ„'@'%' identified by '๋น„๋ฐ€๋ฒˆํ˜ธ';

 

 


์ด์ œ ์™ธ๋ถ€์—์„œ ๋ถ™์–ด์„œ ์ž‘์—… ํ•  ์ˆ˜ ์žˆ๋Š” ๊ด€๋ฆฌ์ž ๊ณ„์ •์„ ํ•˜๋‚˜ ๋งŒ๋“ค์–ด ์ค„๊ฒŒ์š”. ์œ„์™€ ๊ฐ™์ด ๋งŒ๋“ค๋ฉด ์™ธ๋ถ€์—์„œ ์ ‘์†์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.


select host,user from mysql.user;

 


์œ„์™€ ๊ฐ™์ด ์™ธ๋ถ€ ์ ‘์† ๊ฐ€๋Šฅํ•œ ๊ด€๋ฆฌ์ž ๊ณ„์ •์ด ์ƒ์„ฑ๋˜์—ˆ์–ด์š”.

 

grant all privileges on *.* to '๊ณ„์ • ์ด๋ฆ„'@'%';

๋ฐ˜์‘ํ˜•


ํ•ด๋‹น ๊ณ„์ •์—๊ฒŒ Data Base์— ๊ด€ํ•˜์—ฌ ๋ชจ๋“  ๊ถŒํ•œ์„ ์ฃผ์—ˆ์–ด์š”.

 

 


DB Tool๋กœ ์ ‘์† ํ…Œ์ŠคํŠธ๋ฅผ ํ•ด๋ณด๋‹ˆ ์ •์ƒ์ ์œผ๋กœ ์—ฐ๊ฒฐ์ด ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์ฐธ๊ณ ๋กœ Port๊ฐ€ 1000์ธ ์ด์œ ๋Š” Docker๋ฅผ ๋งŒ๋“ค ๋•Œ, Port Mapping์„ ํ•ด์คฌ๊ธฐ ๋•Œ๋ฌธ์ด์—์š”.

 





๐Ÿง ์ฐธ๊ณ  ์ž๋ฃŒ

 

make my.cnf · MariaDB-Installation

 

good-dba.gitbooks.io

 

 

 

Docker Compose๋กœ MySQL/MariaDB ์„ธํŒ…ํ•˜๊ธฐ - ์ธํ•˜๋Œ€ํ•™๊ต ์ธํŠธ์•„์ด

Docker Compose๋ฅผ ์ด์šฉํ•˜๋ฉด ๋ณต์žกํ•œ DB ์„ค์น˜์™€ ์„ธํŒ… ๊ณผ์ •์„ ํŒŒ์ผ ํ•˜๋‚˜๋กœ ๊ฐ„๋žตํ™” ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Docker์™€ Docker Compose๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์–ด์•ผ ํ•˜๋ฉฐ,...

int-i.github.io

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•