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_require_ssl
122           Enables SSL connection to local MySQL service for replication user.
123           i.e. if REQUIRE SSL for replication user in MySQL set, this should
124           be set to "true".
125
126           (optional, string, default "false")
127
128       replication_master_ssl_ca
129           The SSL CA certificate to be used for replication over SSL.
130
131           (optional, string, no default)
132
133       replication_master_ssl_cert
134           The SSL CA certificate to be used for replication over SSL.
135
136           (optional, string, no default)
137
138       replication_master_ssl_key
139           The SSL certificate key to be used for replication over SSL.
140
141           (optional, string, no default)
142
143       max_slave_lag
144           The maximum number of seconds a replication slave is allowed to lag
145           behind its master. Do not set this to zero. What the cluster
146           manager does in case a slave exceeds this maximum lag is determined
147           by the evict_outdated_slaves parameter.
148
149           (optional, integer, default 3600)
150
151       evict_outdated_slaves
152           If set to true, any slave which is more than max_slave_lag seconds
153           behind the master has its MySQL instance shut down. If this
154           parameter is set to false in a primitive or clone resource, it is
155           simply ignored. If set to false in a master/slave resource, then
156           exceeding the maximum slave lag will merely push down the master
157           preference so the lagging slave is never promoted to the new
158           master.
159
160           (optional, boolean, default false)
161
162       reader_attribute
163           An attribute that the RA can manage to specify whether a node can
164           be read from. This node attribute will be 1 if it's fine to read
165           from the node, and 0 otherwise (for example, when a slave has
166           lagged too far behind the master).
167
168           A typical example for the use of this attribute would be to tie a
169           set of IP addresses to MySQL slaves that can be read from.
170
171           This parameter is only meaningful in master/slave set
172           configurations.
173
174           (unique, optional, string, default "readable")
175

SUPPORTED ACTIONS

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

EXAMPLE CRM SHELL

220       The following is an example configuration for a mysql resource using
221       the crm(8) shell:
222
223           primitive p_mysql ocf:heartbeat:mysql \
224             op monitor depth="0" timeout="30s" interval="20s" \
225             op monitor role="Master" depth="0" timeout="30s" interval="10s" \
226             op monitor role="Slave" depth="0" timeout="30s" interval="30s"
227
228           ms ms_mysql p_mysql \
229             meta notify="true" interleave="true"
230

EXAMPLE PCS

232       The following is an example configuration for a mysql resource using
233       pcs(8)
234
235           pcs resource create p_mysql ocf:heartbeat:mysql \
236             op monitor OCF_CHECK_LEVEL="0" timeout="30s" interval="20s" \
237             op monitor role="Master" OCF_CHECK_LEVEL="0" timeout="30s" interval="10s" \
238             op monitor role="Slave" OCF_CHECK_LEVEL="0" timeout="30s" interval="30s" promotable
239

SEE ALSO

241       http://clusterlabs.org/
242

AUTHOR

244       ClusterLabs contributors (see the resource agent source for information
245       about individual authors)
246
247
248
249resource-agents UNKNOWN           11/03/2021            OCF_HEARTBEAT_MYSQL(7)
Impressum