|
|
|
@@ -30,10 +30,39 @@ services: |
|
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} |
|
|
|
MYSQL_DATABASE: ${MYSQL_DATABASE:-emp} |
|
|
|
command: |
|
|
|
# 字符集/时区 |
|
|
|
- --character-set-server=utf8mb4 |
|
|
|
- --collation-server=utf8mb4_0900_ai_ci |
|
|
|
- --default-time-zone=+08:00 |
|
|
|
- --max-connections=1000 |
|
|
|
# InnoDB 核心 |
|
|
|
- --innodb_buffer_pool_size=16G |
|
|
|
- --innodb_buffer_pool_instances=8 |
|
|
|
- --innodb_log_file_size=2G |
|
|
|
- --innodb_log_buffer_size=64M |
|
|
|
- --innodb_flush_log_at_trx_commit=2 |
|
|
|
- --innodb_flush_method=O_DIRECT |
|
|
|
- --innodb_io_capacity=2000 |
|
|
|
- --innodb_io_capacity_max=4000 |
|
|
|
- --innodb_thread_concurrency=0 |
|
|
|
# 连接/表缓存/文件句柄 |
|
|
|
- --max_connections=1000 |
|
|
|
- --table_open_cache=4000 |
|
|
|
- --table_open_cache_instances=16 |
|
|
|
- --open_files_limit=65535 |
|
|
|
# 会话级缓冲 |
|
|
|
- --tmp_table_size=256M |
|
|
|
- --max_heap_table_size=256M |
|
|
|
- --sort_buffer_size=4M |
|
|
|
- --join_buffer_size=4M |
|
|
|
- --read_rnd_buffer_size=4M |
|
|
|
# 慢查询日志 |
|
|
|
- --slow_query_log=ON |
|
|
|
- --long_query_time=0.5 |
|
|
|
- --log_output=TABLE |
|
|
|
ulimits: |
|
|
|
nofile: |
|
|
|
soft: 65535 |
|
|
|
hard: 65535 |
|
|
|
volumes: |
|
|
|
- mysql_data:/var/lib/mysql |
|
|
|
healthcheck: |
|
|
|
|