1OCF_HEARTBEAT_MYSQL(7)        OCF resource agents       OCF_HEARTBEAT_MYSQL(7)
2
3
4

NAME

6       ocf_heartbeat_mysql - Manages a MySQL database instance
7

SYNOPSIS

9       mysql [start | stop | status | monitor | promote | demote | meta-data |
10             validate-all]
11

DESCRIPTION

13       Resource script for MySQL. May manage a standalone MySQL database, a
14       clone set with externally managed replication, or a complete
15       master/slave replication setup. Note, when master/slave replication is
16       in use, the resource must be setup to use notifications. Set
17       'notify=true' in the metadata attributes when defining a MySQL
18       master/slave instance.
19
20       While managing replication, the default behavior is to use uname -n
21       values in the change master to command. Other IPs can be specified
22       manually by adding a node attribute
23       ${INSTANCE_ATTR_NAME}_mysql_master_IP giving the IP to use for
24       replication. For example, if the mysql primitive you are using is
25       p_mysql, the attribute to set will be p_mysql_mysql_master_IP.
26

SUPPORTED PARAMETERS

28       binary
29           Location of the MySQL server binary
30
31           (optional, string, default "/usr/bin/safe_mysqld")
32
33       client_binary
34           Location of the MySQL client binary
35
36           (optional, string, default "mysql")
37
38       config
39           Configuration file
40
41           (optional, string, default "/etc/my.cnf")
42
43       datadir
44           Directory containing databases
45
46           (optional, string, default "/var/lib/mysql")
47
48       user
49           User running MySQL daemon
50
51           (optional, string, default "mysql")
52
53       group
54           Group running MySQL daemon (for logfile and directory permissions)
55
56           (optional, string, default "mysql")
57
58       log
59           The logfile to be used for mysqld.
60
61           (optional, string, default "/var/log/mysqld.log")
62
63       pid
64           The pidfile to be used for mysqld.
65
66           (optional, string, default "/var/run/mysql/mysqld.pid")
67
68       socket
69           The socket to be used for mysqld.
70
71           (optional, string, default "/var/lib/mysql/mysql.sock")
72
73       test_table
74           Table to be tested in monitor statement (in database.table
75           notation)
76
77           (optional, string, default "mysql.user")
78
79       test_user
80           MySQL test user, must have select privilege on test_table
81
82           (optional, string, default "root")
83
84       test_passwd
85           MySQL test user password
86
87           (optional, string, no default)
88
89       enable_creation
90           If the MySQL database does not exist, it will be created
91
92           (optional, boolean, default 0)
93
94       additional_parameters
95           Additional parameters which are passed to the mysqld on startup.
96           (e.g. --skip-external-locking or --skip-grant-tables)
97
98           (optional, string, no default)
99
100       replication_user
101           MySQL replication user. This user is used for starting and stopping
102           MySQL replication, for setting and resetting the master host, and
103           for setting and unsetting read-only mode. Because of that, this
104           user must have SUPER, REPLICATION SLAVE, REPLICATION CLIENT,
105           PROCESS and RELOAD privileges on all nodes within the cluster.
106           Mandatory if you define a master-slave resource.
107
108           (optional, string, default "root")
109
110       replication_passwd
111           MySQL replication password. Used for replication client and slave.
112           Mandatory if you define a master-slave resource.
113
114           (optional, string, no default)
115
116       replication_port
117           The port on which the Master MySQL instance is listening.
118
119           (optional, string, default "3306")
120
121       replication_master_ssl_ca
122           The SSL CA certificate to be used for replication over SSL.
123
124           (optional, string, no default)
125
126       replication_master_ssl_cert
127           The SSL CA certificate to be used for replication over SSL.
128
129           (optional, string, no default)
130
131       replication_master_ssl_key
132           The SSL certificate key to be used for replication over SSL.
133
134           (optional, string, no default)
135
136       max_slave_lag
137           The maximum number of seconds a replication slave is allowed to lag
138           behind its master. Do not set this to zero. What the cluster
139           manager does in case a slave exceeds this maximum lag is determined
140           by the evict_outdated_slaves parameter.
141
142           (optional, integer, default 3600)
143
144       evict_outdated_slaves
145           If set to true, any slave which is more than max_slave_lag seconds
146           behind the master has its MySQL instance shut down. If this
147           parameter is set to false in a primitive or clone resource, it is
148           simply ignored. If set to false in a master/slave resource, then
149           exceeding the maximum slave lag will merely push down the master
150           preference so the lagging slave is never promoted to the new
151           master.
152
153           (optional, boolean, default false)
154
155       reader_attribute
156           An attribute that the RA can manage to specify whether a node can
157           be read from. This node attribute will be 1 if it's fine to read
158           from the node, and 0 otherwise (for example, when a slave has
159           lagged too far behind the master).
160
161           A typical example for the use of this attribute would be to tie a
162           set of IP addresses to MySQL slaves that can be read from.
163
164           This parameter is only meaningful in master/slave set
165           configurations.
166
167           (unique, optional, string, default "readable")
168

SUPPORTED ACTIONS

170       This resource agent supports the following actions (operations):
171
172       start
173           Starts the resource. Suggested minimum timeout: 120s.
174
175       stop
176           Stops the resource. Suggested minimum timeout: 120s.
177
178       status
179           Performs a status check. Suggested minimum timeout: 60s.
180
181       monitor
182           Performs a detailed status check. Suggested minimum timeout: 30s.
183           Suggested interval: 20s.
184
185       monitor (Master role)
186           Performs a detailed status check. Suggested minimum timeout: 30s.
187           Suggested interval: 10s.
188
189       monitor (Slave role)
190           Performs a detailed status check. Suggested minimum timeout: 30s.
191           Suggested interval: 30s.
192
193       promote
194           Promotes the resource to the Master role. Suggested minimum
195           timeout: 120s.
196
197       demote
198           Demotes the resource to the Slave role. Suggested minimum timeout:
199           120s.
200
201       notify
202           Suggested minimum timeout: 90s.
203
204       validate-all
205           Performs a validation of the resource configuration. Suggested
206           minimum timeout: 5s.
207
208       meta-data
209           Retrieves resource agent metadata (internal use only). Suggested
210           minimum timeout: 5s.
211

EXAMPLE CRM SHELL

213       The following is an example configuration for a mysql resource using
214       the crm(8) shell:
215
216           primitive p_mysql ocf:heartbeat:mysql \
217             op monitor depth="0" timeout="30s" interval="20s" \
218             op monitor role="Master" depth="0" timeout="30s" interval="10s" \
219             op monitor role="Slave" depth="0" timeout="30s" interval="30s"
220
221           ms ms_mysql p_mysql \
222             meta notify="true" interleave="true"
223

EXAMPLE PCS

225       The following is an example configuration for a mysql resource using
226       pcs(8)
227
228           pcs resource create p_mysql ocf:heartbeat:mysql \
229             op monitor depth="0" timeout="30s" interval="20s" \
230             op monitor role="Master" depth="0" timeout="30s" interval="10s" \
231             op monitor role="Slave" depth="0" timeout="30s" interval="30s" --master
232

SEE ALSO

234       http://clusterlabs.org/
235

AUTHOR

237       ClusterLabs contributors (see the resource agent source for information
238       about individual authors)
239
240
241
242resource-agents UNKNOWN           03/09/2020            OCF_HEARTBEAT_MYSQL(7)
Impressum