# MySQL 主节点配置 (Node-01) # GTID 主从复制 [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 connect_timeout = 10 # 缓冲配置 (8GB内存建议) innodb_buffer_pool_size = 2G innodb_buffer_pool_instances = 4 innodb_log_buffer_size = 64M innodb_log_file_size = 512M innodb_flush_log_at_trx_commit = 1 innodb_flush_method = O_DIRECT # 日志配置 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 log_queries_not_using_indexes = 0 # 临时目录 tmpdir = /tmp # 二进制日志配置 (主节点) server-id = 1 log-bin = mysql-bin binlog_format = ROW binlog_row_image = FULL binlog_cache_size = 1M max_binlog_size = 500M expire_logs_days = 7 sync_binlog = 1 # GTID 配置 gtid-mode = ON enforce-gtid-consistency = ON log-slave-updates = ON # 复制配置 binlog-do-db = video_auth binlog-do-db = video_user binlog-do-db = video_content binlog-do-db = video_comment binlog-do-db = video_recommend binlog-do-db = video_admin binlog-do-db = nacos_config # 安全配置 skip-name-resolve sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION [mysql] default-character-set = utf8mb4 prompt = '\u@\h [\d]> ' [client] default-character-set = utf8mb4