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

VariableDefault valueFunction
mysql_version9.7.0MySQL version. Current public capabilities mainly target 5.7, 8.0, 8.4, and 9.7
mysql_port3306Instance port and the baseline for several derived paths and service names
server_specsautoServer sizing. You can keep auto-detection or set a fixed value such as 4c8g
db_typemysqlDatabase type. Supports mysql, percona, and greatsql
mysql_packages_dir../downloads/Directory for MySQL installation packages
mysql_user / mysql_groupmysql / mysqlLinux runtime user and group for MySQL
mysql_data_dir_base/database/{{ db_type }}Base directory for MySQL data, logs, and configuration
mysql_service_namemysql{{ mysql_port }}systemd service name, derived from the MySQL port by default
mysql_admin_user / mysql_admin_passwordadmin / Dbbot_admin@8888Administrative account and password
mysql_rple_user / mysql_rple_passwordrepl / Dbbot_repl@8888Replication account and password
mysql_backup_user / mysql_backup_passwordbackup / Dbbot_backup@8888Backup account and password
mysql_monitor_user / mysql_monitor_passwordmonitor / Dbbot_monitor@8888Monitoring account used by mysqld_exporter
mysql_cluster_admin_user / mysql_cluster_admin_passwordclusteradmin / Dbbot_clusteradmin@8888mysqlshell management account for InnoDB Cluster
mysql_router_user / mysql_router_passwordmysqlrouter / Dbbot_mysqlrouter@8888Account used by MySQL Router to read metadata
mysql_character_set_serverutf8mb4Server character set
mysql_transaction_isolationREAD-COMMITTEDDefault transaction isolation level
mysql_default_time_zone+8:00Default MySQL time zone
mysql_max_connections1000Maximum number of connections
mysql_binlog_formatrowBinlog format. This is especially important for MGR and InnoDB Cluster
fcs_auto_download_packagestrueWhether the control node automatically downloads MySQL, Shell, Router, and Exporter packages
fcs_allow_custom_mysql_packagefalseWhether to temporarily allow a MySQL Server package name that is not in the support matrix
fcs_allow_dbbot_default_passwdfalseWhether execution is allowed to continue with dbbot public default passwords
fcs_create_mysql_fast_logintrueWhether to create shortcuts such as db3306 for the mysql user
fcs_backup_script_create_backup_usertrueWhether the backup playbook creates the backup account automatically
fcs_role_mysqld_exporter_create_monitor_usertrueWhether mysqld_exporter installation creates the monitor account automatically
fcs_mysql_use_jemallocfalseWhether to explicitly enable jemalloc preload
fcs_mysql_allow_bundled_jemalloc_fallbackfalseWhether dbbot is allowed to fall back to the bundled legacy RPM when the OS repo has no jemalloc
fcs_use_greatsql_hatrueWhether GreatSQL HA related capabilities are enabled
fcs_run_post_deploy_checkstrueWhether 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>@9999 convention. By default, fcs_allow_dbbot_default_passwd: false, so playbooks block those defaults in pre_tasks.
  • The current default for fcs_mysql_use_jemalloc is false, 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 set fcs_mysql_allow_bundled_jemalloc_fallback: true.
  • mysql_binlog_format is configurable in the common file, but mgr.yml still requires row.
  • fcs_run_post_deploy_checks is enabled by default. To temporarily skip post-deploy acceptance checks, pass -e fcs_run_post_deploy_checks=false explicitly.
  • 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, and unsafe_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_seconds only when you need to temporarily relax that acceptance threshold.
  • MySQL server package metadata is resolved from dbbotctl support after the target OS is detected. Use dbbotctl support packages to inspect the package name, download URL, and checksum for a version/OS pair.
  • MySQL 9.7.x is not supported on the CentOS/RHEL 7 family; use MySQL 8.4.x on those systems.

2. Directory and package variables

File: playbooks/advanced_config.yml

VariableDefault valueFunction
mycnf_dir{{ mysql_data_dir_base }}/{{ mysql_port }}/etcDirectory that stores my.cnf
datadir{{ mysql_data_dir_base }}/{{ mysql_port }}/dataData directory
tmpdir{{ mysql_data_dir_base }}/{{ mysql_port }}/tmpTemporary directory
binlog_dir / relaylog_dir{{ mysql_data_dir_base }}/{{ mysql_port }}/logDirectories for binlog and relay log files
redolog_dir{{ datadir }}Redo log directory, which defaults back to datadir
socket / mysqlx_socketDerived from datadirMySQL and MySQL X socket paths
mysql_packageResolved from dbbotctl supportFinal MySQL / Percona / GreatSQL server package file name expected by the playbook
mysql_package_download_urlResolved from dbbotctl supportDownload URL used when fcs_auto_download_packages: true
mysql_package_checksum_type / mysql_package_checksumResolved from dbbotctl supportChecksum 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_checksumnone / -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 under mysql_packages_dir.
  • To temporarily test a MySQL Server package that is not in the support matrix, explicitly set fcs_allow_custom_mysql_package: true and set mysql_custom_package in advanced_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.yml also depends on these directory variables. With the current default layout, it removes both the instance data and log directories, but keeps the instance my.cnf.

3. Primary-replica, legacy MHA, and MHA-Go variables

Files:

  • playbooks/vars/var_master_slave.yml
  • playbooks/vars/var_mha.yml
  • playbooks/vars/var_mha_go.yml
VariableDefault valueFunction
master_ip192.0.2.131Primary server IP
slave_ips['192.0.2.132', '192.0.2.133']Replica IP list
sub_nets192.0.2.%Trusted subnet, domain, or IP range for MySQL
manager_ipLegacy MHA: 192.0.2.133; MHA-Go: {{ master_ip }}Node used by the manager
net_work_interfaceens33NIC used to bind the MHA VIP
vip192.0.2.130MHA VIP
vip_netmask32MHA VIP netmask
mha_go_semi_sync_policydisabledMHA-Go semi-sync check policy
mha_go_writer_endpoint_enabledfalseWhether MHA-Go enables VIP writer endpoint switching

Notes:

  • master_ip and slave_ips must match the hosts in the inventory.
  • Legacy Perl MHA still expects manager_ip on a replica node and not equal to master_ip.
  • MHA-Go allows manager_ip to be either master_ip or a member of slave_ips; its current default is master_ip.
  • The actual variable name is slave_ips, not replica_ips.
  • The default net_work_interface value is only an example interface name. Before enabling legacy MHA VIP or the MHA-Go VIP writer endpoint, confirm the real interface with ip route or ip addr. Sample environments using the dbbot 192.168.161.* test inventory usually use enp1s0, but the real interface depends on the active test profile.

4. MGR variables

File: playbooks/vars/var_mgr.yml

VariableDefault valueFunction
mysql_binlog_formatrowOverrides the common setting so MGR uses row
mysql_mgr_portAuto-calculated, for example 33061 when mysql_port=3306Group Replication communication port
mysql_mgr_hosts['192.0.2.131', '192.0.2.132', '192.0.2.133']List of MGR members
sub_nets192.0.2.%Trusted source range
greatsql_vip192.0.2.134VIP for GreatSQL HA scenarios
greatsql_net_work_interfaceens33NIC used by the GreatSQL HA VIP
greatsql_netmask255.255.255.255Netmask used by GreatSQL HA
greatsql_group_replication_arbitratorfalseWhether to enable an arbitrator node
greatsql_group_replication_arbitrator_hosts['192.0.2.133']Arbitrator node list

Notes:

  • greatsql_* variables only apply when db_type: greatsql.
  • Override greatsql_net_work_interface with the real interface name. Sample environments using the dbbot 192.168.161.* test inventory usually use enp1s0, but the real interface depends on the active test profile.
  • mgr.yml deploys single-primary mode by default.

5. InnoDB Cluster and Router variables

Files:

  • playbooks/vars/var_innodb_cluster.yml
  • playbooks/vars/var_innodb_cluster_router.yml

InnoDB Cluster variables:

VariableDefault valueFunction
innodb_cluster_namemyCluster{{ mysql_port }}Cluster name
innodb_cluster_primary192.0.2.131Initial primary node
innodb_cluster_members['192.0.2.131', '192.0.2.132', '192.0.2.133']Cluster member list
mysql_mgr_portAuto-calculated, for example 33061 when mysql_port=3306InnoDB 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_passwordclusteradmin / Dbbot_clusteradmin@8888mysqlshell management account

Router variables:

VariableDefault valueFunction
router_enable_hafalseWhether Router HA is enabled with keepalived
router_bootstrap_server192.0.2.131Cluster node used for Router bootstrap
router_linux_glibc_tagautoRouter package glibc tag; can be explicitly set to glibc2.17 or glibc2.28
router_vip192.0.2.150Router HA VIP
router_net_work_interfaceens33NIC used by the VIP
router_ha_nodesTwo-node exampleRouter HA nodes, roles, and priorities
router_vip_netmask32Router VIP netmask
router_portsrw/ro/http... dictionaryRouter ports, enable flags, and health-check participation
max_total_connections1000Global Router connection limit
router_rest_api_bind_address127.0.0.1REST API bind address
router_rest_api_auth_modefileREST API authentication mode
router_rest_api_file_user / router_rest_api_file_passwordrouter_api_user / Dbbot_router_api_user@8888File-based REST API credentials

Notes:

  • router_ha_nodes only matters when router_enable_ha: true.
  • Override router_net_work_interface with the real interface name on the Router nodes. Sample environments using the dbbot 192.168.161.* test inventory usually use enp1s0, but the real interface depends on the active test profile.
  • With router_linux_glibc_tag: auto, Router 9.7.x uses glibc2.28 and Router 8.4.x uses glibc2.17; set the glibc tag explicitly when you need a fixed package name.
  • By default, router_ports.http.port is 8443, and mysqlrouter_exporter reads Router metrics from this REST API endpoint.

6. Exporter variables

Files:

  • playbooks/vars/var_node_exporter_install.yml
  • playbooks/vars/var_mysqld_exporter_install.yml
  • playbooks/vars/var_router_exporter_install.yml
VariableDefault valueFunction
node_exporter_installtrueWhether to install node_exporter
node_exporter_port9100Listening port for node_exporter
node_exporter_install_typedbbotInstallation mode: dbbot, pmm, or package
node_exporter_packagenode_exporter-1.10.2.linux-amd64.tar.gzOfficial package name used in package mode
mysqld_exporter_installtrueWhether to install mysqld_exporter
mysqld_exporter_topologyautoTopology type: auto, ms, or mgr
mysqld_exporter_portautoExporter port. Can be auto-calculated or explicitly set
mysqld_exporter_port_auto_base9104Start of the auto-generated exporter port range
mysqld_exporter_port_auto_mysql_base3306MySQL baseline port used in the auto port calculation
mysqld_exporter_install_typedbbotInstallation mode: dbbot, pmm, or package
mysqld_exporter_packagemysqld_exporter-0.18.0.linux-amd64.tar.gzOfficial package name used in package mode
mysqlrouter_exporter_installtrueWhether to install mysqlrouter_exporter
mysqlrouter_exporter_install_typedbbotInstallation mode: dbbot or package
mysqlrouter_exporter_version0.0.1Default standalone project version
mysqlrouter_exporter_packagemysqlrouter_exporter_0.0.1_linux_amd64.tar.gzRelease archive name used in package mode
mysqlrouter_exporter_urlhttps://github.com/fanderchan/mysqlrouter_exporter/releases/download/v0.0.1/mysqlrouter_exporter_0.0.1_linux_amd64.tar.gzRelease archive URL used in package mode
mysqlrouter_exporter_port9165Listening port for mysqlrouter_exporter
mysqlrouter_exporter_api_base_urlhttps://127.0.0.1:8443/api/20190715Router REST API endpoint
mysqlrouter_exporter_api_user / mysqlrouter_exporter_api_passwordrouter_api_user / Dbbot_router_api_user@8888Router API credentials
mysqlrouter_exporter_insecure_skip_verifytrueWhether to skip HTTPS certificate verification

Auto port rule:

  • When mysqld_exporter_port: auto, the port is calculated as 9104 + mysql_port - 3306.
  • When mysqld_exporter_topology: auto, dbbot checks performance_schema.replication_group_members; if members exist it resolves to mgr, otherwise it resolves to ms.
  • mysqlrouter_exporter depends 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: dbbot uses the bundled binary from the dbbot release package, while package downloads the standalone project’s release archive from mysqlrouter_exporter_url.

6.1 Dependency quick reference

Router chain:

  • innodb_cluster.yml
  • innodb_cluster_router.yml
  • router_exporter_install.yml
  • dbbotctl exporter register -t router
  • router_unsafe_uninstall.yml when Router cleanup is required

MHA chain:

  • mha.yml
  • mha_unsafe_uninstall.yml when legacy MHA and the MySQL instance must be cleaned up together
  • mha_go.yml
  • mha_go_unsafe_uninstall.yml when MHA-Go and the MySQL instance must be cleaned up together

MySQL exporter chain:

  • single_node.yml / master_slave.yml / mgr.yml
  • node_exporter_install.yml
  • mysqld_exporter_install.yml
  • dbbotctl exporter register -t node
  • dbbotctl exporter register -t mysql

7. MySQL 8.4 clone backup variables

File: playbooks/vars/var_backup_script_8.4.yml

VariableDefault valueFunction
backup_topologyautoTopology detection mode. Supports auto, ms, mgr, mic, and single
backup_scopeprimary_onlyBackup target scope. Supports primary_only, replica_one, replica_all, all, and selected
backup_preferred_host""Required when backup_scope=selected
backup_base_dir/backupBase backup directory
backup_script_dir{{ mysql_data_dir_base }}/scriptsDirectory that stores backup scripts
backup_script_path{{ backup_script_dir }}/backup_clone{{ mysql_port }}.shClone backup script path
backup_schedule_script_path{{ backup_script_dir }}/backup_schedule{{ mysql_port }}.shScheduler script path
backup_purge_script_path{{ backup_script_dir }}/backup_purge{{ mysql_port }}.shPurge script path
backup_config_path{{ backup_script_dir }}/backup_clone{{ mysql_port }}.confBackup configuration file path
backup_keep_full2Number of full snapshots to retain
backup_keep_binlog_days7Number of days to retain binlogs
backup_cron0 2 * * *Cron expression used by the scheduled backup

Notes:

  • When backup_scope=selected, backup_preferred_host must be set explicitly.
  • backup_cron is validated as a five-field cron expression in pre_tasks.

8. MySQL 8.4 PITR restore variables

File: playbooks/vars/var_restore_pitr_8.4.yml

VariableDefault valueFunction
restore_modenew_instanceRestore mode: new_instance or existing_instance
backup_snapshot_id""Backup snapshot identifier. Required
backup_source_mysql_port3306Source MySQL port used by the backup
restore_target_mysql_port3388Target MySQL port for the restored instance
backup_root_dir/backupBase backup directory on the restore host
backup_dir{{ backup_root_dir }}/mysql{{ backup_source_mysql_port }}/{{ backup_snapshot_id }}Resolved backup directory
enable_pitrtrueWhether 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_inclusivefalseWhether the target GTID itself is included
restore_mysql_host / restore_mysql_user / restore_mysql_password127.0.0.1 / {{ mysql_admin_user }} / {{ mysql_admin_127_password }}Connection settings used when replaying binlogs
restore_allow_nonempty_datadirfalseWhether restore is allowed when the target datadir already contains data
restore_mysql_start_timeout300Timeout 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:

  1. When enable_pitr: true, set exactly one of pitr_target_time or pitr_target_gtid.
  2. restore_pitr_8.4.yml only supports db_type: mysql and mysql_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.yml and advanced_config.yml
  • Whether the backup user is created automatically is controlled by fcs_backup_script_create_backup_user
  • The delete scope of unsafe_uninstall.yml follows datadir, tmpdir, binlog_dir, relaylog_dir, and redolog_dir from advanced_config.yml
  • The target instance for uninstall is determined by the currently effective mysql_port in common_config.yml

Additional notes:

  • backup_script.yml is currently for MySQL 5.7, and its retention behavior is mainly defined inside the role template rather than a public variable file.
  • unsafe_uninstall.yml keeps the software base directory, Linux user, and my.cnf, but its delete scope still follows advanced_config.yml. With the current default layout, it removes both the instance data and log directories. It still requires manual confirmation before execution.
  1. MySQL Primary-Replica Deployment Quick Start
  2. MySQL Custom Directory Layout
  3. MySQL 8.4 Backup and Restore
  4. MySQL InnoDB Cluster Deployment Guide
  5. MySQL MHA Deployment Guide