feat(delivery): extend MySQL delivery parameters and tighten resource bounds
- Add topology/port/data_disk, DB options and 8 advanced parameters with whitelist validation, rendered via extra_vars into the playbook - Hybrid port allocation over pool 13306-13999 - Tighten bounds: memory 2048-65536 MiB, storage 20-2000 GiB
This commit is contained in:
@@ -1,35 +1,79 @@
|
||||
# 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 }}
|
||||
|
||||
[mysqld]
|
||||
user=mysql
|
||||
basedir=/usr
|
||||
datadir={{ mysql_data_dir }}
|
||||
tmpdir={{ mysql_tmp_dir }}
|
||||
socket={{ mysql_run_dir }}/mysql.sock
|
||||
pid-file={{ mysql_run_dir }}/mysql.pid
|
||||
port={{ mysql_port_value }}
|
||||
bind-address=0.0.0.0
|
||||
mysqlx=0
|
||||
server-id={{ 101 + mysql_node_index | int }}
|
||||
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 ---
|
||||
log-error={{ mysql_log_dir }}/error.log
|
||||
slow-query-log=ON
|
||||
slow-query-log-file={{ mysql_log_dir }}/slow.log
|
||||
skip-name-resolve=ON
|
||||
max-connections=100
|
||||
innodb-buffer-pool-size={{ ((mysql_memory_mb_value | int) * 55 / 100) | int }}M
|
||||
innodb-log-file-size=128M
|
||||
log-bin={{ mysql_log_dir }}/mysql-bin
|
||||
long-query-time={{ mysql_long_query_time }}
|
||||
|
||||
# --- binlog (PITR + replication base) ---
|
||||
log-bin={{ mysql_binlog_dir }}/binlog
|
||||
binlog-format=ROW
|
||||
sync-binlog={{ mysql_sync_binlog }}
|
||||
max-binlog-size={{ mysql_max_binlog_size }}
|
||||
binlog-expire-logs-seconds={{ mysql_binlog_expire_logs_seconds }}
|
||||
{% if topology != 'standalone' %}
|
||||
gtid-mode=ON
|
||||
enforce-gtid-consistency=ON
|
||||
relay-log={{ mysql_log_dir }}/relay-bin
|
||||
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 %}
|
||||
|
||||
{% if topology == 'mgr_3' %}
|
||||
# --- Group Replication (config-ready; runtime bootstrap handled out-of-band) ---
|
||||
plugin-load-add=group_replication.so
|
||||
transaction-write-set-extraction=XXHASH64
|
||||
loose-group-replication-group-name={{ mgr_group_name }}
|
||||
loose-group-replication-start-on-boot=OFF
|
||||
loose-group-replication-local-address={{ ansible_host | default(inventory_hostname) }}:{{ mysql_port_value | int + 10000 }}
|
||||
loose-group-replication-group-seeds={% for host in ansible_play_hosts_all %}{{ hostvars[host].ansible_host | default(host) }}:{{ mysql_port_value | int + 10000 }}{% if not loop.last %},{% endif %}{% endfor %}
|
||||
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 %}
|
||||
|
||||
loose-group-replication-ip-allowlist={% for host in ansible_play_hosts_all %}{{ hostvars[host].ansible_host | default(host) }}{% if not loop.last %},{% endif %}{% endfor %}
|
||||
|
||||
loose-group-replication-single-primary-mode=ON
|
||||
loose-group-replication-enforce-update-everywhere-checks=OFF
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user