MySQL DBA
-
Upload
lalit-choudhary -
Category
Technology
-
view
76 -
download
0
Transcript of MySQL DBA
MySQL Database Administration Best PracticesLalit Choudhary
Agenda
▪Database design and Planning▪MySQL Installation and
Configuration ▪Optimization▪ Replication▪Backup and Monitoring▪Q&A
Database design and planning● Outlining the functional specifications.
− Considering Application Workflow − Table Structure and Naming conventions − Workbench ERD
● Scope and Flexibility of database design.− Easy to extend− Capability to Handle large volume of data−
● ●
MySQL Installation and Configuration● Ways to install MySQL
− Source code− Binaries− Packages− MySQL Installer MSI and ZIP Archive− Yum repository
● Configuration− Storage engine− Variables − User management and Access control
●
Optimization
● Hardware− Storage and file types : SSD/HDD and EXT4 or XFS
on Linux− Memory : Optimal performance,Large
transaction,indexes,faster response time for ongoing changes and utilize Disk IO
− CPU : Faster processors with many cores provide better throughput
Optimization
● Software− Configuration
● innodb_file_per_table● innodb_buffer_pool_size● innodb_buffer_pool_instances● innodb_log_file_size● innodb_flush_log_at_trx_commit● innodb_thread_concurrency● innodb_flush_method
Optimization
● Query Optimization− indexes
● Replication − Read write Load Balancing
Replication
● Replication Components − MASTER : Binary log dump Thread(s)− SLAVE : Replication Threads − Binary Logs : SBR/RBR/Mixed − Relay Logs− Information files
Replication ● Important variables and configuration
− Master● server_id● log_bin● binlog_format● binlog_row_query_log_event● binlog-do-db● binlog-ignore-db
Replication
● slave● server_id● log_bin● binlog_format● log_slave_updates● relay_log=file_name ● replicate-do-db=db_name● replicate-ignore-db=db_name● replicate_wild_do_table● replicate_wild_ignore_table
Replication● Best practices
− Enable binary logs on slave● log_bin● log-slave-update● expire_log_days
− Crash-safe slaves ● master-info-repository=TABLE● Relay-log-info-repository=TABLE● Relay-log-recovery
− Secure slave● read-only● Skip-slave-start
− Avoid replication Lag ● slave_compressed_protocol● MTR replication
Replication● With and without GTID
● Need Master_Log_File and Master_Log_Pos● GTID
− What problems GTID solves?● It is possible to identify a transaction uniquely across the
replication servers. Make the automation of failover process much easier. There is no need to do calculations, inspect the binary log and so on. Just MASTER_AUTO_POSITION=1.
● − Enable GTID replication
● gtid_mode: It can be ON or OFF (not 1 or 0). It enables the GTID on the server.
● log_bin: Enable binary logs. Mandatory to create a replication environment.
● log-slave-updates: Slave servers must log the changes that comes from the master in its own binary log.
● Enforce-gtid-consistency : Statements that can’t be logged in a transactionally safe manner are denied by the server.

 \\\
Backup and Monitoring● Binary Backup
− MySQL Enterprise Backup ● Logical Backup
− mysqldump● Hot Backup
− Replication slave● Customized scripts
Backup and Monitoring
● Monitoring and statistics − SHOW PROCESSLIST− System databases − Enterprise Monitoring(MEM)− MySQL Utilities− Audit logs & General logs−
Thank you!