'\" t .\" Title: ocf_heartbeat_mysql .\" Author: ClusterLabs contributors (see the resource agent source for information about individual authors) .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 12/17/2020 .\" Manual: OCF resource agents .\" Source: resource-agents UNKNOWN .\" Language: English .\" .TH "OCF_HEARTBEAT_MYSQL" "7" "12/17/2020" "resource-agents UNKNOWN" "OCF resource agents" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" ocf_heartbeat_mysql \- Manages a MySQL database instance .SH "SYNOPSIS" .HP \w'\fBmysql\fR\ 'u \fBmysql\fR [start | stop | status | monitor | promote | demote | meta\-data | validate\-all] .SH "DESCRIPTION" .PP Resource script for MySQL\&. May manage a standalone MySQL database, a clone set with externally managed replication, or a complete master/slave replication setup\&. Note, when master/slave replication is in use, the resource must be setup to use notifications\&. Set \*(Aqnotify=true\*(Aq in the metadata attributes when defining a MySQL master/slave instance\&. .PP 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\&. .SH "SUPPORTED PARAMETERS" .PP \fBbinary\fR .RS 4 Location of the MySQL server binary .sp (optional, string, default "/usr/bin/mysqld_safe") .RE .PP \fBclient_binary\fR .RS 4 Location of the MySQL client binary .sp (optional, string, default "mysql") .RE .PP \fBconfig\fR .RS 4 Configuration file .sp (optional, string, default "/etc/mysql/my\&.cnf") .RE .PP \fBdatadir\fR .RS 4 Directory containing databases .sp (optional, string, default "/var/lib/mysql") .RE .PP \fBuser\fR .RS 4 User running MySQL daemon .sp (optional, string, default "mysql") .RE .PP \fBgroup\fR .RS 4 Group running MySQL daemon (for logfile and directory permissions) .sp (optional, string, default "mysql") .RE .PP \fBlog\fR .RS 4 The logfile to be used for mysqld\&. .sp (optional, string, default "/var/log/mysql/error\&.log") .RE .PP \fBpid\fR .RS 4 The pidfile to be used for mysqld\&. .sp (optional, string, default "/var/run/mysqld/mysqld\&.pid") .RE .PP \fBsocket\fR .RS 4 The socket to be used for mysqld\&. .sp (optional, string, default "/var/run/mysqld/mysqld\&.sock") .RE .PP \fBtest_table\fR .RS 4 Table to be tested in monitor statement (in database\&.table notation) .sp (optional, string, default "mysql\&.user") .RE .PP \fBtest_user\fR .RS 4 MySQL test user, must have select privilege on test_table .sp (optional, string, default "root") .RE .PP \fBtest_passwd\fR .RS 4 MySQL test user password .sp (optional, string, no default) .RE .PP \fBenable_creation\fR .RS 4 If the MySQL database does not exist, it will be created .sp (optional, boolean, default 0) .RE .PP \fBadditional_parameters\fR .RS 4 Additional parameters which are passed to the mysqld on startup\&. (e\&.g\&. \-\-skip\-external\-locking or \-\-skip\-grant\-tables) .sp (optional, string, no default) .RE .PP \fBreplication_user\fR .RS 4 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\&. .sp (optional, string, default "root") .RE .PP \fBreplication_passwd\fR .RS 4 MySQL replication password\&. Used for replication client and slave\&. Mandatory if you define a master\-slave resource\&. .sp (optional, string, no default) .RE .PP \fBreplication_port\fR .RS 4 The port on which the Master MySQL instance is listening\&. .sp (optional, string, default "3306") .RE .PP \fBreplication_master_ssl_ca\fR .RS 4 The SSL CA certificate to be used for replication over SSL\&. .sp (optional, string, no default) .RE .PP \fBreplication_master_ssl_cert\fR .RS 4 The SSL CA certificate to be used for replication over SSL\&. .sp (optional, string, no default) .RE .PP \fBreplication_master_ssl_key\fR .RS 4 The SSL certificate key to be used for replication over SSL\&. .sp (optional, string, no default) .RE .PP \fBmax_slave_lag\fR .RS 4 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\&. .sp (optional, integer, default 3600) .RE .PP \fBevict_outdated_slaves\fR .RS 4 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\&. .sp (optional, boolean, default false) .RE .PP \fBreader_attribute\fR .RS 4 An attribute that the RA can manage to specify whether a node can be read from\&. This node attribute will be 1 if it\*(Aqs fine to read from the node, and 0 otherwise (for example, when a slave has lagged too far behind the master)\&. .sp 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\&. .sp This parameter is only meaningful in master/slave set configurations\&. .sp (unique, optional, string, default "readable") .RE .SH "SUPPORTED ACTIONS" .PP This resource agent supports the following actions (operations): .PP \fBstart\fR .RS 4 Starts the resource\&. Suggested minimum timeout: 120s\&. .RE .PP \fBstop\fR .RS 4 Stops the resource\&. Suggested minimum timeout: 120s\&. .RE .PP \fBstatus\fR .RS 4 Performs a status check\&. Suggested minimum timeout: 60s\&. .RE .PP \fBmonitor\fR .RS 4 Performs a detailed status check\&. Suggested minimum timeout: 30s\&. Suggested interval: 20s\&. .RE .PP \fBmonitor (Master role)\fR .RS 4 Performs a detailed status check\&. Suggested minimum timeout: 30s\&. Suggested interval: 10s\&. .RE .PP \fBmonitor (Slave role)\fR .RS 4 Performs a detailed status check\&. Suggested minimum timeout: 30s\&. Suggested interval: 30s\&. .RE .PP \fBpromote\fR .RS 4 Promotes the resource to the Master role\&. Suggested minimum timeout: 120s\&. .RE .PP \fBdemote\fR .RS 4 Demotes the resource to the Slave role\&. Suggested minimum timeout: 120s\&. .RE .PP \fBnotify\fR .RS 4 Suggested minimum timeout: 90s\&. .RE .PP \fBvalidate\-all\fR .RS 4 Performs a validation of the resource configuration\&. Suggested minimum timeout: 5s\&. .RE .PP \fBmeta\-data\fR .RS 4 Retrieves resource agent metadata (internal use only)\&. Suggested minimum timeout: 5s\&. .RE .SH "EXAMPLE CRM SHELL" .PP The following is an example configuration for a mysql resource using the \fBcrm\fR(8) shell: .sp .if n \{\ .RS 4 .\} .nf primitive p_mysql ocf:heartbeat:mysql \e op monitor depth="0" timeout="30s" interval="20s" \e op monitor role="Master" depth="0" timeout="30s" interval="10s" \e op monitor role="Slave" depth="0" timeout="30s" interval="30s" .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf ms ms_mysql p_mysql \e meta notify="true" interleave="true" .fi .if n \{\ .RE .\} .SH "EXAMPLE PCS" .PP The following is an example configuration for a mysql resource using \fBpcs\fR(8) .sp .if n \{\ .RS 4 .\} .nf pcs resource create p_mysql ocf:heartbeat:mysql \e op monitor OCF_CHECK_LEVEL="0" timeout="30s" interval="20s" \e op monitor role="Master" OCF_CHECK_LEVEL="0" timeout="30s" interval="10s" \e op monitor role="Slave" OCF_CHECK_LEVEL="0" timeout="30s" interval="30s" promotable .fi .if n \{\ .RE .\} .SH "SEE ALSO" .PP \m[blue]\fB\%http://clusterlabs.org/\fR\m[] .SH "AUTHOR" .PP \fBClusterLabs contributors (see the resource agent source for information about individual authors)\fR