MySQL Variables and Parameters
This article summarizes the variables that are most frequently changed and most likely to affect results in the public mysql_ansible entry playbooks, so you can quickly locate the right configuration entry before deployment, backup, restore, and monitoring integration.
1. General variables
File: playbooks/common_config.yml
| Variable | Default value | Function |
|---|---|---|
mysql_version | 9.7.0 | MySQL version. Current public capabilities mainly target 5.7, 8.0, 8.4, and 9.7 |
mysql_port | 3306 | Instance port and the baseline for several derived paths and service names |
server_specs | auto | Server sizing. You can keep auto-detection or set a fixed value such as 4c8g |
db_type | mysql | Database type. Supports mysql, percona, and greatsql |
mysql_packages_dir | ../downloads/ | Directory for MySQL installation packages |
mysql_user / mysql_group | mysql / mysql | Linux runtime user and group for MySQL |
mysql_data_dir_base | /database/{{ db_type }} | Base directory for MySQL data, logs, and configuration |
mysql_service_name | mysql{{ mysql_port }} | systemd service name, derived from the MySQL port by default |
mysql_admin_user / mysql_admin_password | admin / Dbbot_admin@8888 | Administrative account and password |
mysql_rple_user / mysql_rple_password | repl / Dbbot_repl@8888 | Replication account and password |
mysql_backup_user / mysql_backup_password | backup / Dbbot_backup@8888 | Backup account and password |
mysql_monitor_user / mysql_monitor_password | monitor / Dbbot_monitor@8888 | Monitoring account used by mysqld_exporter |
mysql_cluster_admin_user / mysql_cluster_admin_password | clusteradmin / Dbbot_clusteradmin@8888 | mysqlshell management account for InnoDB Cluster |
mysql_router_user / mysql_router_password | mysqlrouter / Dbbot_mysqlrouter@8888 | Account used by MySQL Router to read metadata |
mysql_character_set_server | utf8mb4 | Server character set |
mysql_transaction_isolation | READ-COMMITTED | Default transaction isolation level |
mysql_default_time_zone | +8:00 | Default MySQL time zone |
mysql_max_connections | 1000 | Maximum number of connections |
mysql_binlog_format | row | Binlog format. This is especially important for MGR and InnoDB Cluster |
fcs_auto_download_packages | true | Whether the control node automatically downloads MySQL, Shell, Router, and Exporter packages |
fcs_allow_custom_mysql_package | false | Whether to temporarily allow a MySQL Server package name that is not in the support matrix |
fcs_allow_dbbot_default_passwd | false | Whether execution is allowed to continue with dbbot public default passwords |
fcs_create_mysql_fast_login | true | Whether to create shortcuts such as db3306 for the mysql user |
fcs_backup_script_create_backup_user | true | Whether the backup playbook creates the backup account automatically |
fcs_role_mysqld_exporter_create_monitor_user | true | Whether mysqld_exporter installation creates the monitor account automatically |
fcs_mysql_use_jemalloc | false | Whether to explicitly enable jemalloc preload |
fcs_mysql_allow_bundled_jemalloc_fallback | false | Whether dbbot is allowed to fall back to the bundled legacy RPM when the OS repo has no jemalloc |
fcs_use_greatsql_ha | true | Whether GreatSQL HA related capabilities are enabled |
fcs_run_post_deploy_checks | true | Whether deployment entry playbooks run post-deploy acceptance checks automatically |
dbbot_confirmation_input | "" | In automation you can set this to confirm; for manual runs, keeping it empty is safer |
Notes:
- Public default passwords follow the
Dbbot_<user>@8888/Dbbot_<linux_user>@9999convention. By default,fcs_allow_dbbot_default_passwd: false, so playbooks block those defaults inpre_tasks. - The current default for
fcs_mysql_use_jemallocisfalse, which means the system allocator remains the default behavior. - When
fcs_mysql_use_jemalloc: true, dbbot first tries the OS repository package. It only falls back to the bundled legacy RPM if you explicitly setfcs_mysql_allow_bundled_jemalloc_fallback: true. mysql_binlog_formatis configurable in the common file, butmgr.ymlstill requiresrow.fcs_run_post_deploy_checksis enabled by default. To temporarily skip post-deploy acceptance checks, pass-e fcs_run_post_deploy_checks=falseexplicitly.- Automatic acceptance checks currently cover
single_node.yml,master_slave.yml,mgr.yml,innodb_cluster.yml,innodb_cluster_router.yml,mha_go.yml,mha.yml, exporter installation entry playbooks, andunsafe_uninstall.yml. Backup and restore entry playbooks are not covered yet. - Primary-replica post-deploy checks require zero replication lag by default. Use
dbbot_post_check_replication_max_lag_secondsonly when you need to temporarily relax that acceptance threshold. - MySQL server package metadata is resolved from
dbbotctl supportafter the target OS is detected. Usedbbotctl support packagesto inspect the package name, download URL, and checksum for a version/OS pair. - MySQL
9.7.xis not supported on the CentOS/RHEL 7 family; use MySQL8.4.xon those systems.
2. Directory and package variables
File: playbooks/advanced_config.yml
| Variable | Default value | Function |
|---|---|---|
mycnf_dir | {{ mysql_data_dir_base }}/{{ mysql_port }}/etc | Directory that stores my.cnf |
datadir | {{ mysql_data_dir_base }}/{{ mysql_port }}/data | Data directory |
tmpdir | {{ mysql_data_dir_base }}/{{ mysql_port }}/tmp | Temporary directory |
binlog_dir / relaylog_dir | {{ mysql_data_dir_base }}/{{ mysql_port }}/log | Directories for binlog and relay log files |
redolog_dir | {{ datadir }} | Redo log directory, which defaults back to datadir |
socket / mysqlx_socket | Derived from datadir | MySQL and MySQL X socket paths |
mysql_package | Resolved from dbbotctl support | Final MySQL / Percona / GreatSQL server package file name expected by the playbook |
mysql_package_download_url | Resolved from dbbotctl support | Download URL used when fcs_auto_download_packages: true |
mysql_package_checksum_type / mysql_package_checksum | Resolved from dbbotctl support | Checksum metadata used to verify the server package when available |
mysql_custom_package | "" | Temporary MySQL Server package file name used when fcs_allow_custom_mysql_package: true |
mysql_custom_package_download_url | "" | Optional custom package download URL. When empty, only the local file is checked |
mysql_custom_package_checksum_type / mysql_custom_package_checksum | none / - | Optional checksum for the custom package. Supported types: md5, sha256, sha512 |
Recommendations:
- Only change directory variables when you need a custom directory layout or a special restore path. Package metadata should normally come from
dbbotctl support; for offline deployment, place the package with the support matrix file name undermysql_packages_dir. - To temporarily test a MySQL Server package that is not in the support matrix, explicitly set
fcs_allow_custom_mysql_package: trueand setmysql_custom_packageinadvanced_config.yml. This applies to every entry that deploys MySQL Server, not only standalone deployment. It only overrides the Server package name;mysql_version, target OS, topology support checks, and MySQL Shell / Router package names still come from the support matrix. - The cleanup scope of
unsafe_uninstall.ymlalso depends on these directory variables. With the current default layout, it removes both the instance data and log directories, but keeps the instancemy.cnf.
3. Primary-replica, legacy MHA, and MHA-Go variables
Files:
playbooks/vars/var_master_slave.ymlplaybooks/vars/var_mha.ymlplaybooks/vars/var_mha_go.yml
| Variable | Default value | Function |
|---|---|---|
master_ip | 192.0.2.131 | Primary server IP |
slave_ips | ['192.0.2.132', '192.0.2.133'] | Replica IP list |
sub_nets | 192.0.2.% | Trusted subnet, domain, or IP range for MySQL |
manager_ip | Legacy MHA: 192.0.2.133; MHA-Go: {{ master_ip }} | Node used by the manager |
net_work_interface | ens33 | NIC used to bind the MHA VIP |
vip | 192.0.2.130 | MHA VIP |
vip_netmask | 32 | MHA VIP netmask |
mha_go_semi_sync_policy | disabled | MHA-Go semi-sync check policy |
mha_go_writer_endpoint_enabled | false | Whether MHA-Go enables VIP writer endpoint switching |
Notes:
master_ipandslave_ipsmust match the hosts in the inventory.- Legacy Perl MHA still expects
manager_ipon a replica node and not equal tomaster_ip. - MHA-Go allows
manager_ipto be eithermaster_ipor a member ofslave_ips; its current default ismaster_ip. - The actual variable name is
slave_ips, notreplica_ips. - The default
net_work_interfacevalue is only an example interface name. Before enabling legacy MHA VIP or the MHA-Go VIP writer endpoint, confirm the real interface withip routeorip addr. Sample environments using the dbbot192.168.161.*test inventory usually useenp1s0, but the real interface depends on the active test profile.
4. MGR variables
File: playbooks/vars/var_mgr.yml
| Variable | Default value | Function |
|---|---|---|
mysql_binlog_format | row | Overrides the common setting so MGR uses row |
mysql_mgr_port | Auto-calculated, for example 33061 when mysql_port=3306 | Group Replication communication port |
mysql_mgr_hosts | ['192.0.2.131', '192.0.2.132', '192.0.2.133'] | List of MGR members |
sub_nets | 192.0.2.% | Trusted source range |
greatsql_vip | 192.0.2.134 | VIP for GreatSQL HA scenarios |
greatsql_net_work_interface | ens33 | NIC used by the GreatSQL HA VIP |
greatsql_netmask | 255.255.255.255 | Netmask used by GreatSQL HA |
greatsql_group_replication_arbitrator | false | Whether to enable an arbitrator node |
greatsql_group_replication_arbitrator_hosts | ['192.0.2.133'] | Arbitrator node list |
Notes:
greatsql_*variables only apply whendb_type: greatsql.- Override
greatsql_net_work_interfacewith the real interface name. Sample environments using the dbbot192.168.161.*test inventory usually useenp1s0, but the real interface depends on the active test profile. mgr.ymldeploys single-primary mode by default.
5. InnoDB Cluster and Router variables
Files:
playbooks/vars/var_innodb_cluster.ymlplaybooks/vars/var_innodb_cluster_router.yml
InnoDB Cluster variables:
| Variable | Default value | Function |
|---|---|---|
innodb_cluster_name | myCluster{{ mysql_port }} | Cluster name |
innodb_cluster_primary | 192.0.2.131 | Initial primary node |
innodb_cluster_members | ['192.0.2.131', '192.0.2.132', '192.0.2.133'] | Cluster member list |
mysql_mgr_port | Auto-calculated, for example 33061 when mysql_port=3306 | InnoDB Cluster still relies on the underlying MGR port |
mysql_mgr_hosts | {{ innodb_cluster_members }} | Underlying MGR member list |
mysql_cluster_admin_user / mysql_cluster_admin_password | clusteradmin / Dbbot_clusteradmin@8888 | mysqlshell management account |
Router variables:
| Variable | Default value | Function |
|---|---|---|
router_enable_ha | false | Whether Router HA is enabled with keepalived |
router_bootstrap_server | 192.0.2.131 | Cluster node used for Router bootstrap |
router_linux_glibc_tag | auto | Router package glibc tag; can be explicitly set to glibc2.17 or glibc2.28 |
router_vip | 192.0.2.150 | Router HA VIP |
router_net_work_interface | ens33 | NIC used by the VIP |
router_ha_nodes | Two-node example | Router HA nodes, roles, and priorities |
router_vip_netmask | 32 | Router VIP netmask |
router_ports | rw/ro/http... dictionary | Router ports, enable flags, and health-check participation |
max_total_connections | 1000 | Global Router connection limit |
router_rest_api_bind_address | 127.0.0.1 | REST API bind address |
router_rest_api_auth_mode | file | REST API authentication mode |
router_rest_api_file_user / router_rest_api_file_password | router_api_user / Dbbot_router_api_user@8888 | File-based REST API credentials |
Notes:
router_ha_nodesonly matters whenrouter_enable_ha: true.- Override
router_net_work_interfacewith the real interface name on the Router nodes. Sample environments using the dbbot192.168.161.*test inventory usually useenp1s0, but the real interface depends on the active test profile. - With
router_linux_glibc_tag: auto, Router9.7.xusesglibc2.28and Router8.4.xusesglibc2.17; set the glibc tag explicitly when you need a fixed package name. - By default,
router_ports.http.portis8443, andmysqlrouter_exporterreads Router metrics from this REST API endpoint.
6. Exporter variables
Files:
playbooks/vars/var_node_exporter_install.ymlplaybooks/vars/var_mysqld_exporter_install.ymlplaybooks/vars/var_router_exporter_install.yml
| Variable | Default value | Function |
|---|---|---|
node_exporter_install | true | Whether to install node_exporter |
node_exporter_port | 9100 | Listening port for node_exporter |
node_exporter_install_type | dbbot | Installation mode: dbbot, pmm, or package |
node_exporter_package | node_exporter-1.10.2.linux-amd64.tar.gz | Official package name used in package mode |
mysqld_exporter_install | true | Whether to install mysqld_exporter |
mysqld_exporter_topology | auto | Topology type: auto, ms, or mgr |
mysqld_exporter_port | auto | Exporter port. Can be auto-calculated or explicitly set |
mysqld_exporter_port_auto_base | 9104 | Start of the auto-generated exporter port range |
mysqld_exporter_port_auto_mysql_base | 3306 | MySQL baseline port used in the auto port calculation |
mysqld_exporter_install_type | dbbot | Installation mode: dbbot, pmm, or package |
mysqld_exporter_package | mysqld_exporter-0.18.0.linux-amd64.tar.gz | Official package name used in package mode |
mysqlrouter_exporter_install | true | Whether to install mysqlrouter_exporter |
mysqlrouter_exporter_install_type | dbbot | Installation mode: dbbot or package |
mysqlrouter_exporter_version | 0.0.1 | Default standalone project version |
mysqlrouter_exporter_package | mysqlrouter_exporter_0.0.1_linux_amd64.tar.gz | Release archive name used in package mode |
mysqlrouter_exporter_url | https://github.com/fanderchan/mysqlrouter_exporter/releases/download/v0.0.1/mysqlrouter_exporter_0.0.1_linux_amd64.tar.gz | Release archive URL used in package mode |
mysqlrouter_exporter_port | 9165 | Listening port for mysqlrouter_exporter |
mysqlrouter_exporter_api_base_url | https://127.0.0.1:8443/api/20190715 | Router REST API endpoint |
mysqlrouter_exporter_api_user / mysqlrouter_exporter_api_password | router_api_user / Dbbot_router_api_user@8888 | Router API credentials |
mysqlrouter_exporter_insecure_skip_verify | true | Whether to skip HTTPS certificate verification |
Auto port rule:
- When
mysqld_exporter_port: auto, the port is calculated as9104 + mysql_port - 3306. - When
mysqld_exporter_topology: auto, dbbot checksperformance_schema.replication_group_members; if members exist it resolves tomgr, otherwise it resolves toms. mysqlrouter_exporterdepends on the Router REST API by default, so if you change the Router HTTP port or bind address, update the exporter settings as well.mysqlrouter_exporter_install_type: dbbotuses the bundled binary from thedbbotrelease package, whilepackagedownloads the standalone project’s release archive frommysqlrouter_exporter_url.
6.1 Dependency quick reference
Router chain:
innodb_cluster.ymlinnodb_cluster_router.ymlrouter_exporter_install.ymldbbotctl exporter register -t routerrouter_unsafe_uninstall.ymlwhen Router cleanup is required
MHA chain:
mha.ymlmha_unsafe_uninstall.ymlwhen legacy MHA and the MySQL instance must be cleaned up togethermha_go.ymlmha_go_unsafe_uninstall.ymlwhen MHA-Go and the MySQL instance must be cleaned up together
MySQL exporter chain:
single_node.yml/master_slave.yml/mgr.ymlnode_exporter_install.ymlmysqld_exporter_install.ymldbbotctl exporter register -t nodedbbotctl exporter register -t mysql
7. MySQL 8.4 clone backup variables
File: playbooks/vars/var_backup_script_8.4.yml
| Variable | Default value | Function |
|---|---|---|
backup_topology | auto | Topology detection mode. Supports auto, ms, mgr, mic, and single |
backup_scope | primary_only | Backup target scope. Supports primary_only, replica_one, replica_all, all, and selected |
backup_preferred_host | "" | Required when backup_scope=selected |
backup_base_dir | /backup | Base backup directory |
backup_script_dir | {{ mysql_data_dir_base }}/scripts | Directory that stores backup scripts |
backup_script_path | {{ backup_script_dir }}/backup_clone{{ mysql_port }}.sh | Clone backup script path |
backup_schedule_script_path | {{ backup_script_dir }}/backup_schedule{{ mysql_port }}.sh | Scheduler script path |
backup_purge_script_path | {{ backup_script_dir }}/backup_purge{{ mysql_port }}.sh | Purge script path |
backup_config_path | {{ backup_script_dir }}/backup_clone{{ mysql_port }}.conf | Backup configuration file path |
backup_keep_full | 2 | Number of full snapshots to retain |
backup_keep_binlog_days | 7 | Number of days to retain binlogs |
backup_cron | 0 2 * * * | Cron expression used by the scheduled backup |
Notes:
- When
backup_scope=selected,backup_preferred_hostmust be set explicitly. backup_cronis validated as a five-field cron expression inpre_tasks.
8. MySQL 8.4 PITR restore variables
File: playbooks/vars/var_restore_pitr_8.4.yml
| Variable | Default value | Function |
|---|---|---|
restore_mode | new_instance | Restore mode: new_instance or existing_instance |
backup_snapshot_id | "" | Backup snapshot identifier. Required |
backup_source_mysql_port | 3306 | Source MySQL port used by the backup |
restore_target_mysql_port | 3388 | Target MySQL port for the restored instance |
backup_root_dir | /backup | Base backup directory on the restore host |
backup_dir | {{ backup_root_dir }}/mysql{{ backup_source_mysql_port }}/{{ backup_snapshot_id }} | Resolved backup directory |
enable_pitr | true | Whether to apply binlogs after the clone restore |
pitr_target_time | "" | Stop point based on wall-clock time, format YYYY-MM-DD HH:MM:SS |
pitr_target_gtid | "" | Stop point based on a single GTID, format uuid:seq |
pitr_target_gtid_inclusive | false | Whether the target GTID itself is included |
restore_mysql_host / restore_mysql_user / restore_mysql_password | 127.0.0.1 / {{ mysql_admin_user }} / {{ mysql_admin_127_password }} | Connection settings used when replaying binlogs |
restore_allow_nonempty_datadir | false | Whether restore is allowed when the target datadir already contains data |
restore_mysql_start_timeout | 300 | Timeout in seconds when waiting for MySQL to start |
mysql_port | {{ restore_target_mysql_port }} | Keeps the restore flow aligned with the target MySQL port |
Restore constraints:
- When
enable_pitr: true, set exactly one ofpitr_target_timeorpitr_target_gtid. restore_pitr_8.4.ymlonly supportsdb_type: mysqlandmysql_version: 8.4.x.
9. Notes for the 5.7 backup script and uninstall
backup_script.yml and unsafe_uninstall.yml do not have dedicated vars/*.yml files. They mainly depend on the following configuration sources:
- The MySQL 5.7 backup script relies on
common_config.ymlandadvanced_config.yml - Whether the backup user is created automatically is controlled by
fcs_backup_script_create_backup_user - The delete scope of
unsafe_uninstall.ymlfollowsdatadir,tmpdir,binlog_dir,relaylog_dir, andredolog_dirfromadvanced_config.yml - The target instance for uninstall is determined by the currently effective
mysql_portincommon_config.yml
Additional notes:
backup_script.ymlis currently for MySQL5.7, and its retention behavior is mainly defined inside the role template rather than a public variable file.unsafe_uninstall.ymlkeeps the software base directory, Linux user, andmy.cnf, but its delete scope still followsadvanced_config.yml. With the current default layout, it removes both the instance data and log directories. It still requires manual confirmation before execution.