Documentation and discussion
Management software
Tuning analysis software
High availability
Use circular replication.
Choose a fail-over strategy:
Load-balancer
Master server VIP must only connect to a single MySQL instance.
Fail-over generally requires Apache and PHP on the MySQL server to allow the load balancer to indirectly monitor MySQL status.
Clustering
Moderation/arbitration
Fencing
APC7920 or WTI
iLO, DRAC, IBM RSAII
Plan for likely failure:
Disks
Plan for possible failure:
Network
OOM
Power
Global configuration
Any memory specified below is allocated once for each MySQL instance, regardless of the number of connections.
Recommended: Cap at 128M, maybe 256M.
query_cache_limitRecommended:
1M(default)
query_cache_typeRecommended:
1(enables cache by default)Consider turning the default caching off and using
SQL_CACHEin specific queries accessing tables with lessUPDATEorINSERTvolume.
max_connectionsSlightly more than maxclients (in apache) to prevent "db offline" errors
Recommended: As large as possible while accommodating connection memory without swapping.
default_storage_engineRecommended:
InnoDB
default_character_setRecommended:
utf8
collation_serverRecommended:
utf8_general_ci
character_set_serverRecommended:
utf8
max_allowed_packetRecommended: Just make consistent across all servers and clients to avoid "packet too large" errors.
sync_binlogRecommended: Set to
1if the disk controller has a battery-backed cache.
innodb_log_file_sizeRecommended: Up to 4G, but start with 1G
innodb_flush_log_at_trx_commitRecommended: 0 (may mean less than 100% acid-compliance)
innodb_flush_methodRecommended: O_DIRECT (linux only)
innodb_file_per_tableRecommended: 1 to allow us to reclaim space on disk
table_cacheRecommended: tune to be larger than your number of tables
key_buffer_sizeRecommended: 20M (we still build temp tables in myISAM)
Per-connection configuration
Any memory specified below is allocated per-connection. The maximum number of concurrent connections is max_connections. The MySQL server should not have to swap even if it reaches max_connections and MySQL uses all globally available memory. If a particular session or connection would benefit from increases in any of the buffers marked with , these buffers can be increased on a session-by-session basis.
Default:
192K
net_buffer_length (allocated twice per connection)
Default:
16K
Recommended:
2M
Recommended:
200K
Recommended:
1M
Recommended:
8MAllocated when using
INSERT INTO ... SELECT,INSERT INTO ... VALUES (...), (...), andLOAD DATA INFILE.
read_rnd_buffer_sizeMay be allocated when reading rows in an arbitrary sequence