1MYSQLD_MULTI(1) MariaDB Database System MYSQLD_MULTI(1)
2
3
4
6 mysqld_multi - manage multiple MariaDB servers
7
9 mysqld_multi [options] {start|stop|report} [GNR[,GNR] ...]
10
12 mysqld_multi is designed to manage several mysqld processes that listen
13 for connections on different Unix socket files and TCP/IP ports. It can
14 start or stop servers, or report their current status.
15
16 mysqld_multi searches for groups named [mysqldN] in my.cnf (or in the
17 file named by the --config-file option). N can be any positive
18 integer. This number is referred to in the following discussion as the
19 option group number, or GNR. Group numbers distinguish option groups
20 from one another and are used as arguments to mysqld_multi to specify
21 which servers you want to start, stop, or obtain a status report for.
22 Options listed in these groups are the same that you would use in the
23 [mysqld] group used for starting mysqld. However, when using multiple
24 servers, it is necessary that each one use its own value for options
25 such as the Unix socket file and TCP/IP port number.
26
27 To invoke mysqld_multi, use the following syntax:
28
29 shell> mysqld_multi [options] {start|stop|report} [GNR[,GNR] ...]
30
31 start, stop, and report indicate which operation to perform. You can
32 perform the designated operation for a single server or multiple
33 servers, depending on the GNR list that follows the option name. If
34 there is no list, mysqld_multi performs the operation for all servers
35 in the option file.
36
37 Each GNR value represents an option group number or range of group
38 numbers. The value should be the number at the end of the group name in
39 the option file. For example, the GNR for a group named [mysqld17] is
40 17. To specify a range of numbers, separate the first and last numbers
41 by a dash. The GNR value 10-13 represents groups [mysqld10] through
42 [mysqld13]. Multiple groups or group ranges can be specified on the
43 command line, separated by commas. There must be no whitespace
44 characters (spaces or tabs) in the GNR list; anything after a
45 whitespace character is ignored.
46
47 This command starts a single server using option group [mysqld17]:
48
49 shell> mysqld_multi start 17
50
51 This command stops several servers, using option groups [mysqld8] and
52 [mysqld10] through [mysqld13]:
53
54 shell> mysqld_multi stop 8,10-13
55
56 For an example of how you might set up an option file, use this
57 command:
58
59 shell> mysqld_multi --example
60
61 mysqld_multi searches for option files as follows:
62
63 • With --no-defaults, no option files are read.
64
65 • With --defaults-file=file_name, only the named file is read.
66
67 • Otherwise, option files in the standard list of locations are read,
68 including any file named by the --defaults-extra-file=file_name
69 option, if one is given. (If the option is given multiple times,
70 the last value is used.)
71
72 Option files read are searched for [mysqld_multi] and [mysqldN] option
73 groups. The [mysqld_multi] group can be used for options to
74 mysqld_multi itself. [mysqldN] groups can be used for options passed
75 to specific mysqld instances.
76
77 The [mysqld] or [mysqld_safe] groups can be used for common options
78 read by all instances of mysqld or mysqld_safe. You can specify a
79 --defaults-file=file_name option to use a different configuration file
80 for that instance, in which case the [mysqld] or [mysqld_safe] groups
81 from that file will be used for that instance.
82
83 mysqld_multi supports the following options.
84
85 • --help
86
87 Display a help message and exit.
88
89 • --example
90
91 Display a sample option file.
92
93 • --log=file_name
94
95 Specify the name of the log file. If the file exists, log output is
96 appended to it.
97
98 • --mysqladmin=prog_name
99
100 The mysqladmin binary to be used to stop servers.
101
102 • --mysqld=prog_name
103
104 The mysqld binary to be used. Note that you can specify mysqld_safe
105 as the value for this option also. If you use mysqld_safe to start
106 the server, you can include the mysqld or ledir options in the
107 corresponding [mysqldN] option group. These options indicate the
108 name of the server that mysqld_safe should start and the path name
109 of the directory where the server is located. (See the descriptions
110 for these options in mysqld_safe(1).) Example:
111
112 [mysqld38]
113 mysqld = mysqld-debug
114 ledir = /opt/local/mysql/libexec
115
116 • --no-log
117
118 Print log information to stdout rather than to the log file. By
119 default, output goes to the log file.
120
121 • --password=password
122
123 The password of the MariaDB account to use when invoking
124 mysqladmin. Note that the password value is not optional for this
125 option, unlike for other MariaDB programs.
126
127 • --silent
128
129 Silent mode; disable warnings.
130
131 • --tcp-ip
132
133 Connect to the MariaDB server(s) via the TCP/IP port instead of the
134 UNIX socket. This affects stopping and reporting. If a socket file
135 is missing, the server may still be running, but can be accessed
136 only via the TCP/IP port. By default connecting is done via the
137 UNIX socket. This option affects stop and report operations.
138
139 • --user=user_name
140
141 The user name of the MariaDB account to use when invoking
142 mysqladmin.
143
144 • --verbose
145
146 Be more verbose.
147
148 • --version
149
150 Display version information and exit.
151
152 • --wsrep-new-cluster
153
154 Bootstrap a cluster.
155
156 Some notes about mysqld_multi:
157
158 • Most important: Before using mysqld_multi be sure that you
159 understand the meanings of the options that are passed to the
160 mysqld servers and why you would want to have separate mysqld
161 processes. Beware of the dangers of using multiple mysqld servers
162 with the same data directory. Use separate data directories, unless
163 you know what you are doing. Starting multiple servers with the
164 same data directory does not give you extra performance in a
165 threaded system.
166
167 • Important: Make sure that the data directory for each server is
168 fully accessible to the Unix account that the specific mysqld
169 process is started as. Do not use the Unix root account for this,
170 unless you know what you are doing.
171
172 • Make sure that the MariaDB account used for stopping the mysqld
173 servers (with the mysqladmin program) has the same user name and
174 password for each server. Also, make sure that the account has the
175 SHUTDOWN privilege. If the servers that you want to manage have
176 different user names or passwords for the administrative accounts,
177 you might want to create an account on each server that has the
178 same user name and password. For example, you might set up a common
179 multi_admin account by executing the following commands for each
180 server:
181
182 shell> mysql -u root -S /tmp/mysql.sock -p
183 Enter password:
184 mysql> GRANT SHUTDOWN ON *.*
185 -> TO ´multi_admin´@´localhost´ IDENTIFIED BY ´multipass´;
186
187 Change the connection parameters appropriately when connecting to
188 each one. Note that the host name part of the account name must
189 allow you to connect as multi_admin from the host where you want to
190 run mysqld_multi.
191
192 • The Unix socket file and the TCP/IP port number must be different
193 for every mysqld. (Alternatively, if the host has multiple network
194 addresses, you can use --bind-address to cause different servers to
195 listen to different interfaces.)
196
197 • The --pid-file option is very important if you are using
198 mysqld_safe to start mysqld (for example, --mysqld=mysqld_safe)
199 Every mysqld should have its own process ID file. The advantage of
200 using mysqld_safe instead of mysqld is that mysqld_safe monitors
201 its mysqld process and restarts it if the process terminates due to
202 a signal sent using kill -9 or for other reasons, such as a
203 segmentation fault. Please note that the mysqld_safe script might
204 require that you start it from a certain place. This means that you
205 might have to change location to a certain directory before running
206 mysqld_multi. If you have problems starting, please see the
207 mysqld_safe script. Check especially the lines:
208
209 ----------------------------------------------------------------
210 MY_PWD=`pwd`
211 # Check if we are starting this relative (for the binary release)
212 if test -d $MY_PWD/data/mysql -a \
213 -f ./share/mysql/english/errmsg.sys -a \
214 -x ./bin/mysqld
215 ----------------------------------------------------------------
216
217 The test performed by these lines should be successful, or you
218 might encounter problems. See mysqld_safe(1).
219
220 • You might want to use the --user option for mysqld, but to do this
221 you need to run the mysqld_multi script as the Unix root user.
222 Having the option in the option file doesn´t matter; you just get a
223 warning if you are not the superuser and the mysqld processes are
224 started under your own Unix account.
225
226 The following example shows how you might set up an option file for use
227 with mysqld_multi. The order in which the mysqld programs are started
228 or stopped depends on the order in which they appear in the option
229 file. Group numbers need not form an unbroken sequence. The first and
230 fifth [mysqldN] groups were intentionally omitted from the example to
231 illustrate that you can have “gaps” in the option file. This gives you
232 more flexibility.
233
234 # This file should probably be in your home dir (~/.my.cnf)
235 # or /etc/my.cnf
236 # Version 2.1 by Jani Tolonen
237 [mysqld_multi]
238 mysqld = /usr/local/bin/mysqld_safe
239 mysqladmin = /usr/local/bin/mysqladmin
240 user = multi_admin
241 password = multipass
242 [mysqld2]
243 socket = /tmp/mysql.sock2
244 port = 3307
245 pid-file = /usr/local/mysql/var2/hostname.pid2
246 datadir = /usr/local/mysql/var2
247 language = /usr/local/share/mysql/english
248 user = john
249 [mysqld3]
250 socket = /tmp/mysql.sock3
251 port = 3308
252 pid-file = /usr/local/mysql/var3/hostname.pid3
253 datadir = /usr/local/mysql/var3
254 language = /usr/local/share/mysql/swedish
255 user = monty
256 [mysqld4]
257 socket = /tmp/mysql.sock4
258 port = 3309
259 pid-file = /usr/local/mysql/var4/hostname.pid4
260 datadir = /usr/local/mysql/var4
261 language = /usr/local/share/mysql/estonia
262 user = tonu
263 [mysqld6]
264 socket = /tmp/mysql.sock6
265 port = 3311
266 pid-file = /usr/local/mysql/var6/hostname.pid6
267 datadir = /usr/local/mysql/var6
268 language = /usr/local/share/mysql/japanese
269 user = jani
270
272 Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
273 2010-2019 MariaDB Foundation
274
275 This documentation is free software; you can redistribute it and/or
276 modify it only under the terms of the GNU General Public License as
277 published by the Free Software Foundation; version 2 of the License.
278
279 This documentation is distributed in the hope that it will be useful,
280 but WITHOUT ANY WARRANTY; without even the implied warranty of
281 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
282 General Public License for more details.
283
284 You should have received a copy of the GNU General Public License along
285 with the program; if not, write to the Free Software Foundation, Inc.,
286 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see
287 http://www.gnu.org/licenses/.
288
289
291 For more information, please refer to the MariaDB Knowledge Base,
292 available online at https://mariadb.com/kb/
293
295 MariaDB Foundation (http://www.mariadb.org/).
296
297
298
299MariaDB 10.5 27 June 2019 MYSQLD_MULTI(1)