OCF_HEARTBEAT_MYSQL(7)
πΈ NAME πΈ
okay so bestie, welcome to OCF_HEARTBEAT_MYSQL(7) β the manual page for ocf_heartbeat_mysql, and it literally manages a MySQL database instance. It's giving resource-agent main character energy, no cap. π
β¨ SYNOPSIS β¨
Run it like this, bestie:
mysql [start | stop | status | monitor | promote | demote | meta-data |
validate-all]
π DESCRIPTION π
This is the resource script for MySQL. It may manage a standalone MySQL database, a clone set with externally managed replication, or a complete master/slave replication setup. Heads up: when master/slave replication is in use, the resource must be set up to use notifications. Set notify=true in the metadata attributes when defining a MySQL master/slave instance.
While managing replication, the default behavior is to use uname -n values in the change master to command. Other IPs can be specified manually by adding a node attribute ${INSTANCE_ATTR_NAME}_mysql_master_IP giving the IP to use for replication. For example, if the mysql primitive you are using is p_mysql, the attribute to set will be p_mysql_mysql_master_IP.
π SUPPORTED PARAMETERS π
binaryβ location of the MySQL server binary.(optional, string, default "/usr/bin/safe_mysqld")client_binaryβ location of the MySQL client binary.(optional, string, default "mysql")configβ configuration file.(optional, string, default "/etc/my.cnf")datadirβ directory containing databases.(optional, string, default "/var/lib/mysql")userβ user running the MySQL daemon.(optional, string, default "mysql")groupβ group running the MySQL daemon (for logfile and directory permissions).(optional, string, default "mysql")logβ the logfile to be used formysqld.(optional, string, default "/var/log/mysqld.log")pidβ the pidfile to be used formysqld.(optional, string, default "/var/run/mysql/mysqld.pid")socketβ the socket to be used formysqld.(optional, string, default "/var/lib/mysql/mysql.sock")test_tableβ table to be tested in the monitor statement (in database.table notation).(optional, string, default "mysql.user")test_userβ MySQL test user; must have select privilege ontest_table.(optional, string, default "root")test_passwdβ MySQL test user password.(optional, string, no default)enable_creationβ if the MySQL database does not exist, it will be created.(optional, boolean, default 0)additional_parametersβ additional parameters which are passed to themysqldon startup (e.g.--skip-external-lockingor--skip-grant-tables).(optional, string, no default)replication_userβ MySQL replication user. This user is used for starting and stopping MySQL replication, for setting and resetting the master host, and for setting and unsetting read-only mode. Because of that, this user must haveSUPER,REPLICATION SLAVE,REPLICATION CLIENT,PROCESSandRELOADprivileges on all nodes within the cluster. Mandatory if you define a master-slave resource.(optional, string, default "root")replication_passwdβ MySQL replication password. Used for replication client and slave. Mandatory if you define a master-slave resource.(optional, string, no default)replication_portβ the port on which the Master MySQL instance is listening.(optional, string, default "3306")replication_require_sslβ enables SSL connection to the local MySQL service for the replication user. i.e. ifREQUIRE SSLfor the replication user in MySQL set, this should be set to"true".(optional, string, default "false")replication_master_ssl_caβ the SSL CA certificate to be used for replication over SSL.(optional, string, no default)replication_master_ssl_certβ the SSL CA certificate to be used for replication over SSL.(optional, string, no default)replication_master_ssl_keyβ the SSL certificate key to be used for replication over SSL.(optional, string, no default)max_slave_lagβ the maximum number of seconds a replication slave is allowed to lag behind its master. Do not set this to zero. What the cluster manager does in case a slave exceeds this maximum lag is determined by theevict_outdated_slavesparameter.(optional, integer, default 3600)evict_outdated_slavesβ if set to true, any slave which is more thanmax_slave_lagseconds behind the master has its MySQL instance shut down. If this parameter is set to false in a primitive or clone resource, it is simply ignored. If set to false in a master/slave resource, then exceeding the maximum slave lag will merely push down the master preference so the lagging slave is never promoted to the new master.(optional, boolean, default false)reader_attributeβ an attribute that the RA can manage to specify whether a node can be read from. This node attribute will be1if it's fine to read from the node, and0otherwise (for example, when a slave has lagged too far behind the master). A typical example for the use of this attribute would be to tie a set of IP addresses to MySQL slaves that can be read from. This parameter is only meaningful in master/slave set configurations.(unique, optional, string, default "readable")
π₯ SUPPORTED ACTIONS π₯
This resource agent supports the following actions (operations), bestie:
startβ starts the resource. Suggested minimum timeout:120s.stopβ stops the resource. Suggested minimum timeout:120s.statusβ performs a status check. Suggested minimum timeout:60s.monitorβ performs a detailed status check. Suggested minimum timeout:30s. Suggested interval:20s.monitor (Promoted role)β performs a detailed status check. Suggested minimum timeout:30s. Suggested interval:10s.promoteβ promotes the resource to the Master role. Suggested minimum timeout:120s.demoteβ demotes the resource to the Slave role. Suggested minimum timeout:120s.notifyβ suggested minimum timeout:90s.validate-allβ performs a validation of the resource configuration. Suggested minimum timeout:5s.meta-dataβ retrieves resource agent metadata (internal use only). Suggested minimum timeout:5s.
π¦ EXAMPLE CRM SHELL π¦
Here's an example configuration for a mysql resource using the crm(8) shell:
primitive p_mysql ocf:heartbeat:mysql \
op monitor depth="0" timeout="30s" interval="20s" \
op monitor role="Promoted" depth="0" timeout="30s" interval="10s"
ms ms_mysql p_mysql \
meta notify="true" interleave="true"
π EXAMPLE PCS π
And here's the example for a mysql resource using pcs(8):
pcs resource create p_mysql ocf:heartbeat:mysql \
op monitor OCF_CHECK_LEVEL="0" timeout="30s" interval="20s" \
op monitor role="Promoted" OCF_CHECK_LEVEL="0" timeout="30s" interval="10s" promotable
β SEE ALSO β
π AUTHOR π
ClusterLabs contributors β see the resource agent source for information about individual authors.
β¨ that's the whole page, bestie β it comes from resource-agents version UNKNOWN, dated 10/01/2026. Go be the main character of your cluster. π
π¦ where this page comes from
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms