1OCF_HEARTBEAT_MYSQL(7) OCF resource agents OCF_HEARTBEAT_MYSQL(7)
2
3
4
6 ocf_heartbeat_mysql - Manages a MySQL database instance
7
9 mysql [start | stop | status | monitor | promote | demote | meta-data |
10 validate-all]
11
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.
16
17 While managing replication, the default behavior is to use uname -n
18 values in the change master to command. Other IPs can be specified
19 manually by adding a node attribute
20 ${INSTANCE_ATTR_NAME}_mysql_master_IP giving the IP to use for
21 replication. For example, if the mysql primitive you are using is
22 p_mysql, the attribute to set will be p_mysql_mysql_master_IP.
23
25 binary
26 Location of the MySQL server binary
27
28 (optional, string, default "/usr/bin/safe_mysqld")
29
30 client_binary
31 Location of the MySQL client binary
32
33 (optional, string, default "mysql")
34
35 config
36 Configuration file
37
38 (optional, string, default "/etc/my.cnf")
39
40 datadir
41 Directory containing databases
42
43 (optional, string, default "/var/lib/mysql")
44
45 user
46 User running MySQL daemon
47
48 (optional, string, default "mysql")
49
50 group
51 Group running MySQL daemon (for logfile and directory permissions)
52
53 (optional, string, default "mysql")
54
55 log
56 The logfile to be used for mysqld.
57
58 (optional, string, default "/var/log/mysqld.log")
59
60 pid
61 The pidfile to be used for mysqld.
62
63 (optional, string, default "/var/run/mysql/mysqld.pid")
64
65 socket
66 The socket to be used for mysqld.
67
68 (optional, string, default "/var/lib/mysql/mysql.sock")
69
70 test_table
71 Table to be tested in monitor statement (in database.table
72 notation)
73
74 (optional, string, default "mysql.user")
75
76 test_user
77 MySQL test user, must have select privilege on test_table
78
79 (optional, string, default "root")
80
81 test_passwd
82 MySQL test user password
83
84 (optional, string, no default)
85
86 enable_creation
87 If the MySQL database does not exist, it will be created
88
89 (optional, boolean, default 0)
90
91 additional_parameters
92 Additional parameters which are passed to the mysqld on startup.
93 (e.g. --skip-external-locking or --skip-grant-tables)
94
95 (optional, string, no default)
96
97 replication_user
98 MySQL replication user. This user is used for starting and stopping
99 MySQL replication, for setting and resetting the master host, and
100 for setting and unsetting read-only mode. Because of that, this
101 user must have SUPER, REPLICATION SLAVE, REPLICATION CLIENT,
102 PROCESS and RELOAD privileges on all nodes within the cluster.
103 Mandatory if you define a master-slave resource.
104
105 (optional, string, no default)
106
107 replication_passwd
108 MySQL replication password. Used for replication client and slave.
109 Mandatory if you define a master-slave resource.
110
111 (optional, string, no default)
112
113 replication_port
114 The port on which the Master MySQL instance is listening.
115
116 (optional, string, default "3306")
117
118 max_slave_lag
119 The maximum number of seconds a replication slave is allowed to lag
120 behind its master. Do not set this to zero. What the cluster
121 manager does in case a slave exceeds this maximum lag is determined
122 by the evict_outdated_slaves parameter.
123
124 (optional, integer, default 3600)
125
126 evict_outdated_slaves
127 If set to true, any slave which is more than max_slave_lag seconds
128 behind the master has its MySQL instance shut down. If this
129 parameter is set to false in a primitive or clone resource, it is
130 simply ignored. If set to false in a master/slave resource, then
131 exceeding the maximum slave lag will merely push down the master
132 preference so the lagging slave is never promoted to the new
133 master.
134
135 (optional, boolean, default false)
136
137 reader_attribute
138 An attribute that the RA can manage to specify whether a node can
139 be read from. This node attribute will be 1 if it´s fine to read
140 from the node, and 0 otherwise (for example, when a slave has
141 lagged too far behind the master).
142
143 A typical example for the use of this attribute would be to tie a
144 set of IP addresses to MySQL slaves that can be read from.
145
146 This parameter is only meaningful in master/slave set
147 configurations.
148
149 (unique, optional, string, default "readable")
150
152 This resource agent supports the following actions (operations):
153
154 start
155 Starts the resource. Suggested minimum timeout: 120.
156
157 stop
158 Stops the resource. Suggested minimum timeout: 120.
159
160 status
161 Performs a status check. Suggested minimum timeout: 60.
162
163 monitor
164 Performs a detailed status check. Suggested minimum timeout: 30.
165 Suggested interval: 20.
166
167 monitor (Master role)
168 Performs a detailed status check. Suggested minimum timeout: 30.
169 Suggested interval: 10.
170
171 monitor (Slave role)
172 Performs a detailed status check. Suggested minimum timeout: 30.
173 Suggested interval: 30.
174
175 promote
176 Promotes the resource to the Master role. Suggested minimum
177 timeout: 120.
178
179 demote
180 Demotes the resource to the Slave role. Suggested minimum timeout:
181 120.
182
183 notify
184 Suggested minimum timeout: 90.
185
186 validate-all
187 Performs a validation of the resource configuration. Suggested
188 minimum timeout: 5.
189
190 meta-data
191 Retrieves resource agent metadata (internal use only). Suggested
192 minimum timeout: 5.
193
195 The following is an example configuration for a mysql resource using
196 the crm(8) shell:
197
198 primitive p_mysql ocf:heartbeat:mysql \
199 op monitor depth="0" timeout="30" interval="20" \
200 op monitor role="Master" depth="0" timeout="30" interval="10" \
201 op monitor role="Slave" depth="0" timeout="30" interval="30"
202
203 ms ms_mysql p_mysql \
204 meta notify="true" interleave="true"
205
207 http://www.linux-ha.org/wiki/mysql_(resource_agent)
208
210 Linux-HA contributors (see the resource agent source for information
211 about individual authors)
212
213
214
215resource-agents 3.9.2 03/24/2017 OCF_HEARTBEAT_MYSQL(7)