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 for mysqld. (optional, string, default "/var/log/mysqld.log")
  • pid β€” the pidfile to be used for mysqld. (optional, string, default "/var/run/mysql/mysqld.pid")
  • socket β€” the socket to be used for mysqld. (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 on test_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 the mysqld on startup (e.g. --skip-external-locking or --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 have SUPER, REPLICATION SLAVE, REPLICATION CLIENT, PROCESS and RELOAD privileges 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. if REQUIRE SSL for 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 the evict_outdated_slaves parameter. (optional, integer, default 3600)
  • evict_outdated_slaves β€” if set to true, any slave which is more than max_slave_lag seconds 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 be 1 if it's fine to read from the node, and 0 otherwise (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