Tải bản đầy đủ (.pdf) (24 trang)

MySQL High Availability- P13

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (835.76 KB, 24 trang )

replication threads, 371
scripting clone operation, 35–36
security and, 64
Server class, 26–28
server logs and, 315
server roles, 28–30
structure considerations, 20–22, 46–50
troubleshooting, 392
--verbose option, 564
binary log events
defined, 46
logging statements, 61–66
structure considerations, 46–50
troubleshooting, 389–391
binlog dump thread, 371
binlog file format version, 48–50, 84
binlog file rotation, 83
binlog files
creating, 88
creation time, 98
dumping contents, 88
functionality, 47
processing order, 92
purging, 85, 86
reading remotely, 93
shared disks and, 117
binlog index file
functionality, 47
purging, 85, 87
binlog injector thread, 554
binlog-cache-size option, 99


binlog-cache-size server variable, 84
binlog-do-db option, 59–61, 163, 315, 369
binlog-format option, 230, 231, 553
binlog-ignore-db option, 59–61, 163, 315, 369
binlog-in-use flag, 81, 84, 96
binlog-max-row-event-size option, 231
Binomial tail distribution, 105
Blackhole storage engine, 160, 334
bootstrapping a slave, 30
Bott, Ed, 283
browser plug-ins, 494
buckets, defined, 491
buffer pools
defined, 353
monitoring, 360–363
Bunce, Tim, 429
business continuity (see information integrity)
C
CA (certification authority), 203, 204
CACHE INDEX command, 350
Cacti tool, 252
CALL statement, 68
central store duplicating, 156
certification authority (CA), 203, 204
chain topology, 402
CHANGE MASTER command
cloud computing and, 518
connecting to downstream server, 144
IGNORE_SERVER_IDS option, 144, 398,
399

master heartbeats, 383
master status variables and, 376
MASTER_HOST option, 202
noting slave position, 118
troubleshooting replication, 400
troubleshooting slaves, 393, 395
usage example, 145
CHANGE MASTER TO command
configuring replication, 199
configuring slaves, 32
CONNECT_RETRY parameter, 215
creating slaves, 30
hot standby and, 114
MASTER_SSL option, 204
MASTER_SSL_CAPATH option, 204
MASTER_SSL_CERT option, 204
MASTER_SSL_KEY option, 204
privilege considerations, 16
replication status information, 207
slave promotion, 129, 134
usage example, 15
channel, defined, 554
checksumming, 251
circular replication
depicted, 152
functionality, 142–146
ignoring servers, 572
topology, 403
troubleshooting, 398
clone function, 35

cloning operation
master servers, 30, 31
scripting, 35–36
slave servers, 33–34
closed recovery images, 441
cloud computing
Index | 577
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
architectures supported, 480–483
AWS case study, 484, 487–516
best practices, 520–522
characteristics of, 479
defined, 478
deployment models, 480
economical considerations, 483–484
elasticity and, 482
grid computing and, 481
MySQL Enterprise and, 473
open source, 522
potential benefits, 485
replication and, 517–520
service models, 479
software libraries and, 483
transactional computing and, 482
use cases, 484
vendor support, 486
virtualization and, 481
clustered indexes, 353
comments
hash marks in, 90

retrieving, 177
COMMIT statement
logging transactions, 75
query events and, 234
slave promotion, 132
two-phase commit and, 150
commit_and_sync function, 186, 190
compressing tables, 345, 347
concat function, 319
configuration file
best practices, 404
binary log and, 47, 59–61, 165
configuring masters, 13–14
configuring slaves, 15
managing replication, 24
options supported, 58
Server class and, 26
SSL considerations, 204
troubleshooting replication, 400
CONNECTION_ID function
row-based replication and, 229
session-specific, 216
thread ID and, 56, 57
connect_to helper function, 157
consistency (see data consistency)
Console application, 271
--console option, 315
constraints, best practices, 337
context events
logging queries, 51–57

SQL threads and, 217–220
contingency plans (high availability)
defined, 104
disaster recovery, 107, 417
master failures, 106
planning considerations, 106
relay failures, 107
slave failures, 106
CPU-bound processes, 249
Create Basic Task Wizard, 43
CREATE FUNCTION statement, 69
CREATE INDEX command, 538
CREATE PROCEDURE statement, 67
CREATE ROUTINE privilege, 70
CREATE statement
binlog events and, 48
ENGINE parameter, 334
logging transactions, 76
CREATE TABLE IF NOT EXISTS statement,
46, 135
CREATE TABLE statement
implicit commits and, 135
logging, 51
CREATE TRIGGER statement
DEFINER clause, 65
security considerations, 63
CREATE USER privilege, 16
Create_file_log_event, 58
credentials
getting, 498

instances and, 500
cron facility, 253, 268
crontab files, 42
CSV storage engine, 334
CURDATE function, 53
current database
binary log filters, 59–61, 567
logging queries, 51, 52
query events and, 97
USE statement, 60
current time, logging queries, 52, 53
CURRENT_ID function, 52
CURRENT_USER function, 229, 231
CURTIME function, 53
cycle function, 228
Cygwin environment, 429
578 | Index
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
D
dashboards, 453
(see also Enterprise Dashboard)
defined, 453
MEM support, 456
Data Collector Sets, 287
data consistency
asynchronous replication and, 150, 151
in hierarchal deployment, 187–193
managing, 184–187
MyISAM considerations, 82
in nonhierarchal deployment, 185–187

Data Definition Language (DDL) statements
backups and, 430
logging statements, 51
logging transactions, 76
data managers, 481
Data Manipulation Language (DML), 50
data protection, 410
data recovery, 439
(see also disaster recovery)
backup and restore, 420–424
example, 440
importance of, 419
PITR and, 439–445
replication and, 438
terminology, 419
data sharding
common usage, 167
database considerations, 175
dynamic, 170, 178–180
example, 173–184
load balancing and, 168, 171–173, 180–
184
managing, 168
moving between shards, 173
moving to different nodes, 171–173
naming considerations, 169
partition keys/functions, 175–176
partitioning data, 170
process overview, 165–168
reading shards, 177–178

representing shards, 168
slave lag and, 385
static, 170
writing data and, 149
data-mining queries, 37
databases
copying files, 108
measuring performance, 320–331
optimizing, 331–339, 368
performance information, 320
replication after crashes, 222–225
sharding, 175
--datadir startup option, 344, 435
Date, C. J., 320
dd command, 521
DDL (Data Definition Language) statements
backups and, 430
logging statements, 51
logging transactions, 76
defragmenting tables, 348
delayed slaves, 5
DELETE statement
LIMIT clause, 229, 240
logging, 50
nontransactional changes and, 225
stored procedures and, 66
WHERE clause, 46
Delete_rows events, 232, 237
deployment
defined, 24

hierarchal, 187–193
nonhierarchal, 185–187
DESCRIBE command, 320
df command, 264
diamond configuration, 226
differential backups, 422
disaster avoidance
hot standby, 11, 111–114, 148
remote replication and, 148
disaster recovery, 439
(see also data recovery)
contingency plans, 107
goal of, 414
high availability and, 418, 550–551
information integrity and, 412, 413–419
planning considerations, 415
practicing, 417
slave servers, 222–226
tools and strategies, 417–419
workflow considerations, 415–417
disk usage
AWS considerations, 511–516
Linux/Unix environments, 261
Mac OS X environment, 274
monitoring, 247, 250
optimizing, 344
Index | 579
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Disk Usage Analyzer, 264
disk-bound processes, 250

distributed data, redundancy and, 531
Distributed Replicated Block Device (DRBD),
118
distributed transaction processing, 79–81
distribution costs, managing replication, 153
DML (Data Manipulation Language), 50
DRBD (Distributed Replicated Block Device),
118
DROP command, 335
DROP INDEX command, 538
DROP TABLE IF EXISTS statement, 46
DROP TABLE statement, 22, 135
dual-master setup
active-active setup, 115, 116, 120–124
active-passive setup, 115, 116, 119
bidirectional replication, 120–124, 166
defined, 6
depicted, 152
high availability and, 115–124
managing replication, 23
replicated disks and, 118
shared disks and, 117
dynamic sharding, 170, 178–180
E
ec2-add-key-pair command, 495
ec2-attach-volume command, 515
ec2-authorize command, 510
ec2-create-snapshot command, 516
ec2-create-volume command, 515
ec2-delete-snapshot command, 516

ec2-delete-volume command, 516
ec2-describe-images command, 496, 509
ec2-describe-snapshots command, 516
ec2-describe-volumes command, 515
ec2-detach-volume command, 515
ec2-run-instances command, 496, 509
ec2-start-instances command, 496
ec2-stop-instances command, 496
ec2-terminate-instances command, 496, 510
elastic load balancing, 489
Elastic MapReduce, 488
Elasticfox (Firefox plug-in), 494
elasticity, cloud computing and, 482
EmptyRowError exception, 25
_enable_binlog helper method, 136
encryption
security considerations, 64
SSL support, 202
Enki Consulting, 486
Enterprise Dashboard
Advisors tab, 469
consolidated server graphs, 466
functionality, 456
heat charts, 464
Query Analyzer and, 459
Replication tab, 468
server details, 467
epochs, defined, 531
Error class, 25
error handling

log messages and, 282
logging statements, 72–75
error logs, 314
Event Scheduler, 42
Event Viewer, 281–283
events, 46
(see also binary log events)
affecting replication, 81
defined, 71
DEFINER clause, 71
executing, 236–237
filtering, 162–164, 221–222
handling row-based replication, 232–236
incidents and, 85
interpreting, 94–98
logging statements, 61–66, 71
object definitions, 180
partitioning to slaves, 164
password considerations, 64
skipping, 217, 221–222
slave processing, 215–222
SQL thread processing, 217
triggers and, 238–239
excessive lag, 396
Execute_load_query event, 57
Execute_log_event, 58
expire-logs-days option, 86, 98
EXPLAIN command
best practices, 339
executing queries, 458

functionality, 320–327
indexes and, 331
usage example, 313
EXTENDED keyword, 323
extended-status command, 301
580 | Index
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
external replication, 552
F
Faroult, Stephane, 320
fdisk command, 264
Federated storage engine, 335
fetch_global_trans_id function, 140
fetch_master_pos function, 35, 186, 191
fetch_relay_chain function, 191
fetch_remote_binlog function, 40, 138
fetch_slave_pos function, 35
fetch_trans_id function, 190
file IDs, 57
filesystem
coordinating synchronization, 83
disk usage and, 250
logging changes, 51, 76
logical volumes and, 434
memory considerations, 250
object definitions and, 180
reading remote files, 93
snapshot support, 108
filtering
current database, 567

partitioning events to slaves, 164
replication events, 162–164
row-based replication, 240
scaling out and, 149
skipping events, 221–222
SQL threads and, 217
filtering, binary log filters and, 59–61
Final role, 29
find_datetime_position function, 40
FLUSH LOGS command
binlog file support, 47
functionality, 18, 84
monitoring master servers, 374
privilege considerations, 16
troubleshooting binary log, 392
FLUSH QUERY CACHE command, 300
FLUSH STATUS command, 307
FLUSH TABLES command, 429
FLUSH TABLES WITH READ LOCK
command
cloning the master, 31
EBS snapshots and, 514
InnoDB cautions, 34
LVM support, 436
pausing replication, 406
releasing locks, 27
foreign keys, 338
format description events
binlog event structure, 47, 48–50
functionality, 19, 20

header restrictions, 97
I/O threads and, 216
in binary log, 20, 84
interpreting, 97
printing, 89
XA and, 81
fragments, defined, 552
free command, 253, 259
fsync call, 223, 224
G
general query logs, 314
getArticlesForUser function, 177, 182
getCommentsForArticle function, 177
getServerConnection function (PHP), 157
global redundancy, 530, 557
global transaction IDs
circular replication, 144, 145
data consistency example, 187, 190
defined, 130
slave promotion and, 130–135, 137, 139
GNOME desktop project, 264
Gnome System Monitor, 252
Governor, James, 478
GRANT OPTION privilege, 16
graphical user interfaces (GUIs), 268, 302
grep command, 258, 509
grid computing, 481
groups, defined, 48
group_by_event function, 138
group_by_trans function, 138

GUIs (graphical user interfaces), 268, 302
H
hardware
data loss and, 421
node recovery and, 551
hash mark (#), 90
HA_ERR_KEY_NOT_FOUND error, 399
Health Insurance Portability and
Accountability Act (HIPAA), 412
heartbeats, 383, 551, 571
heat charts, 464
Index | 581
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Heisenberg uncertainty, 306
Hibernate Shards (Google), 168
hierarchal deployment, 187–193
hierarchal replication
defined, 159
setting up relay servers, 160
high availability
achieving, 547–550
backups and, 6
contingency plans, 104, 106–107
disaster recovery and, 418
information integrity and, 412
MyISAM storage engine and, 352
node recovery and, 551
procedures and, 104, 107–146
redundancy and, 103, 104
replication and, 6, 552–556

system recovery and, 550–551
HIPAA (Health Insurance Portability and
Accountability Act), 412
HiveDB sharding implementation, 168
horizontal partitioning (see data sharding)
host-bin option, 99
hostname-bin option, 14
hot standby
defined, 11
disaster avoidance through, 11, 148
high availability and, 111–114
hybrid topology, 403
I
IA (information assurance)
additional information, 410
defined, 410
importance of, 411
related practices, 410
IaaS (Infrastructure as a Service)
defined, 479
virtualization and, 481
ibbackup utility
--apply-log option, 426
core operations, 425
performing backups, 425
restoring data, 427
--uncompress option, 426
IBM Blue Cloud, 486
ifconfig command, 265
IGNORE LEAVES clause, 350

images, defined, 481
Incident event type, 86
incident events, defined, 85
incremental backups, 422
index file (see binlog index file)
indexes
best practices, 331, 338
clustered, 353
fine-tuning, 320
preloading, 349
queries and, 294, 299
information assurance (see IA)
information integrity
backup and restore, 420–424
data recovery and, 419
defined, 410, 411–412
disaster recovery and, 412, 413–419
high availability and, 412
overview, 411
information significance, 410
INFORMATION_SCHEMA database, 363–
364
Infrastructure as a Service (see IaaS)
--initial option, 543
--initial-start option, 543
init_file option, 389
innobackup script
functionality, 427
options supported, 427
performing backups, 428

restoring data, 428
InnoDB Hot Backup
application, 425–428, 437
cloning the master, 31
InnoDB storage engine
architectural features, 353
data sharding and, 174
dual-master setup and, 118
functionality, 334
handling row locks, 182
Hot Backup, 33, 108, 425–428
improving performance, 352
INFORMATION_SCHEMA database,
363–364
InnoTop system activity report, 317
monitor mechanism, 357–359
monitoring buffer pools, 360–363
monitoring logfiles, 359
monitoring tablespaces, 363
OPTIMIZE TABLE command, 330
582 | Index
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
parameters supported, 365
recovery considerations, 119
semisynchronous replication, 124
SHOW ENGINE INNODB STATUS
command, 354–356
slave promotion and, 131
snapshot support, 108
XA support, 83

innodb_fast_shutdown option, 365
innodb_thread_consistency option, 365
InnoTop system activity report, 317
INSERT INTO statement, 135
INSERT statement
invoking triggers, 65
LIMIT clause, 229, 240
logging, 50
nontransactional changes and, 73, 225
stored functions and, 69
stored procedures and, 66
usage examples, 90, 219
INSERT_ID session variable, 218
instances
defined, 481
launching, 508–511
running, 501–508
storage considerations, 511
instances, credentials and, 500
integer data, interpreting, 94
internal replication, 552
Internet, running replication over, 202–206
Intvar event
functionality, 54, 218
mysqlbinlog support, 90, 91
stored procedures and, 68
inventory assessment, 416
I/O threads
functionality, 200
handling broken connections, 215

housekeeping, 216
replication and, 371
starting and stopping, 201
state considerations, 210–212
synchronizing, 224
I/O transfer rates, 262
I/O-bound processes, 251
I/O-starved processes, 251
ionice command, 255
iostat command, 253, 255, 261
itertools module, 228
J
Joyent (vendor), 486
K
KDE System Guard, 252
kernel, memory and, 250
key caches
creating, 350
monitoring, 348
multiple, 350
preloading, 349
KILL command, 295, 301
L
LAST_INSERT_ID function
global transaction ID, 132
logging queries and, 52, 53, 54
LAST_INSERT_ID session variable, 218
Layered Technologies (vendor), 487
legal requirements, data preservation, 7
L’Hermite, Pascal, 320

LIKE clause, 295
LIMIT clause, 229, 240
Linux class, 26
Linux environment
automated monitoring, 268
disk usage, 261–264
general system statistics, 266
InnoDB Hot Backup application, 425
LVM support, 31, 34, 108
managing replication, 24
memory usage, 259–261
monitoring, 246, 253–268
network activity, 265
process activity, 253–258
Linux High Availability project, 118
load balancing
application-level, 155–158
data sharding and, 168, 171–173, 180–184
elastic, 489
managing replication, 152
for reads, 148
slave lag and, 385
for writes, 148
LOAD DATA INFILE statement
data sharding example, 184
handling current database, 52
LOAD_FILE function and, 72
Index | 583
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
logging statements, 57–58

logging transactions, 76
LOAD INDEX command, 349
LOAD_FILE function, 72, 231
Load_log_event, 58
LOCAL keyword, 329, 330
local query handler, 537
local redundancy, 530, 557
LOCK TABLES command, 172
locks
reducing contention, 385
releasing, 27
row, 182
LOCK_log mutex, 50
--log startup option, 314
log-bin option
controlling binlog files, 47
functionality, 13, 99, 315
Server class and, 26
slave promotion and, 129
log-bin-index option
controlling binlog files, 47
functionality, 13, 99, 315
Server class and, 26
log-bin-trust-function-creators option, 71, 99
--log-error startup option, 315
--log-output startup option, 314
log-slave-updates option
bidirectional replication, 121
binary logging and, 393
hierarchal replication, 160

hot standby and, 112
slave promotion and, 129, 130, 136
--log-slow-queries startup option, 314
--log-slow-slave-statements option, 314
logfiles
applying to backups, 426
best practices, 404
Console application and, 271
Event Viewer support, 281
InnoDB storage engine and, 353
monitoring, 359
RESET_SLAVE command and, 199
server logs, 313
troubleshooting replication, 400
troubleshooting tables, 391
logging statements
binary log filters, 59–61
DDL statements, 51
DML statements, 50
error handling, 72–75
events, 61–66, 71
LOAD DATA INFILE statement, 57–58
LOCK_log mutex, 50
nontransactional changes, 72–75
query events, 51–57
special constructions, 71
stored functions, 61, 66, 69–70
stored procedures, 61, 66–68
stored programs, 61–66
stored routines, 61–66

triggers, 61–66
logging transactions
implicit commits and, 76
starting transactions, 75
transaction cache, 76–79
XA support, 79–81
logical backups, 422
Logical Volume Manager (see LVM)
logical volumes, 434
Loukides, Mike, 262
ls command, 264
Lua programming language, 154
lvcreate command, 434
LVM (Logical Volume Manager)
backup comparisons, 437
cloning slaves, 34
cloning the master, 31
functionality, 432
snapshot support, 108
usage considerations, 433–436
lvremove command, 435
lvscan command, 435
M
Mac OS X environment
Activity Monitor, 273–276
Console application, 271
monitoring, 246, 268–276
System Profiler, 268–271
Machine class, 26
management buy-in, 416

managing binary log, 81–87
Martelli, Alex, 140
master dump thread, 200
master filters
creating, 163
defined, 162
584 | Index
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
master heartbeats, 383
master log information file
flushing, 224
functionality, 198
manipulating slave threads, 201
replication status information, 212
Master role
defined, 29
replicate_from function and, 35
master servers
checking status, 403
circular replication, 142–146
cloning, 30, 31
configuring, 13
connecting to slaves, 14, 15
creating, 7
creating replication users, 14
delayed slaves, 5
dual-master setup, 6, 23, 115–124
handling failures, 106, 109
hierarchal replication, 159
monitoring, 372–376

monitoring thread status, 371
multimaster issues, 399
replication overview, 5
scripting the clone operation, 35
server roles, 28–30
status variables and, 376
switching, 109, 112–114
tips and tricks, 568–570
troubleshooting, 388–393
two-phase commit and, 150
upgrading, 110
master-connect-retry option, 215
master-retry-count option, 215
MASTER_POS_WAIT function
data consistency example, 185, 186, 187
functionality, 40, 172
relay log processing and, 213
max-allowed-packet option, 58, 397
max-binlog-cache-size option, 100
max-binlog-size option, 100
Maxia, Giuseppe, 154
MD5 function, 220
MEM (see MySQL Enterprise Monitor)
memcached technique, 156, 171
memory
cautions when tweaking, 250
Mac OS X environment, 274
monitoring, 247, 249, 259–261
node recovery and, 551
troubleshooting, 389, 395

Memory storage engine, 335
memory-bound processes, 249
Merge storage engine, 335
MERGE view, 122
Microsoft Azure, 483
Microsoft Management Console snap-ins, 42
mission statements, 416
mixed-mode replication, 231
Mollinaro, Anthony, 320
monitoring, 292
(see also performance considerations)
automated, 268
benefits of, 247
buffer pools, 360–363
categories of, 246
defined, 246
disk usage, 247, 250, 261–264, 274
general system statistics, 266
InnoDB storage engine, 352–365
key cache, 348
Linux environment, 246, 253–268
logfiles, 359
Mac OS X environment, 246, 268–276
master servers, 372–376
memory, 247, 249, 259–261, 274
MyISAM storage engine, 344–352
MySQL Administrator and, 381
MySQL Enterprise, 463–470
MySQL servers, 292–319
network activity, 248, 251, 265, 275

as preventive maintenance, 288
process activity, 253–258
processor, 247, 248
replication, 367–386
semisynchronous replication, 127
slave lag, 383
slave servers, 376
tablespaces, 363
tools for, 252
Unix environment, 246, 253–268
usage examples, 7
Windows environment, 246, 276–288
monitoring agents, 457, 462
MONyog tool, 317
mount command, 435
mpstat command, 253, 255, 257
Index | 585
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×