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