chore(deploy): Add high availability cluster deployment configuration
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
# MySQL 高可用配置
|
||||
# 从节点配置 (Node-02, Node-03)
|
||||
# 注意: 每个从节点需要设置不同的 server-id
|
||||
|
||||
[mysqld]
|
||||
# 基础配置
|
||||
user = mysql
|
||||
port = 3306
|
||||
bind-address = 0.0.0.0
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
default-authentication-plugin = mysql_native_password
|
||||
|
||||
# 连接配置
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
wait_timeout = 28800
|
||||
interactive_timeout = 28800
|
||||
|
||||
# 缓冲配置
|
||||
innodb_buffer_pool_size = 1G
|
||||
innodb_buffer_pool_instances = 4
|
||||
innodb_log_buffer_size = 64M
|
||||
innodb_log_file_size = 512M
|
||||
|
||||
# 日志配置
|
||||
log-error = /var/lib/mysql/mysql-error.log
|
||||
slow_query_log = 1
|
||||
slow_query_log_file = /var/lib/mysql/mysql-slow.log
|
||||
long_query_time = 2
|
||||
|
||||
# 主从复制配置 - 从节点
|
||||
# server-id 在docker-compose中通过环境变量设置
|
||||
# server-id = 2 # Node-02
|
||||
# server-id = 3 # Node-03
|
||||
log-bin = mysql-bin
|
||||
binlog_format = ROW
|
||||
binlog_row_image = FULL
|
||||
relay-log = relay-bin
|
||||
relay-log-index = relay-bin.index
|
||||
read_only = ON
|
||||
super_read_only = ON
|
||||
|
||||
# GTID配置
|
||||
gtid-mode = ON
|
||||
enforce-gtid-consistency = ON
|
||||
|
||||
# 从节点并行复制
|
||||
slave_parallel_type = LOGICAL_CLOCK
|
||||
slave_parallel_workers = 4
|
||||
slave_preserve_commit_order = ON
|
||||
|
||||
# 半同步复制 (可选)
|
||||
# plugin-load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
|
||||
# rpl_semi_sync_slave_enabled = 1
|
||||
|
||||
[mysql]
|
||||
default-character-set = utf8mb4
|
||||
|
||||
[client]
|
||||
default-character-set = utf8mb4
|
||||
Reference in New Issue
Block a user