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       max_slave_lag
122           The maximum number of seconds a replication slave is allowed to lag
123           behind its master. Do not set this to zero. What the cluster
124           manager does in case a slave exceeds this maximum lag is determined
125           by the evict_outdated_slaves parameter.
126
127           (optional, integer, default 3600)
128
129       evict_outdated_slaves
130           If set to true, any slave which is more than max_slave_lag seconds
131           behind the master has its MySQL instance shut down. If this
132           parameter is set to false in a primitive or clone resource, it is
133           simply ignored. If set to false in a master/slave resource, then
134           exceeding the maximum slave lag will merely push down the master
135           preference so the lagging slave is never promoted to the new
136           master.
137
138           (optional, boolean, default false)
139
140       reader_attribute
141           An attribute that the RA can manage to specify whether a node can
142           be read from. This node attribute will be 1 if it's fine to read
143           from the node, and 0 otherwise (for example, when a slave has
144           lagged too far behind the master).
145
146           A typical example for the use of this attribute would be to tie a
147           set of IP addresses to MySQL slaves that can be read from.
148
149           This parameter is only meaningful in master/slave set
150           configurations.
151
152           (unique, optional, string, default "readable")
153

SUPPORTED ACTIONS

155       This resource agent supports the following actions (operations):
156
157       start
158           Starts the resource. Suggested minimum timeout: 120s.
159
160       stop
161           Stops the resource. Suggested minimum timeout: 120s.
162
163       status
164           Performs a status check. Suggested minimum timeout: 60s.
165
166       monitor
167           Performs a detailed status check. Suggested minimum timeout: 30s.
168           Suggested interval: 20s.
169
170       monitor (Master role)
171           Performs a detailed status check. Suggested minimum timeout: 30s.
172           Suggested interval: 10s.
173
174       monitor (Slave role)
175           Performs a detailed status check. Suggested minimum timeout: 30s.
176           Suggested interval: 30s.
177
178       promote
179           Promotes the resource to the Master role. Suggested minimum
180           timeout: 120s.
181
182       demote
183           Demotes the resource to the Slave role. Suggested minimum timeout:
184           120s.
185
186       notify
187           Suggested minimum timeout: 90s.
188
189       validate-all
190           Performs a validation of the resource configuration. Suggested
191           minimum timeout: 5s.
192
193       meta-data
194           Retrieves resource agent metadata (internal use only). Suggested
195           minimum timeout: 5s.
196

EXAMPLE CRM SHELL

198       The following is an example configuration for a mysql resource using
199       the crm(8) shell:
200
201           primitive p_mysql ocf:heartbeat:mysql \
202             op monitor depth="0" timeout="30s" interval="20s" \
203             op monitor role="Master" depth="0" timeout="30s" interval="10s" \
204             op monitor role="Slave" depth="0" timeout="30s" interval="30s"
205
206           ms ms_mysql p_mysql \
207             meta notify="true" interleave="true"
208

EXAMPLE PCS

210       The following is an example configuration for a mysql resource using
211       pcs(8)
212
213           pcs resource create p_mysql ocf:heartbeat:mysql \
214             op monitor depth="0" timeout="30s" interval="20s" \
215             op monitor role="Master" depth="0" timeout="30s" interval="10s" \
216             op monitor role="Slave" depth="0" timeout="30s" interval="30s" --master
217

SEE ALSO

219       http://clusterlabs.org/
220

AUTHOR

222       ClusterLabs contributors (see the resource agent source for information
223       about individual authors)
224
225
226
227resource-agents UNKNOWN           03/15/2019            OCF_HEARTBEAT_MYSQL(7)
Impressum