2026-07-27 15:16:57 +08:00
|
|
|
# Managed by XINFRA MySQL delivery - generated, do not edit by hand
|
|
|
|
|
# instance={{ mysql_instance }} version={{ mysql_version_value }} topology={{ topology }}
|
|
|
|
|
[client]
|
|
|
|
|
socket={{ mysql_run_dir }}/mysql.sock
|
|
|
|
|
port={{ mysql_port_value }}
|
|
|
|
|
|
2026-07-23 12:05:07 +08:00
|
|
|
[mysqld]
|
|
|
|
|
user=mysql
|
|
|
|
|
basedir=/usr
|
|
|
|
|
datadir={{ mysql_data_dir }}
|
2026-07-27 15:16:57 +08:00
|
|
|
tmpdir={{ mysql_tmp_dir }}
|
2026-07-23 12:05:07 +08:00
|
|
|
socket={{ mysql_run_dir }}/mysql.sock
|
|
|
|
|
pid-file={{ mysql_run_dir }}/mysql.pid
|
|
|
|
|
port={{ mysql_port_value }}
|
|
|
|
|
bind-address=0.0.0.0
|
2026-07-27 15:16:57 +08:00
|
|
|
skip-name-resolve=ON
|
|
|
|
|
server-id={{ mysql_server_id_value }}
|
|
|
|
|
local-infile=OFF
|
|
|
|
|
|
|
|
|
|
# --- charset / collation / timezone / identifier case ---
|
|
|
|
|
character-set-server={{ mysql_character_set }}
|
|
|
|
|
collation-server={{ mysql_collation }}
|
|
|
|
|
default-time-zone={{ mysql_timezone }}
|
|
|
|
|
lower-case-table-names={{ mysql_lower_case_table_names }}
|
|
|
|
|
|
|
|
|
|
# --- error / slow log ---
|
2026-07-23 12:05:07 +08:00
|
|
|
log-error={{ mysql_log_dir }}/error.log
|
|
|
|
|
slow-query-log=ON
|
|
|
|
|
slow-query-log-file={{ mysql_log_dir }}/slow.log
|
2026-07-27 15:16:57 +08:00
|
|
|
long-query-time={{ mysql_long_query_time }}
|
|
|
|
|
|
|
|
|
|
# --- binlog (PITR + replication base) ---
|
|
|
|
|
log-bin={{ mysql_binlog_dir }}/binlog
|
2026-07-23 12:05:07 +08:00
|
|
|
binlog-format=ROW
|
2026-07-27 15:16:57 +08:00
|
|
|
sync-binlog={{ mysql_sync_binlog }}
|
|
|
|
|
max-binlog-size={{ mysql_max_binlog_size }}
|
|
|
|
|
binlog-expire-logs-seconds={{ mysql_binlog_expire_logs_seconds }}
|
|
|
|
|
{% if topology != 'standalone' %}
|
2026-07-23 12:05:07 +08:00
|
|
|
gtid-mode=ON
|
|
|
|
|
enforce-gtid-consistency=ON
|
2026-07-27 15:16:57 +08:00
|
|
|
relay-log={{ mysql_binlog_dir }}/relay-bin
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
# --- InnoDB core ---
|
|
|
|
|
innodb-buffer-pool-size={{ ((mysql_memory_mb_value | int) * 55 / 100) | int }}M
|
|
|
|
|
innodb-flush-method=O_DIRECT
|
|
|
|
|
innodb-flush-log-at-trx-commit={{ mysql_flush_log_at_trx_commit }}
|
|
|
|
|
innodb-io-capacity={{ mysql_io_capacity }}
|
|
|
|
|
max-connections={{ mysql_max_connections }}
|
|
|
|
|
|
|
|
|
|
# --- redo log (version-sensitive) ---
|
|
|
|
|
innodb-log-group-home-dir={{ mysql_redo_dir }}
|
|
|
|
|
{% if mysql_version_value in ['8.0', '8.4'] %}
|
|
|
|
|
innodb-redo-log-capacity={{ mysql_redo_capacity }}
|
|
|
|
|
{% else %}
|
|
|
|
|
innodb-log-file-size={{ mysql_redo_capacity }}
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
# --- X Protocol disabled (version-sensitive) ---
|
|
|
|
|
{% if mysql_version_value in ['8.0', '8.4'] %}
|
|
|
|
|
mysqlx=0
|
|
|
|
|
{% elif mysql_version_value == '5.7' %}
|
|
|
|
|
loose-mysqlx=0
|
|
|
|
|
{% endif %}
|
2026-07-23 12:05:07 +08:00
|
|
|
|
|
|
|
|
{% if topology == 'mgr_3' %}
|
2026-07-27 15:16:57 +08:00
|
|
|
# --- Group Replication (config-ready; runtime bootstrap handled out-of-band) ---
|
2026-07-23 12:05:07 +08:00
|
|
|
plugin-load-add=group_replication.so
|
2026-07-27 15:18:54 +08:00
|
|
|
{% if mysql_version_value != '8.4' %}
|
|
|
|
|
{# deprecated since 8.0.26 and removed in 8.3+; only inject for older series #}
|
2026-07-23 12:05:07 +08:00
|
|
|
transaction-write-set-extraction=XXHASH64
|
2026-07-27 15:18:54 +08:00
|
|
|
{% endif %}
|
2026-07-23 12:05:07 +08:00
|
|
|
loose-group-replication-group-name={{ mgr_group_name }}
|
|
|
|
|
loose-group-replication-start-on-boot=OFF
|
2026-07-27 15:16:57 +08:00
|
|
|
loose-group-replication-local-address={{ ansible_host | default(inventory_hostname) }}:{{ mysql_gr_port_value }}
|
|
|
|
|
loose-group-replication-group-seeds={% for host in ansible_play_hosts_all %}{{ hostvars[host].ansible_host | default(host) }}:{{ mysql_gr_port_value }}{% if not loop.last %},{% endif %}{% endfor %}
|
|
|
|
|
|
2026-07-23 12:05:07 +08:00
|
|
|
loose-group-replication-ip-allowlist={% for host in ansible_play_hosts_all %}{{ hostvars[host].ansible_host | default(host) }}{% if not loop.last %},{% endif %}{% endfor %}
|
2026-07-27 15:16:57 +08:00
|
|
|
|
2026-07-23 12:05:07 +08:00
|
|
|
loose-group-replication-single-primary-mode=ON
|
|
|
|
|
loose-group-replication-enforce-update-everywhere-checks=OFF
|
|
|
|
|
{% endif %}
|