summaryrefslogtreecommitdiff
path: root/man/mysqld_multi.1
blob: 3c5bca5a07b67464a81e595086ba31866b9cc418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
'\" t
.\"
.TH "\FBMARIADB-MULTI\FR" "1" "15 May 2020" "MariaDB 10\&.7" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.\" mysqld_multi
.\" tools: mysqld_multi
.\" scripts
.\" multi mysqld
.SH "NAME"
mysqld_multi \- manage multiple MariaDB servers
.SH "SYNOPSIS"
.HP \w'\fBmysqld_multi\ [\fR\fB\fIoptions\fR\fR\fB]\ {start|stop|report}\ [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB]\ \&.\&.\&.]\fR\ 'u
\fBmysqld_multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR
.SH "DESCRIPTION"
.PP
\fBmysqld_multi\fR
is designed to manage several
\fBmysqld\fR
processes that listen for connections on different Unix socket files and TCP/IP ports\&. It can start or stop servers, or report their current status\&.
.PP
\fBmysqld_multi\fR
searches for groups named
[mysqld\fIN\fR]
in
my\&.cnf
(or in the file named by the
\fB\-\-config\-file\fR
option)\&.
\fIN\fR
can be any positive integer\&. This number is referred to in the following discussion as the option group number, or
\fIGNR\fR\&. Group numbers distinguish option groups from one another and are used as arguments to
\fBmysqld_multi\fR
to specify which servers you want to start, stop, or obtain a status report for\&. Options listed in these groups are the same that you would use in the
[mysqld]
group used for starting
\fBmysqld\fR\&. However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&.
.PP
To invoke
\fBmysqld_multi\fR, use the following syntax:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqld_multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR
.fi
.if n \{\
.RE
.\}
.PP
start,
stop, and
report
indicate which operation to perform\&. You can perform the designated operation for a single server or multiple servers, depending on the
\fIGNR\fR
list that follows the option name\&. If there is no list,
\fBmysqld_multi\fR
performs the operation for all servers in the option file\&.
.PP
Each
\fIGNR\fR
value represents an option group number or range of group numbers\&. The value should be the number at the end of the group name in the option file\&. For example, the
\fIGNR\fR
for a group named
[mysqld17]
is
17\&. To specify a range of numbers, separate the first and last numbers by a dash\&. The
\fIGNR\fR
value
10\-13
represents groups
[mysqld10]
through
[mysqld13]\&. Multiple groups or group ranges can be specified on the command line, separated by commas\&. There must be no whitespace characters (spaces or tabs) in the
\fIGNR\fR
list; anything after a whitespace character is ignored\&.
.PP
This command starts a single server using option group
[mysqld17]:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqld_multi start 17\fR
.fi
.if n \{\
.RE
.\}
.PP
This command stops several servers, using option groups
[mysqld8]
and
[mysqld10]
through
[mysqld13]:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqld_multi stop 8,10\-13\fR
.fi
.if n \{\
.RE
.\}
.PP
For an example of how you might set up an option file, use this command:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqld_multi \-\-example\fR
.fi
.if n \{\
.RE
.\}
.PP
\fBmysqld_multi\fR
searches for option files as follows:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: no-defaults option
.\" no-defaults option: mysqld_multi
With
\fB\-\-no\-defaults\fR, no option files are read\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: defaults-file option
.\" defaults-file option: mysqld_multi
With
\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR, only the named file is read\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: defaults-extra-file option
.\" defaults-extra-file option: mysqld_multi
Otherwise, option files in the standard list of locations are read, including any file named by the
\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR
option, if one is given\&. (If the option is given multiple times, the last value is used\&.)
.RE
.PP
Option files read are searched for
[mysqld_multi]
and
[mysqld\fIN\fR]
option groups\&. The
[mysqld_multi]
group can be used for options to
\fBmysqld_multi\fR
itself\&.
[mysqld\fIN\fR]
groups can be used for options passed to specific
\fBmysqld\fR
instances\&.
.PP
The
[mysqld]
or
[mysqld_safe]
groups can be used for common options read by all instances of
\fBmysqld\fR
or
\fBmysqld_safe\fR\&. You can specify a
\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
option to use a different configuration file for that instance, in which case the
[mysqld]
or
[mysqld_safe]
groups from that file will be used for that instance\&.
.PP
\fBmysqld_multi\fR
supports the following options\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: help option
.\" help option: mysqld_multi
\fB\-\-help\fR
.sp
Display a help message and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: example option
.\" example option: mysqld_multi
\fB\-\-example\fR
.sp
Display a sample option file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: log option
.\" log option: mysqld_multi
\fB\-\-log=\fR\fB\fIfile_name\fR\fR
.sp
Specify the name of the log file\&. If the file exists, log output is appended to it\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: mysqladmin option
.\" mysqladmin option: mysqld_multi
\fB\-\-mysqladmin=\fR\fB\fIprog_name\fR\fR
.sp
The
\fBmysqladmin\fR
binary to be used to stop servers\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: mysqld option
.\" mysqld option: mysqld_multi
\fB\-\-mysqld=\fR\fB\fIprog_name\fR\fR
.sp
The
\fBmysqld\fR
binary to be used\&. Note that you can specify
\fBmysqld_safe\fR
as the value for this option also\&. If you use
\fBmysqld_safe\fR
to start the server, you can include the
mysqld
or
ledir
options in the corresponding
[mysqld\fIN\fR]
option group\&. These options indicate the name of the server that
\fBmysqld_safe\fR
should start and the path name of the directory where the server is located\&. (See the descriptions for these options in
\fBmysqld_safe\fR(1)\&.) Example:
.sp
.if n \{\
.RS 4
.\}
.nf
[mysqld38]
mysqld = mysqld\-debug
ledir  = /opt/local/mysql/libexec
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: no-log option
.\" no-log option: mysqld_multi
\fB\-\-no\-log\fR
.sp
Print log information to
stdout
rather than to the log file\&. By default, output goes to the log file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: password option
.\" password option: mysqld_multi
\fB\-\-password=\fR\fB\fIpassword\fR\fR
.sp
The password of the MariaDB account to use when invoking
\fBmysqladmin\fR\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: silent option
.\" silent option: mysqld_multi
\fB\-\-silent\fR
.sp
Silent mode; disable warnings\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: tcp-ip option
.\" tcp-ip option: mysqld_multi
\fB\-\-tcp\-ip\fR
.sp
Connect to the MariaDB server(s) via the TCP/IP port instead of the UNIX socket\&. This affects stopping 
and reporting. If a socket file is missing, the server may still be running, but can be accessed only 
via the TCP/IP port\&. By default connecting is done via the UNIX socket\&. This option affects
stop and report operations\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: user option
.\" user option: mysqld_multi
\fB\-\-user=\fR\fB\fIuser_name\fR\fR
.sp
The user name of the MariaDB account to use when invoking
\fBmysqladmin\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: verbose option
.\" verbose option: mysqld_multi
\fB\-\-verbose\fR
.sp
Be more verbose\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: version option
.\" version option: mysqld_multi
\fB\-\-version\fR
.sp
Display version information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_multi: wsrep-new-cluster option
.\" wsrep-new-cluster option: mysqld_multi
\fB\-\-wsrep\-new\-cluster\fR
.sp
Bootstrap a cluster\&.
.RE
.PP
Some notes about
\fBmysqld_multi\fR:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBMost important\fR: Before using
\fBmysqld_multi\fR
be sure that you understand the meanings of the options that are passed to the
\fBmysqld\fR
servers and
\fIwhy\fR
you would want to have separate
\fBmysqld\fR
processes\&. Beware of the dangers of using multiple
\fBmysqld\fR
servers with the same data directory\&. Use separate data directories, unless you
\fIknow\fR
what you are doing\&. Starting multiple servers with the same data directory does
\fInot\fR
give you extra performance in a threaded system\&.
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBImportant\fR: Make sure that the data directory for each server is fully accessible to the Unix account that the specific
\fBmysqld\fR
process is started as\&.
\fIDo not\fR
use the Unix
\fIroot\fR
account for this, unless you
\fIknow\fR
what you are doing\&.
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Make sure that the MariaDB account used for stopping the
\fBmysqld\fR
servers (with the
\fBmysqladmin\fR
program) has the same user name and password for each server\&. Also, make sure that the account has the
SHUTDOWN
privilege\&. If the servers that you want to manage have different user names or passwords for the administrative accounts, you might want to create an account on each server that has the same user name and password\&. For example, you might set up a common
multi_admin
account by executing the following commands for each server:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysql \-u root \-S /tmp/mysql\&.sock \-p\fR
Enter password:
mysql> \fBGRANT SHUTDOWN ON *\&.*\fR
    \-> \fBTO \'multi_admin\'@\'localhost\' IDENTIFIED BY \'multipass\';\fR
.fi
.if n \{\
.RE
.\}
.sp
Change the connection parameters appropriately when connecting to each one\&. Note that the host name part of the account name must allow you to connect as
multi_admin
from the host where you want to run
\fBmysqld_multi\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The Unix socket file and the TCP/IP port number must be different for every
\fBmysqld\fR\&. (Alternatively, if the host has multiple network addresses, you can use
\fB\-\-bind\-address\fR
to cause different servers to listen to different interfaces\&.)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The
\fB\-\-pid\-file\fR
option is very important if you are using
\fBmysqld_safe\fR
to start
\fBmysqld\fR
(for example,
\fB\-\-mysqld=mysqld_safe\fR) Every
\fBmysqld\fR
should have its own process ID file\&. The advantage of using
\fBmysqld_safe\fR
instead of
\fBmysqld\fR
is that
\fBmysqld_safe\fR
monitors its
\fBmysqld\fR
process and restarts it if the process terminates due to a signal sent using
kill \-9
or for other reasons, such as a segmentation fault\&. Please note that the
\fBmysqld_safe\fR
script might require that you start it from a certain place\&. This means that you might have to change location to a certain directory before running
\fBmysqld_multi\fR\&. If you have problems starting, please see the
\fBmysqld_safe\fR
script\&. Check especially the lines:
.sp
.if n \{\
.RS 4
.\}
.nf
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
MY_PWD=`pwd`
# Check if we are starting this relative (for the binary release)
if test \-d $MY_PWD/data/mysql \-a \e
   \-f \&./share/mysql/english/errmsg\&.sys \-a \e
   \-x \&./bin/mysqld
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
.fi
.if n \{\
.RE
.\}
.sp
The test performed by these lines should be successful, or you might encounter problems\&. See
\fBmysqld_safe\fR(1)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
You might want to use the
\fB\-\-user\fR
option for
\fBmysqld\fR, but to do this you need to run the
\fBmysqld_multi\fR
script as the Unix
root
user\&. Having the option in the option file doesn\'t matter; you just get a warning if you are not the superuser and the
\fBmysqld\fR
processes are started under your own Unix account\&.
.RE
.PP
The following example shows how you might set up an option file for use with
\fBmysqld_multi\fR\&. The order in which the
\fBmysqld\fR
programs are started or stopped depends on the order in which they appear in the option file\&. Group numbers need not form an unbroken sequence\&. The first and fifth
[mysqld\fIN\fR]
groups were intentionally omitted from the example to illustrate that you can have
\(lqgaps\(rq
in the option file\&. This gives you more flexibility\&.
.sp
.if n \{\
.RS 4
.\}
.nf
# This file should probably be in your home dir (~/\&.my\&.cnf)
# or /etc/my\&.cnf
# Version 2\&.1 by Jani Tolonen
[mysqld_multi]
mysqld     = /usr/local/bin/mysqld_safe
mysqladmin = /usr/local/bin/mysqladmin
user       = multi_admin
password   = multipass
[mysqld2]
socket     = /tmp/mysql\&.sock2
port       = 3307
pid\-file   = /usr/local/mysql/var2/hostname\&.pid2
datadir    = /usr/local/mysql/var2
language   = /usr/local/share/mysql/english
user       = john
[mysqld3]
socket     = /tmp/mysql\&.sock3
port       = 3308
pid\-file   = /usr/local/mysql/var3/hostname\&.pid3
datadir    = /usr/local/mysql/var3
language   = /usr/local/share/mysql/swedish
user       = monty
[mysqld4]
socket     = /tmp/mysql\&.sock4
port       = 3309
pid\-file   = /usr/local/mysql/var4/hostname\&.pid4
datadir    = /usr/local/mysql/var4
language   = /usr/local/share/mysql/estonia
user       = tonu
[mysqld6]
socket     = /tmp/mysql\&.sock6
port       = 3311
pid\-file   = /usr/local/mysql/var6/hostname\&.pid6
datadir    = /usr/local/mysql/var6
language   = /usr/local/share/mysql/japanese
user       = jani
.fi
.if n \{\
.RE
.\}
.PP
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
.SH AUTHOR
MariaDB Foundation (http://www.mariadb.org/).