File: mysqlmanager.8

package info (click to toggle)
mysql-dfsg-5.0 5.0.32-7etch12
  • links: PTS
  • area: main
  • in suites: etch
  • size: 89,332 kB
  • ctags: 94,781
  • sloc: cpp: 436,297; ansic: 409,141; sh: 40,574; tcl: 30,484; perl: 27,872; yacc: 8,236; makefile: 5,532; java: 4,610; xml: 3,914; pascal: 3,462; sql: 2,673; awk: 1,338; asm: 1,061; sed: 772
file content (810 lines) | stat: -rw-r--r-- 31,167 bytes parent folder | download | duplicates (2)
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
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
.\"     Title: \fBmysqlmanager\fR
.\"    Author: 
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
.\"      Date: 12/20/2006
.\"    Manual: MySQL Database System
.\"    Source: MySQL 5.0
.\"
.TH "\fBMYSQLMANAGER\fR" "8" "12/20/2006" "MySQL 5.0" "MySQL Database System"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
mysqlmanager \- the MySQL Instance Manager
.SH "SYNOPSIS"
.HP 23
\fBmysqlmanager [\fR\fB\fIoptions\fR\fR\fB]\fR
.SH "DESCRIPTION"
.PP
\fBmysqlmanager\fR
is the MySQL Instance Manager (IM). This program monitors and manages MySQL Database Server instances. MySQL Instance Manager is available for Unix\-like operating systems, and also on Windows as of MySQL 5.0.13. It runs as a daemon that listens on a TCP/IP port. On Unix, it also listens on a Unix socket file.
.PP
MySQL Instance Manager is included in MySQL distributions from version 5.0.3, and can be used in place of the
mysqld_safe
script to start and stop one or more instances of MySQL Server. Because Instance Manager can manage multiple server instances, it can also be used in place of the
\fBmysqld_multi\fR
script. Instance Manager offers these capabilities:
.TP 3n
\(bu
Instance Manager can start and stop instances, and report on the status of instances.
.TP 3n
\(bu
Server instances can be treated as guarded or unguarded:
.RS 3n
.TP 3n
\(bu
When Instance Manager starts, it starts each guarded instance. If the instance crashes, Instance Manager detects this and restarts it. When Instance Manager stops, it stops the instance.
.TP 3n
\(bu
A nonguarded instance is not started when Instance Manager starts or monitored by it. If the instance crashes after being started, Instance Manager does not restart it. When Instance Manager exits, it does not stop the instance if it is running.
.RE
.IP "" 3n
Instances are guarded by default. An instance can be designated as nonguarded by including the
\fBnonguarded\fR
option in the configuration file.
.TP 3n
\(bu
Instance Manager provides an interactive interface for configuring instances, so that the need to edit the configuration file manually is reduced or eliminated.
.TP 3n
\(bu
Instance Manager provides remote instance management. That is, it runs on the host where you want to control MySQL Server instances, but you can connect to it from a remote host to perform instance\-management operations.
.sp
.RE
.PP
The following sections describe MySQL Instance Manager operation in more detail.
.SH "MYSQL INSTANCE MANAGER COMMAND OPTIONS"
.PP
The MySQL Instance Manager supports a number of command options. For a brief listing, invoke
\fBmysqlmanager\fR
with the
\fB\-\-help\fR
option. Options may be given on the command line or in the Instance Manager configuration file. On Windows, the standard configuration file is
\fImy.ini\fR
in the directory where Instance Manager is installed. On Unix, the standard file is
\fI/etc/my.cnf\fR. To specify a different configuration file, start Instance Manager with the
\fB\-\-defaults\-file\fR
option.
.PP
\fBmysqlmanager\fR
supports the following options:
.TP 3n
\(bu
\fB\-\-help\fR,
\fB\-?\fR
.sp
Display a help message and exit.
.TP 3n
\(bu
\fB\-\-angel\-pid\-file=\fR\fB\fIfile_name\fR\fR
.sp
The file in which the angel process records its process ID when
\fBmysqlmanager\fR
runs in daemon mode (that is, when the
\fB\-\-run\-as\-service\fR
option is given). The default filename is
\fImysqlmanager.angel.pid\fR.
.sp
If the
\fB\-\-angel\-pid\-file\fR
option is not given, the default angel PID file has the same name as the PID file except that any PID file extension is replaced with an extension of
\fI.angel.pid\fR. (For example,
\fImysqlmanager.pid\fR
becomes
\fImysqlmanager.angel.pid\fR.)
.sp
This option was added in MySQL 5.0.23.
.TP 3n
\(bu
\fB\-\-bind\-address=\fR\fB\fIIP\fR\fR
.sp
The IP address to bind to.
.TP 3n
\(bu
\fB\-\-default\-mysqld\-path=\fR\fB\fIpath\fR\fR
.sp
The pathname of the MySQL Server binary. This pathname is used for all server instance sections in the configuration file for which no
\fBmysqld\-path\fR
option is present. The default value of this option is the compiled\-in pathname, which depends on how the MySQL distribution was configured. Example:
\fB\-\-default\-mysqld\-path=/usr/sbin/mysqld\fR
.TP 3n
\(bu
\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
.sp
Read Instance Manager and MySQL Server settings from the given file. All configuration changes made by the Instance Manager will be written to this file. This must be the first option on the command line if it is used, and the file must exist.
.sp
If this option is not given, Instance Manager uses its standard configuration file. On Windows, the standard file is
\fImy.ini\fR
in the directory where Instance Manager is installed. On Unix, the standard file is
\fI/etc/my.cnf\fR.
.TP 3n
\(bu
\fB\-\-install\fR
.sp
On Windows, install Instance Manager as a Windows service. The service name is
MySQL Manager. This option was added in MySQL 5.0.11.
.TP 3n
\(bu
\fB\-\-log=\fR\fB\fIfile_name\fR\fR
.sp
The path to the Instance Manager log file. This option has no effect unless the
\fB\-\-run\-as\-service\fR
option is also given. If the filename specified for the option is a relative name, the log file is created under the directory from which Instance Manager is started. To ensure that the file is created in a specific directory, specify it as a full pathname.
.sp
If
\fB\-\-run\-as\-service\fR
is given without
\fB\-\-log\fR, the log file is
\fImysqlmanager.log\fR
in the data directory.
.sp
If
\fB\-\-run\-as\-service\fR
is not given, log messages go to the standard output. To capture log output, you can redirect Instance Manager output to a file:
.sp
.RS 3n
.nf
mysqlmanager > im.log
.fi
.RE
.TP 3n
\(bu
\fB\-\-monitoring\-interval=\fR\fB\fIseconds\fR\fR
.sp
The interval in seconds for monitoring server instances. The default value is 20 seconds. Instance Manager tries to connect to each monitored (guarded) instance using the non\-existing
MySQL_Instance_Manager
user account to check whether it is alive/not hanging. If the result of the connection attempt indicates that the instance is unavailable, Instance Manager performs several attempts to restart the instance.
.sp
Normally, the
MySQL_Instance_Manager
account does not exist, so the connection attempts by Instance Manager cause the monitored instance to produce messages in its general query log similar to the following:
.sp
.RS 3n
.nf
Access denied for user 'MySQL_Instance_M'@'localhost' (using password: YES)
.fi
.RE
.sp
.sp
The
nonguarded
option in the appropriate server instance section disables monitoring for a particular instance. If the instance dies after being started, Instance Manager will not restart it. Instance Manager tries to connect to a nonguarded instance only when you request the instance's status (for example, with the
SHOW INSTANCES
status.
.sp
See
the section called \(lqMYSQL SERVER INSTANCE STATUS MONITORING\(rq, for more information.
.TP 3n
\(bu
\fB\-\-passwd\fR,
\fB\-P\fR
.sp
Prepare an entry for the password file, print it to the standard output, and exit. You can redirect the output from Instance Manager to a file to save the entry in the file.
.TP 3n
\(bu
\fB\-\-password\-file=\fR\fB\fIfile_name\fR\fR
.sp
The name of the file where the Instance Manager looks for users and passwords. On Windows, the default is
\fImysqlmanager.passwd\fR
in the directory where Instance Manager is installed. On Unix, the default file is
\fI/etc/mysqlmanager.passwd\fR.
.TP 3n
\(bu
\fB\-\-pid\-file=\fR\fB\fIfile_name\fR\fR
.sp
The process ID file to use. On Windows, the default file is
\fImysqlmanager.pid\fR
in the directory where Instance Manager is installed. On Unix, the default is
\fImysqlmanager.pid\fR
in the data directory.
.TP 3n
\(bu
\fB\-\-port=\fR\fB\fIport_num\fR\fR
.sp
The port number to use when listening for TCP/IP connections from clients. The default port number (assigned by IANA) is 2273.
.TP 3n
\(bu
\fB\-\-print\-defaults\fR
.sp
Print the current defaults and exit. This must be the first option on the command line if it is used.
.TP 3n
\(bu
\fB\-\-remove\fR
.sp
On Windows, removes Instance Manager as a Windows service. This assumes that Instance Manager has been run with
\fB\-\-install\fR
previously. This option was added in MySQL 5.0.11.
.TP 3n
\(bu
\fB\-\-run\-as\-service\fR
.sp
On Unix, daemonize and start an angel process. The angel process monitors Instance Manager and restarts it if it crashes. (The angel process itself is simple and unlikely to crash.)
.TP 3n
\(bu
\fB\-\-socket=\fR\fB\fIpath\fR\fR
.sp
On Unix, the socket file to use for incoming connections. The default file is named
\fI/tmp/mysqlmanager.sock\fR. This option has no meaning on Windows.
.TP 3n
\(bu
\fB\-\-standalone\fR
.sp
This option is used on Windows to run Instance Manager in standalone mode. You should specify it when you start Instance Manager from the command line. This option was added in MySQL 5.0.13.
.TP 3n
\(bu
\fB\-\-user=\fR\fB\fIuser_name\fR\fR
.sp
On Unix, the username of the system account to use for starting and running
\fBmysqlmanager\fR. This option generates a warning and has no effect unless you start
\fBmysqlmanager\fR
as
root
(so that it can change its effective user ID), or as the named user. It is recommended that you configure
\fBmysqlmanager\fR
to run using the same account used to run the
\fBmysqld\fR
server. (\(lqUser\(rq
in this context refers to a system login account, not a MySQL user listed in the grant tables.)
.TP 3n
\(bu
\fB\-\-version\fR,
\fB\-V\fR
.sp
Display version information and exit.
.TP 3n
\(bu
\fB\-\-wait\-timeout=\fR\fB\fIN\fR\fR
.sp
The number of seconds to wait for activity on an incoming connection before closing it. The default is 28800 seconds (8 hours).
.sp
This option was added in MySQL 5.0.19. Before that, the timeout is 30 seconds and cannot be changed.
.SH "MYSQL INSTANCE MANAGER CONFIGURATION FILES"
.PP
Instance Manager uses its standard configuration file unless it is started with a
\fB\-\-defaults\-file\fR
option that specifies a different file. On Windows, the standard file is
\fImy.ini\fR
in the directory where Instance Manager is installed. On Unix, the standard file is
\fI/etc/my.cnf\fR. (Prior to MySQL 5.0.10, the MySQL Instance Manager read the same configuration files as the MySQL Server, including
\fI/etc/my.cnf\fR,
\fI~/.my.cnf\fR, and so forth.)
.PP
Instance Manager reads options for itself from the
[manager]
section of the configuration file, and options for server instances from
[mysqld]
or
[mysqld\fIN\fR]
sections. The
[manager]
section contains any of the options listed in
the section called \(lqMYSQL INSTANCE MANAGER COMMAND OPTIONS\(rq, except for those specified as having to be given as the first option on the command line. Here is a sample
[manager]
section:
.sp
.RS 3n
.nf
# MySQL Instance Manager options section
[manager]
default\-mysqld\-path = /usr/local/mysql/libexec/mysqld
socket=/tmp/manager.sock
pid\-file=/tmp/manager.pid
password\-file = /home/cps/.mysqlmanager.passwd
monitoring\-interval = 2
port = 1999
bind\-address = 192.168.1.5
.fi
.RE
.PP
Each
[mysqld]
or
[mysqld\fIN\fR]
instance section specifies options given by Instance Manager to a server instance at startup. These are mainly common MySQL Server options (see
the section called \(lqCOMMAND OPTIONS\(rq). In addition, a
[mysqld\fIN\fR]
section can contain the options in the following list, which are specific to Instance Manager. These options are interpreted by Instance Manager itself; it does not pass them to the server when it attempts to start that server.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
\fBWarning\fR
.PP
The Instance Manager\-specific options must not be used in a
[mysqld]
section. If a server is started without using Instance Manager, it will not recognize these options and will fail to start properly.
.TP 3n
\(bu
mysqld\-path = \fIpath\fR
.sp
The pathname of the
\fBmysqld\fR
server binary to use for the server instance.
.TP 3n
\(bu
nonguarded
.sp
This option disables Instance Manager monitoring functionality for the server instance. By default, an instance is guarded: At Instance Manager start time, it starts the instance. It also monitors the instance status and attempts to restart it if it fails. At Instance Manager exit time, it stops the instance. None of these things happen for nonguarded instances.
.TP 3n
\(bu
shutdown\-delay = \fIseconds\fR
.sp
The number of seconds Instance Manager should wait for the server instance to shut down. The default value is 35 seconds. After the delay expires, Instance Manager assumes that the instance is hanging and attempts to terminate it. If you use
InnoDB
with large tables, you should increase this value.
.sp
.RE
.PP
Here are some sample instance sections:
.sp
.RS 3n
.nf
[mysqld1]
mysqld\-path=/usr/local/mysql/libexec/mysqld
socket=/tmp/mysql.sock
port=3307
server_id=1
skip\-stack\-trace
core\-file
skip\-bdb
log\-bin
log\-error
log=mylog
log\-slow\-queries
[mysqld2]
nonguarded
port=3308
server_id=2
mysqld\-path= /home/cps/mysql/trees/mysql\-5.0/sql/mysqld
socket     = /tmp/mysql.sock5
pid\-file   = /tmp/hostname.pid5
datadir= /home/cps/mysql_data/data_dir1
language=/home/cps/mysql/trees/mysql\-5.0/sql/share/english
log\-bin
log=/tmp/fordel.log
.fi
.RE
.SH "STARTING THE MYSQL SERVER WITH MYSQL INSTANCE MANAGER"
.PP
This section discusses how Instance Manager starts server instances when it starts. However, before you start Instance Manager, you should set up a password file for it. Otherwise, you will not be able to connect to Instance Manager to control it after it starts. For details about creating Instance Manager accounts, see
the section called \(lqINSTANCE MANAGER USER AND PASSWORD MANAGEMENT\(rq.
.PP
On Unix, the
\fBmysqld\fR
MySQL database server normally is started with the
\fBmysql.server\fR
script, which usually resides in the
/etc/init.d/
directory. In MySQL 5.0.3, this script invokes
\fBmysqlmanager\fR
(the MySQL Instance Manager binary) to start MySQL. (In prior versions of MySQL the
\fBmysqld_safe\fR
script is used for this purpose.) Starting from MySQL 5.0.4, the behavior of the startup script was changed again to incorporate both setup schemes. In version 5.0.4, the startup script uses the old scheme (invoking
\fBmysqld_safe\fR) by default, but one can set the
use_mysqld_safe
variable in the script to
0
(zero) to use the MySQL Instance Manager to start a server.
.PP
Starting with MySQL 5.0.19, you can use Instance Manager if you modify the
\fImy.cnf\fR
configuration file by adding
use\-manager
to the
[mysql.server]
section:
.sp
.RS 3n
.nf
[mysql.server]
use\-manager
.fi
.RE
.PP
When Instance Manager starts, it reads its configuration file if it exists to find server instance sections and prepare a list of instances. Instance sections have names of the form
[mysqld]
or
[mysqld\fIN\fR], where
\fIN\fR
is an unsigned integer (for example,
[mysqld1],
[mysqld2], and so forth).
.PP
After preparing the list of instances, Instance Manager starts the guarded instances in the list. If there are no instances, Instance Manager creates an instance named
mysqld
and attempts to start it with default (compiled\-in) configuration values. This means that the Instance Manager cannot find the
\fBmysqld\fR
program if it is not installed in the default location. (Section\ 4.6, \(lqInstallation Layouts\(rq, describes default locations for components of MySQL distributions.) If you have installed the MySQL server in a non\-standard location, you should create the Instance Manager configuration file.
.PP
Instance Manager also stops all guarded server instances when it shuts down.
.PP
The allowable options for
[mysqld\fIN\fR]
server instance sections are described in
the section called \(lqMYSQL INSTANCE MANAGER CONFIGURATION FILES\(rq. In these sections, you can use a special
\fBmysqld\-path=\fR\fB\fIpath\-to\-mysqld\-binary\fR\fR
option that is recognized only by Instance Manager. Use this option to let Instance Manager know where the
\fBmysqld\fR
binary resides. If there are multiple instances, it may also be necessary to set other options such as
datadir
and
port, to ensure that each instance has a different data directory and TCP/IP port number.
Section\ 11, \(lqRunning Multiple MySQL Servers on the Same Machine\(rq, discusses the configuration values that must differ for each instance when you run multiple instance on the same machine.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
\fBWarning\fR
.PP
The
[mysqld]
instance section, if it exists, must not contain any Instance Manager\-specific options.
.PP
The typical Unix startup/shutdown cycle for a MySQL server with the MySQL Instance Manager enabled is as follows:
.TP 3n
1.
The
\fB/etc/init.d/mysql\fR
script starts MySQL Instance Manager.
.TP 3n
2.
Instance Manager starts the guarded server instances and monitors them.
.TP 3n
3.
If a server instance fails, Instance Manager restarts it.
.TP 3n
4.
If Instance Manager is shut down (for example, with the
\fB/etc/init.d/mysql stop\fR
command), it shuts down all server instances.
.SH "INSTANCE MANAGER USER AND PASSWORD MANAGEMENT"
.PP
The Instance Manager stores its user information in a password file. On Windows, the default is
\fImysqlmanager.passwd\fR
in the directory where Instance Manager is installed. On Unix, the default file is
\fI/etc/mysqlmanager.passwd\fR. To specify a different location for the password file, use the
\fB\-\-password\-file\fR
option.
.PP
If the password file does not exist or contains no password entries, you cannot connect to the Instance Manager.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
\fBNote\fR
.PP
Any Instance Manager process that is running to monitor server instances does not notice changes to the password file. You must stop it and restart it after making password entry changes.
.PP
Entries in the password file have the following format, where the two fields are the account username and encrypted password, separated by a colon:
.sp
.RS 3n
.nf
petr:*35110DC9B4D8140F5DE667E28C72DD2597B5C848
.fi
.RE
.PP
Instance Manager password encryption is the same as that used by MySQL Server. It is a one\-way operation; no means are provided for decrypting encrypted passwords.
.PP
Instance Manager accounts differ somewhat from MySQL Server accounts:
.TP 3n
\(bu
MySQL Server accounts are associated with a hostname, username, and password (see
Section\ 7.1, \(lqMySQL Usernames and Passwords\(rq).
.TP 3n
\(bu
Instance Manager accounts are associated with a username and password only.
.sp
.RE
.PP
This means that a client can connect to Instance Manager with a given username from any host. To limit connections so that clients can connect only from the local host, start Instance Manager with the
\fB\-\-bind\-address=127.0.0.1\fR
option so that it listens only to the local network interface. Remote clients will not be able to connect. Local clients can connect like this:
.sp
.RS 3n
.nf
shell> \fBmysql \-h 127.0.0.1 \-P 2273\fR
.fi
.RE
.PP
To generate a new entry, invoke Instance Manager with the
\fB\-\-passwd\fR
option and append the output to the
\fI/etc/mysqlmanager.passwd\fR
file. Here is an example:
.sp
.RS 3n
.nf
shell> \fBmysqlmanager \-\-passwd >> /etc/mysqlmanager.passwd\fR
Creating record for new user.
Enter user name: \fBmike\fR
Enter password: \fBmikepass\fR
Re\-type password: \fBmikepass\fR
.fi
.RE
.PP
At the prompts, enter the username and password for the new Instance Manager user. You must enter the password twice. It does not echo to the screen, so double entry guards against entering a different password than you intend (if the two passwords do not match, no entry is generated).
.PP
The preceding command causes the following line to be added to
\fI/etc/mysqlmanager.passwd\fR:
.sp
.RS 3n
.nf
mike:*BBF1F551DD9DD96A01E66EC7DDC073911BAD17BA
.fi
.RE
.SH "MYSQL SERVER INSTANCE STATUS MONITORING"
.PP
To monitor the status of each guarded server instance, the MySQL Instance Manager attempts to connect to the instance at regular intervals using the
MySQL_Instance_Manager@localhost
user account with a password of
check_connection.
.PP
You are
\fInot\fR
required to create this account for MySQL Server; in fact, it is expected that it will not exist. Instance Manager can tell that a server is operational if the server accepts the connection attempt but refuses access for the account by returning a login error. However, these failed connection attempts are logged by the server to its general query log (see
Section\ 10.2, \(lqThe General Query Log\(rq).
.PP
Instance Manager also attempts a connection to nonguarded server instances when you use the
SHOW INSTANCES
or
SHOW INSTANCE STATUS
command. This is the only status monitoring done for nonguarded instances.
.PP
Instance Manager knows if a server instance fails at startup because it receives a status from the attempt. For an instance that starts but later crashes, Instance Manager receives a signal because it is the parent process of the instance.
.SH "CONNECTING TO MYSQL INSTANCE MANAGER"
.PP
After you set up a password file for the MySQL Instance Manager and Instance Manager is running, you can connect to it. The MySQL client\-server protocol is used to communicate with the Instance Manager. For example, you can connect to it using the standard
\fBmysql\fR
client program:
.sp
.RS 3n
.nf
shell> \fBmysql \-\-port=2273 \-\-host=im.example.org \-\-user=mysql \-\-password\fR
.fi
.RE
.PP
Instance Manager supports the version of the MySQL client\-server protocol used by the client tools and libraries distributed with MySQL 4.1 or later, so other programs that use the MySQL C API also can connect to it.
.SH "MYSQL INSTANCE MANAGER COMMANDS"
.PP
After you connect to MySQL Instance Manager, you can issue commands. The following general principles apply to Instance Manager command execution:
.TP 3n
\(bu
Commands that take an instance name fail if the name is not a valid instance name.
.TP 3n
\(bu
Commands that take an instance name fail if the instance does not exist.
.TP 3n
\(bu
Instance Manager maintains information about instance configuration in an internal (in\-memory) cache. Initially, this information comes from the configuration file if it exists, but some commands change the configuration of an instance. Commands that modify the configuration file fail if the file does not exist or is not accessible to Instance Manager.
.TP 3n
\(bu
On Windows, the standard file is
\fImy.ini\fR
in the directory where Instance Manager is installed. On Unix, the standard configuration file is
\fI/etc/my.cnf\fR. To specify a different configuration file, start Instance Manager with the
\fB\-\-defaults\-file\fR
option.
.TP 3n
\(bu
If a
[mysqld]
instance section exists in the configuration file, it must not contain any Instance Manager\-specific options (see
the section called \(lqMYSQL INSTANCE MANAGER CONFIGURATION FILES\(rq). Therefore, you must not add any of these options if you change the configuration for an instance named
mysqld.
.sp
.RE
.PP
The following list describes the commands that Instance Manager accepts, with examples.
.TP 3n
\(bu
START INSTANCE \fIinstance_name\fR
.sp
This command attempts to start an offline instance. The command is asynchronous; it does not wait for the instance to start.
.sp
.RS 3n
.nf
mysql> \fBSTART INSTANCE mysqld4;\fR
Query OK, 0 rows affected (0,00 sec)
.fi
.RE
.TP 3n
\(bu
STOP INSTANCE \fIinstance_name\fR
.sp
This command attempts to stop an instance. The command is synchronous; it waits for the instance to stop.
.sp
.RS 3n
.nf
mysql> \fBSTOP INSTANCE mysqld4;\fR
Query OK, 0 rows affected (0,00 sec)
.fi
.RE
.TP 3n
\(bu
SHOW INSTANCES
.sp
Shows the names and status of all loaded instances.
.sp
.RS 3n
.nf
mysql> \fBSHOW INSTANCES;\fR
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| instance_name | status  |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| mysqld3       | offline |
| mysqld4       | online  |
| mysqld2       | offline |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
.fi
.RE
.TP 3n
\(bu
SHOW INSTANCE STATUS \fIinstance_name\fR
.sp
Shows status and version information for an instance.
.sp
.RS 3n
.nf
mysql> \fBSHOW INSTANCE STATUS mysqld3;\fR
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| instance_name | status | version |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| mysqld3       | online | unknown |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
.fi
.RE
.TP 3n
\(bu
SHOW INSTANCE OPTIONS \fIinstance_name\fR
.sp
Shows the options used by an instance.
.sp
.RS 3n
.nf
mysql> \fBSHOW INSTANCE OPTIONS mysqld3;\fR
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| option_name   | value                                             |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| instance_name | mysqld3                                           |
| mysqld\-path   | /home/cps/mysql/trees/mysql\-4.1/sql/mysqld        |
| port          | 3309                                              |
| socket        | /tmp/mysql.sock3                                  |
| pid\-file      | hostname.pid3                                     |
| datadir       | /home/cps/mysql_data/data_dir1/                   |
| language      | /home/cps/mysql/trees/mysql\-4.1/sql/share/english |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.RE
.TP 3n
\(bu
SHOW \fIinstance_name\fR LOG FILES
.sp
The command lists all log files used by the instance. The result set contains the path to the log file and the log file size. If no log file path is specified in the instance section of the configuration file (for example,
log=/var/mysql.log), the Instance Manager tries to guess its placement. If Instance Manager is unable to guess the log file placement you should specify the log file location explicitly by using a log option in the appropriate instance section of the configuration file.
.sp
.RS 3n
.nf
mysql> \fBSHOW mysqld LOG FILES;\fR
+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+
| Logfile     | Path                               | Filesize |
+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+
| ERROR LOG   | /home/cps/var/mysql/owlet.err      | 9186     |
| GENERAL LOG | /home/cps/var/mysql/owlet.log      | 471503   |
| SLOW LOG    | /home/cps/var/mysql/owlet\-slow.log | 4463     |
+\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+
.fi
.RE
Log options are described in
the section called \(lqCOMMAND OPTIONS\(rq.
.TP 3n
\(bu
SHOW \fIinstance_name\fR LOG {ERROR | SLOW | GENERAL} \fIsize\fR[,\fIoffset_from_end\fR]
.sp
This command retrieves a portion of the specified log file. Because most users are interested in the latest log messages, the
\fIsize\fR
parameter defines the number of bytes to retrieve from the end of the log. To retrieve data from the middle of the log file, specify the optional
\fIoffset_from_end\fR
parameter. The following example retrieves 21 bytes of data, starting 23 bytes before the end of the log file and ending 2 bytes before the end:
.sp
.RS 3n
.nf
mysql> \fBSHOW mysqld LOG GENERAL 21, 2;\fR
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| Log                 |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
| using password: YES |
+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
.fi
.RE
.TP 3n
\(bu
SET \fIinstance_name\fR.\fIoption_name\fR[=\fIoption_value\fR]
.sp
This command edits the specified instance's configuration section to change or add instance options. The option is added to the section is it is not already present. Otherwise, the new setting replaces the existing one.
.sp
.RS 3n
.nf
mysql> \fBSET mysqld2.port=3322;\fR
Query OK, 0 rows affected (0.00 sec)
.fi
.RE
Changes made to the configuration file do not take effect until the MySQL server is restarted. In addition, these changes are not stored in the instance manager's local cache of instance settings until a
FLUSH INSTANCES
command is executed.
.TP 3n
\(bu
UNSET \fIinstance_name\fR.\fIoption_name\fR
.sp
This command removes an option from an instance's configuration section.
.sp
.RS 3n
.nf
mysql> \fBUNSET mysqld2.port;\fR
Query OK, 0 rows affected (0.00 sec)
.fi
.RE
Changes made to the configuration file do not take effect until the MySQL server is restarted. In addition, these changes are not stored in the instance manager's local cache of instance settings until a
FLUSH INSTANCES
command is executed.
.TP 3n
\(bu
FLUSH INSTANCES
.sp
This command forces Instance Manager reread the configuration file and to refresh internal structures. This command should be performed after editing the configuration file. The command does not restart instances.
.sp
.RS 3n
.nf
mysql> \fBFLUSH INSTANCES;\fR
Query OK, 0 rows affected (0.04 sec)
.fi
.RE
FLUSH INSTANCES
is deprecated and will be removed in MySQL 5.2.
.SH "COPYRIGHT"
.PP
Copyright 1997\-2006 MySQL AB
.PP
This documentation is NOT distributed under a GPL license. Use of this documentation is subject to the following terms: You may create a printed copy of this documentation solely for your own personal use. Conversion to other formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish or distribute this documentation in any form or on any media, except if you distribute the documentation in a manner similar to how MySQL disseminates it (that is, electronically for download on a Web site with the software) or on a CD\-ROM or similar medium, provided however that the documentation is disseminated together with the software on the same medium. Any other use, such as any dissemination of printed copies or use of this documentation, in whole or in part, in another publication, requires the prior written consent from an authorized representative of MySQL AB. MySQL AB reserves any and all rights to this documentation not expressly granted above.
.PP
Please email
<docs@mysql.com>
for more information.
.SH "SEE ALSO"
msql2mysql(1),
my_print_defaults(1),
myisam_ftdump(1),
myisamchk(1),
myisamlog(1),
myisampack(1),
mysql(1),
mysql.server(1),
mysql_config(1),
mysql_explain_log(1),
mysql_fix_privilege_tables(1),
mysql_tzinfo_to_sql(1),
mysql_upgrade(1),
mysql_zap(1),
mysqlaccess(1),
mysqladmin(1),
mysqlbinlog(1),
mysqlcheck(1),
mysqld(8),
mysqld_multi(1),
mysqld_safe(1),
mysqldump(1),
mysqlhotcopy(1),
mysqlimport(1),
mysqlshow(1),
perror(1),
replace(1),
safe_mysqld(1)
.P
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
MySQL AB (http://www.mysql.com/).
This software comes with no warranty.