MySQL Custom Directory Layout
Starting from dbbot 1.7, customizing the MySQL directory structure through advanced_config.yml is supported.
1. Directory configuration entry
File path:
/usr/local/dbbot/mysql_ansible/playbooks/advanced_config.yml
Examples of typical directory parameters:
mycnf_dir: "{{ mysql_data_dir_base }}/etc/{{ mysql_port }}"
datadir: "{{ mysql_data_dir_base }}/data/{{ mysql_port }}"
tmpdir: "{{ mysql_data_dir_base }}/tmp/{{ mysql_port }}"
binlog_dir: "{{ mysql_data_dir_base }}/log/binlog/{{ mysql_port }}"
relaylog_dir: "{{ mysql_data_dir_base }}/log/relaylog/{{ mysql_port }}"
redolog_dir: "{{ mysql_data_dir_base }}/log/redolog/{{ mysql_port }}"
socket_dir: "{{ datadir }}"
mysqlx_socket_dir: "{{ datadir }}"
slowlog_dir: "{{ datadir }}"
errlog_dir: "{{ datadir }}"

2. Modify the log file name
If you want to modify the log file name (not just the directory), you need to change the template file:
/usr/local/dbbot/mysql_ansible/roles/mysql_server/templates/8.4/my.cnf.j2
Example:
slow_query_log_file = {{ slowlog_dir }}/slow.log
Can be changed to: slow_query.log.
3. Design description
- The directory needs to be created by dbbot and handle permissions.
- Physical files are usually created by MySQL itself when it is initialized.
- It is recommended to verify it in a test environment before using it in production.