Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

My S Q L Introduction for 1 day training

on

  • 4,360 views

 

Statistics

Views

Total Views
4,360
Views on SlideShare
3,987
Embed Views
373

Actions

Likes
2
Downloads
177
Comments
0

19 Embeds 373

http://voicefromoldsoul.blogspot.com 190
http://www.mysqlpub.com 57
http://voicefromoldsoul.blogspot.tw 54
http://voicefromoldsoul.blogspot.jp 25
http://voicefromoldsoul.blogspot.hk 8
http://voicefromoldsoul.blogspot.in 8
http://voicefromoldsoul.blogspot.co.uk 5
http://voicefromoldsoul.blogspot.com.au 5
http://voicefromoldsoul.blogspot.de 4
http://voicefromoldsoul.blogspot.com.br 3
http://voicefromoldsoul.blogspot.ca 2
http://voicefromoldsoul.blogspot.kr 2
http://voicefromoldsoul.blogspot.ro 2
http://voicefromoldsoul.blogspot.fr 2
http://voicefromoldsoul.blogspot.cz 2
http://voicefromoldsoul.blogspot.sg 1
http://voicefromoldsoul.blogspot.pt 1
http://voicefromoldsoul.blogspot.gr 1
http://voicefromoldsoul.blogspot.com.es 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

My S Q L  Introduction for 1 day training My S Q L Introduction for 1 day training Presentation Transcript

  • 1 MySQL® for System Engineers 杜修文 ivan.tu@oracle.com http://dev.mysql.com/
  • 2 Session 1: MySQL Overview
  • 3 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor View slide
  • 4 Time For Individual Presentations! • What is your background? • Have experience using MySQL? • Have experience from other SQL – Your name and your organization dialects? – How does your organization use • Have installed MySQL yourself? MySQL? • Use MySQL under Linux? • Why are you here? Windows? Solaris? MacOSX? Other? – What do you expect from the • Use MySQL 3.21? 3.22? 3.23? course? 4.0? 4.1? 5.0? 5.1? – What do you want to learn? • Use MySQL with PHP? Perl? Java? C? ODBC? Others? • Are you MySQL Certified? Which certifications? Introduction View slide
  • 5 Established & Emerging Companies High Volume Websites – Web 2.0 – Dynamic content – eCommerce – Look to Book – Session Management – Gaming & Entertainment craigslist – Scale Out Enterprise – Data Warehousing – High-Volume OLTP – Scale Out Embedded – Software & Hardware
  • 6 Good News for MySQL! “The most important trend indicated by the study is OSS DBMS… MySQL version 5.0 was released last fall and is the first release with full SQL compliance and the necessary functionality to support full applications. Therefore, its surprising strength so soon after release shows the strong worldwide desire to begin to use OSS DBMS systems. During the next several years, this DBMS will attract much attention and contend seriously with the other DBMS engines for application platform choice.” Gartner 2006
  • 7 MySQL Database Products • Enterprise Server – Enterprise-grade database • Community Server – Database server for open source developers • Embedded Database – Database server for OEMs/ISVs to bundle cost-effectively • MySQL Cluster – Fault tolerant database clustering architecture Introduction 1.2 MySQL Products
  • 8 Legacy MySQL GUI Tools • MySQL Migration Toolkit – Migration GUI Wizard • MySQL Administrator – Administration console • MySQL Query Browser – Create databases, execute and optimize SQL queries rd • 3 party client tools – Navcat – TOAD for MySQL – phpAdmin Introduction 1.2 MySQL Products
  • 9 New MySQL Tools • MySQL Workbench – Visual database design tool – Design, manage and document databases • MySQL Proxy – A program that sits between a MySQL client and a MySQL server – Can intercept requests and responses and manipulate them with lua scripting – Applications: load balancing, monitoring and logging, query rewriting, … Introduction 1.2 MySQL Products
  • 10 MySQL Drivers • MySQL C API – libmysql: C implementation of the MySQL Client/Server protocol – Often wrapped to provide bindings for other languages • MySQL Connector/ODBC – ODBC database API on Windows and Linux (based on libmysql) • MySQL Connector/J – JDBC Driver (Pure Java implementation of the client protocol) • MySQL Connector/Net – ADO.NET access from the .NET (Pure .NET implementation of the client protocol) • MySQL Connector/PHP – mysql,mysqli, and PDO extensions (usually based on libmysql) – mysqlnd : PHP Native driver (not a PHP script), can replace libmysql in mysqli and MYSQL_PDO Introduction 1.2 MySQL Products
  • 11 Solutions for embedding MySQL • libmysqld – Embedded edition of the mysqld server program wrapped in a shared library – Allows the MySQL to be embedded in C programs • MySQL MX/J – A jar wrapper around mysqld binaries for several operating systems – Allows java programs and J2EE environments to instantiate (and install) a MySQL server Introduction 1.2 MySQL Products
  • 12 MySQL Services • MySQL Training – Comprehensive set of MySQL training courses • MySQL Certification – High quality certification for MySQL Developers and Database Administrators • MySQL Consulting – Full range of consulting services from start-up to optimization • MySQL Support – Community – Enterprise (and other levels of purchased support) Introduction 1.3 MySQL Services
  • 13 MySQL Supported Operating Systems • More than 20 platforms • Control and flexibility for users • Currently available for MySQL download: – Windows (multiple) – IBM AIX – Linux (multiple) – QNX – Solaris – Open BSD – FreeBSD – SGI Irix – Mac OS X – Source Code – HP-UX – Special Builds Introduction 1.5 Supported Operating Systems
  • 14 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor
  • 15 Installing MySQL • Use the MySQL website to download* • Several different platforms are supported • OpenSolaris used for this course – Solaris compile options – OpenSolaris development – OpenSolaris Packaging System Introduction 1.9 Installing MySQL
  • 16 MySQL Binary Distributions (1/2) • Available for several operating systems • Precompiled programs • Windows – Essentials – Complete with Configuration Wizard – No-install • Linux – RPM files – Tar files • Solaris – PKG files – Tar files The MySQL Server 3.1 Types of Distributions
  • 17 MySQL Binary Distributions (2/2) • Advantages with binary distributions – Good selecting config options – High quality commercial compilers – Provided with extensive libraries • Solaris binaries – Sun internal ahead of MySQL practice • Using gccfss for SPARC builds • SunStudio 12 on Solaris & OpenSolaris – MySQL Support supports all equally The MySQL Server 3.1 Types of Distributions
  • 18 Installing from ipkg System • Find standard binaries pfexec pkg search -r mysql pfexec pkg install SUNWmysql5
  • 19 Installation on Solaris  Solaris download is about 60 MB from mysql.com  Installation: groupadd mysql useradd -g mysql mysql pkgadd -d package_name.pkg
  • 20 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor
  • 21 MySQL Configuration (1/2) • Option files as an alternate to command line – MySQL client programs look for option files at startup – Saves time and effort • Default is to use pre-compiled values • Reset defaults at runtime – Many options specify locations of important directories and files – Options control log file usage – Override performance-related variables – Enable/disable pre-compiled storage engines The MySQL Server 3.5 MySQL Configuration
  • 22 MySQL Configuration (2/2) • Specify runtime options at server startup – Changes configuration • Find out what options the server supports shell> mysqld --verbose --help – Listed options can be specified on the command line or in an option file The MySQL Server 3.5 MySQL Configuration
  • 23 Log and Status Files (1/2) • MySQL can write to several types of logs – Error log • syslog: mysqld_safe options – --syslog[=tag] – --skip-syslog (default) – General Query log – Slow Query log – Binary log • Used to assess operational status of server The MySQL Server 3.8 Log and Status Files
  • 24 Log and Status Files (2/2) • Log files can take up large amounts of space • Can be stored in files or tables • Recommended strategy for use – Initially enable the binary and slow query logs – If server is not running as intended, enable general log to debug • Logs written in text format – Except binary log The MySQL Server 3.8 Log and Status Files
  • 25 Status Files • Server creates several status files • Some in data directory, some not • Records server process ID in PID file – host_name.pid – --pid-file=file_name • Linux servers create socket file for connections The MySQL Server 3.8 Log and Status Files
  • 26 Installing the World database • Download the scripts from the web site • Logon mysql • Create world database CREATE DATABASE world; • Create world user GRANT ALL on world.* to 'worlduser'@'localhost' IDENTIFIED BY 'worldpass'; • Import SQL file from the command line mysql -u worlduser -pworldpass world < world.sql
  • 27 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor
  • 28 Starting mysqld with option log-bin • mysqld –log-bin=<base-binlog-file-name> • my.cnf – log-bin=<base-binlog-file-name>
  • 29 Log format • Assigned in mysqld option – binlog-format=mixed[5.1.12~5.1.28]|row|statement[~5.1.11,5.1.29~] • Mixed format – switching from statement to row under the following conditions: • When a DML statement updates an NDBCLUSTER table. • When a function contains UUID(). • When 2 or more tables with AUTO_INCREMENT columns are updated. • When any INSERT DELAYED is executed. • When the body of a view requires row-based replication, the statement creating the view also uses it — ex: when the statement creating a view uses the UUID() function. • When a call to a UDF is involved. • If a statement is logged by row and the client that executed the statement has any temporary tables, logging by row is used for all subsequent statements until all temporary tables in use by that client are dropped.
  • 30 mysqlbinlog utility • Convert binlog into plan text (SQL commands - statement based or rows change row based) • Mysqlbinlog [options] <binlog-files> (files can be assigned with regular expression • Can access binlog on remote server with –read-from-remote-server option and -h <hostname> -P <port#> -u <username> -p <password> • Some useful options – --start-datetime=<datetime>, --stop-datetime=<datetime> – --start-position=<position>, --stop-position=<position> – --offset=# – -d <database-name> – --server-id=# – --help
  • 31 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor
  • 32 Planning for MySQL Recovery and Backup (1/3) • Suggest that you focus on recovery requirements • Recovery Time Objective (RTO) – If a failure occurs how much time can you afford for recovery – If very little time then combine your backups with other facilities (NDB clusters, etc.) • Recovery Point Objective (RPO) – If a failure occurs at what point in time should you be able to recover the data? – Pay attention to granularity of RPO – Drives when and how often you take your backups Backup and Recovery 12.2 Planning for Recovery and Backup
  • 33 Planning for MySQL Recovery and Backup (2/3) • Backup window – The amount of time your MySQL applications can afford to be offline or degraded – Some backup methods make MySQL databases totally unavailable – Other make the database unavailable for update – Still others have very minimal impact on the MySQL databases and applications • Maintain referential integrity – Backup all the items needed to do this • Location of backup – Get backups as far away from the original data as possible! Backup and Recovery 12.2 Planning for Recovery and Backup
  • 34 Planning for MySQL Recovery and Backup (3/3) • Automation – Backups do little good if they are not taken consistently and regularly – Relying on human intervention should be avoided • Tracking and reporting – Backups do you no good if you can’t find them when you need them Backup and Recovery 12.2 Planning for Recovery and Backup
  • 35 Introduction to MySQL Backup Types • Logical (Textual representation: SQL statements) • Physical (Binary copy of data files) • Snapshot-based • Replication-based • Incremental (binary log flushed) Backup and Recovery 12.3 Introduction to MySQL Backup Types
  • 36 Logical (Textual) Backups (1/2) • MySQL databases and tables converted to SQL statements in a text file • Portable – To a different MySQL server – Different architecture (e.g. Intel to Sparc. Portable as long as both platforms support Two’s complement arithmetic and IEEE floating point math) – Different database engine (e.g. MyISAM to InnoDB. However not all storage engines support all features) • MySQL server must be running during logical backup • Can backup both local and remote MySQL servers Backup and Recovery 12.3 Introduction to MySQL Backup Types
  • 37 Backup Tools Overview (1/2) • Can use SQL statements for logical backups • Can use SQL statements combined with operating system commands for raw backup • Other raw backup tools for MySQL – mysqlhotcopy for MyISAM • Perl script – requires additional setup on Windows • Command line – requires you to automate • No tracking or reporting – Many third-party backup tools/GUI’s available • InnoDB Hot Backup for InnoDB • Zmanda Recovery Manager backup GUI Backup and Recovery 12.4 Backup Tools Overview
  • 38 Backup Tools Overview (2/2) • Other logical backup tools – mysqldump • Command line – requires you to automate it • No tracking or reporting – MySQL Administrator • Provides automation • Minimal tracking and reporting Backup and Recovery 12.4 Backup Tools Overview
  • 39 Impact on Database Availability • High impact on availability – Taking MySQL down during backup – mysqldump and mysqlhotcopy both make database unavailable at some level • Options for less impact – Use snapshots • Implies (brief) unavailability in order to run FLUSH TABLES WITH READ LOCK (waits for all queries to complete) – Use replication slave – master totally available during backup – For InnoDB engine use InnoDB Hot Backup Backup and Recovery 12.4 Backup Tools Overview
  • 40 Making Raw MyISAM Backups • Copy files used to represent table • Table cannot be accessed by others during copy • Backup procedure 1. Lock table to copy while server is running USE world; LOCK TABLES Country READ; FLUSH TABLES Country; 2. Perform copy 3. Start a new binary log file FLUSH LOGS; 4. Release lock after copy UNLOCK TABLES; • Recover a MyISAM table from binary backup Backup and Recovery 12.5 Making Raw Backups
  • 41 Making Raw InnoDB Backups (1/3) • Makes exact copy of all files used to manage tablespace • Linux copy example: – Logfiles #cp /usr/local/mysql/data/ib_logfile* /var/backup/ – Datafiles #cp /usr/local/mysql/data/ibdata* /var/backup/ –.frm files (table definitions) #cp /usr/local/mysql/data/world/*.frm  /var/backup/ – configuration file #cp /etc/mysql/my.cnf /var/backup/my.cnf Backup and Recovery 12.5 Making Raw Backups
  • 42 Making Raw InnoDB Backups (2/3) • Procedure for making binary backup 1. Stop server 2. Confirm proper shutdown 3. Copy all necessary components 4. Restart server Backup and Recovery 12.5 Making Raw Backups
  • 43 Making Raw InnoDB Backups (3/3) • Can also use InnoDB Hot backup program • Recover a InnoDB table from binary backup • Alternative method is to use mysqldump Backup and Recovery 12.5 Making Raw Backups
  • 44 Other Raw Backup Tools (1/3) • Special purpose programs • mysqlhotcopy script – Example shell> mysqlhotcopy world /var/archive Locked 3 tables in 0 seconds. Flushed tables ... in 0 seconds. Copying 10 files... Copying indices for 0 files... Unlocked tables. mysqlhotcopy copied 3 tables (10 files) in 0 seconds ... – Two relevant options --flushlog --record_log_pos=<db_name>.<tbl_name> Backup and Recovery 12.5 Making Raw Backups
  • 45 Other Raw Backup Tools (2/3) • InnoDB Hot Backup – ibbackup • Conditions for binary portability – Important for taking a backup from one system to another – Can copy MyISAM table files and InnoDB tablespace files from one system to another and retain access – Two’s complement integer arithmetic required on both machines – IEEE floating point math required on both machines Backup and Recovery 12.5 Making Raw Backups
  • 46 Other Raw Backup Tools (3/3) • Third condition for InnoDB binary portability – Should use lowercase names for databases and tables • To force lowercase usage use an option file statement [mysqld] lower_case_table_names=1 • Can configure InnoDB to use per-table tablespace • If conditions are not met, can dump to a text file Backup and Recovery 12.5 Making Raw Backups
  • 47 Logical Backups with mysqldump (1/2) • Dumps table contents to files • Characteristics – Dumps all databases, specific databases, or specific tables – Can back up local or remote servers – Works for tables created from any storage engine – Output is portable text format – Dumps full structure – Excellent as a copy/move strategy – Good for small exports, not efficient as professional backup strategy • Syntax for backing up a database mysqldump --tab=/path/to/some/dir --opt db_name Backup and Recovery 12.6 Making Logical Backups
  • 48 Logical Backups with mysqldump (2/2) • Two important factors to consider when using mysqldump for backups – Making sure it is a consistent backup – Synchronizing backup with binary log • Understands the standard connection parameter options and specific dump control options • Many useful mysqldump options available, especially the following... --flush-logs --master-data --lock-tables --single-transaction Backup and Recovery 12.6 Making Logical Backups
  • 49 Logical Backups with MySQL Administrator • GUI provides backup and restore capabilities • Similar to mysqldump output • Stores backup configuration as projects Backup and Recovery 12.6 Making Logical Backups
  • 50 Backing Up Log and Status Files • Can use normal file system operation – Static files require no special precautions – Dynamic files should be backed up with server stopped • Additional static files to backup – my.cnf – my.ini – Software binaries and libraries • Additional dynamic files to backup – Binary log files – master.info – relay-log.info – SQL_LOAD-% files (replicated LOAD DATA INFILE statements) Backup and Recovery 12.7 Backing Up Log and Status Files
  • 51 Replication as an Aid to Backup • When MySQL server acts as master, you can use the slave to make backups 1. Stop server 2. Make backup of slave’s database 3. Restart server • Advantage to not conducting backup on master Backup and Recovery 12.8 Replication as an Aid to Backup
  • 52 Backup Method Summary Hot/Warm Storage Logical / Method Cold Engines Physical Consistent Availability SQL Statements warm all logical no free mysqldump warm all logical yes free OS Copy commands cold or warm all physical yes free mysqlhotcopy warm MyISAM physical yes free MySQL Administrator warm all logical yes free logical or Using Replication hot all physical yes free need snapshot volume or Using Snapshots hot all physical yes filesystem InnoDB Hot Backup * hot InnoDB physical yes commercial mysqldump hot InnoDB logical yes free Backup and Recovery 12.9 Backup Method Summary
  • 53 Data Recovery • Recovers data that changed since the last backup • General recovery procedure 1. Copy data directory 2. Recover database using the backup 3. Re-execute the changes in the binary log Backup and Recovery 12.10 Data Recovery
  • 54 Processing Binary Log Contents (1/2) • Process data changes after reloading backup file • Use mysqlbinlog program • Best when logs are written entirely before or after backup – For example, if logs written before the backup are 1-49, and 50-52 after the backup ... mysqlbinlog bin.000050 bin.000051 bin.000052 | mysql Backup and Recovery 12.10 Data Recovery
  • 55 Processing Binary Log Contents (2/2) • Reasons for using partial-file-only extraction – If binary log was in the middle of being written during backup – If user accidentally drops or corrupts data • Partial file extraction performed with these options: – --start-datetime - to specify a date and time to begin/end – --start-position - to specify a log position to being – --stop-position - to specify a log position to end • Example mysqlbinlog --start-position=23456 binlog.000004 | mysql -uroot -p Backup and Recovery 12.10 Data Recovery
  • 56 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor
  • 57 Basic Architecture MySQL Replication 3.2 Basic Architecture
  • 58 Binary Logging (1/5) • Log-shipping replication solution – Use the --log-bin option • Binary log rotation: – The MySQL Server is restarted – The maximum allowed size is reached (max_binlog_size) – A FLUSH LOGS SQL command is issued • Deleting Log Files mysql> SET GLOBAL expire_logs_days = 1; mysql> PURGE MASTER LOGS BEFORE now() - interval 3 day; MySQL Replication 3.3 Binary Logging
  • 59 Binary Logging (2/5) • Storage Engine Independent • Compact Binary Format shell> mysqlbinlog host-bin.000001 host-bin.000002 • Coordinate System – Identifies events – Includes the binary log file name and the byte offset – SHOW MASTER LOGS MySQL Replication 3.3 Binary Logging
  • 60 Binary Logging (3/5) • Statement Based Binary Logging – Contains the actual SQL statements – Includes both DDL (CREATE, DROP, etc...) and DML (UPDATE, DELETE, etc...) statements – Advantage • Smaller Size – Disadvantages • Replicating on different machine • Required to replicate all tables and columns involved in queries MySQL Replication 3.3.1 Statement Based Binary Logging
  • 61 Binary Logging (4/5) • Row Based Binary Logging – Replication takes place at the row level – Data change itself is replicated – binlog_format variable SET [GLOBAL|SESSION] BINLOG_FORMAT=[row|statement| mixed|default]; MySQL Replication 3.3.2 Row Based Binary Logging
  • 62 Binary Logging (5/5) Statement Based Row Based Size of Log Files Smaller Log Files Larger Log Files Not all statements can be Everything can be Replication Limitations replicated replicated Upgrading is always A slave can be a newer possible Master/Slaves MySQL version with a different row Versions Slave can have fewer or structure more columns than master INSERT ... SELECT Same number of locks on Locking require a greater number of slaves for INSERT, row locks UPDATE and DELETE Point-in-Time Recovery Yes Yes MySQL Replication
  • 63 Replication Threads / Files • Replication Threads – IO_THREAD – SQL_THREAD • Replication Files – Relay Log Set – Control Information Files • master.info – Relay Log Files • Relay-log.info MySQL Replication 3.4 Replication Threads and Files
  • 64 Setting up MySQL Replication • Master Server – Turn on the binary log – Set the server-id to be a unique number – Create a new user with REPLICATION SLAVE privilege – Create a backup of the master • Slave Server – Set the server-id to be a unique number – Load in the backup from the master – Setup the binary log coordinates using the CHANGE MASTER TO command – Tell the slave where the master resides using the CHANGE MASTER TO command – Start replication with SLAVE START MySQL Replication 3.5 Setting up MySQL Replication
  • 65 CHANGE MASTER TO • Specifics on how to connect to the master and where to start replicating from CHANGE MASTER TO MASTER_HOST = 'host_name', MASTER_USER = 'user_name', MASTER_PASSWORD = 'password', MASTER_PORT = port_num, MASTER_LOG_FILE = 'master_log_name', MASTER_LOG_POS = master_log_pos MySQL Replication 3.5 Setting up MySQL Replication
  • 66 Monitoring MySQL Replication (1/2) mysql> SHOW SLAVE STATUSG ******************* 1. row ******************* Slave_IO_State: Waiting for master ... ... Master_Log_File: gbichot-bin.005 Read_Master_Log_Pos: 79 ... Relay_Master_Log_File: gbichot-bin.005 Slave_IO_Running: Yes Slave_SQL_Running: Yes ... Exec_Master_Log_Pos: 79 ... Seconds_Behind_Master: 8 MySQL Replication 3.6 Monitor MySQL Replication
  • 67 Monitoring MySQL Replication (2/2) • Slave_*_Running – Slave_IO_Running – Slave_SQL_Running • Seconds_Behind_Master • Master_Log – Master_Log_File – Read_Master_Log_Pos – Relay_Master_Log_File – Exec_Master_Log_Pos MySQL Replication 3.6 Monitor MySQL Replication
  • 68 Error Log • Replication issues will normally output messages in the Error Log [ERROR] Slave I/O thread: error connecting to master 'repl@192.168.7.11:3306': Error: 'Can not connect to MySQL server on '192.168.7.11' (13)' errno: 2003 retry-time: 60 retries: 86400 MySQL Replication 3.6.1 Error Log
  • 69 Replication Slave I/O Thread States (1/2) • Connecting to master • Checking master version • Registering slave on master • Requesting binlog dump • Waiting to reconnect after a failed binlog dump request • Reconnecting after a failed binlog dump request MySQL Replication
  • 70 Replication Slave I/O Thread States (2/2) • Waiting for master to send event • Queueing master event to the relay log • Waiting to reconnect after a failed master event read • Reconnecting after a failed master event read • Waiting for the slave SQL thread to free enough relay log space • Waiting for slave mutex on exit MySQL Replication
  • 71 Replication Slave SQL Thread States • Reading event from the relay log • Has read all relay log; waiting for the slave I/O thread to update it • Waiting for slave mutex on exit MySQL Replication 3.6.3 Replication Slave SQL Thread States
  • 72 Advantages/Disadvantages • Advantages – Simple to set up – Included as part of MySQL – Stable- supported in MySQL for many years/versions – Secure - SLAVES can connect to MASTER with SSL – Ability to access multiple servers • Disadvantages – Potential loss of data due to asynchronous replication. – Fail-over is handled manually by applications – MASTER can become the bottleneck – application load balancing – No multi-source capabilities MySQL Replication
  • 73 Replication Optimization (1/3) • Different Storage Engines – Common setup • Master use InnoDB for the transactional capabilities • Slaves use MyISAM for faster querying speed – No storage engine specifics (ex. Foreign Keys) – Locking issues can lead to slave bottlenecks – Blackhole • Discards all data changes • Relay Slave MySQL Replication 3.10.1 Different Storage Engines
  • 74 Replication Optimization (2/3) • Different Startup Variables – Slave process write statements in a faster manner • delay_key_write (MyISAM) • innodb_flush_log_at_trx_commit (InnoDB) – Replication reliability • sync_binlog – Forces the binary logs to be synchronized to disk upon statement completion – Binary logs will not be able to be written in batches MySQL Replication 3.10.2 Different Startup Variables
  • 75 Replication Optimization (3/3) • Different Logical Structure – Different Indexing Setup on Master and Slaves • Different Hardware – Master • RAID 1+0 – Slaves • RAID 5 or RAID 0 MySQL Replication 3.10.3 Different Logical Structure / 3.10.4 Different Hardware
  • 76 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor
  • 77 MySQL Enterprise • MySQL Enterprise Server • Monthly Rapid Updates Server • Quarterly Service Packs • Hot Fix Program • Extended End-of-Life • Global Monitoring of All Servers • Web-Based Central Console • Built-in Advisors, Expert Advice Monitor • MySQL Query Analyzer • Specialized Scale-Out Help •自動為查 詢和圖示建立關係 詢和圖示建立關係 • 24 x 7 x 365 Production Support • Web-Based Knowledge Base Support • Consultative Help • Bug Escalation Program ● 新的 Monitor Installation Advantage 服務
  • 78 Support, Consulting, Training • Self-help support service > Online knowledge base • Problem-resolution service > Seasoned support team > 24x7 email/phone access • Consulting services > Optimization and tuning services > Architecture & code review services > Remote troubleshooting and DBA services • On-site and public training > DBA and developer training > Workshops on performance tuning
  • 79 Subscription Level Value to Customer Platinum Gold + Gold Silver + • Higher SLA than Gold • Performance Silver • 24/7 Support Advisor Basic + • Enterprise Server • Schema Advisor Advanced • Partitioning Review (Partitioning) • Optimizes/Tunes  Business Hour • Query Analyzer • Custom Phone Support • Replication Monitor Queries  Enterprise Monitor • Replication Advisor • Database Basic  Proactive • Memory Usage Design Notifications Advisor • Custom Code  2 Incidents via email  Expert Advice • Rapid Problem support  Optimizes MySQL Resolution  Enterprise Server Pro Configuration • (Hot Fix builds) (Transactions) settings  Ensures  Ensures Uptime/Reliability Recoverability  Regular Service Packs  Tightens Security  Self-help Support  Extends Support
  • 80 MySQL Enterprise Unlimited • Fixed Annual Subscription: MySQL > Unlimited Servers Enterprise > Unlimited CPUs Unlimited > Unlimited Cores $40,000 • Simplify > No Counting > No Compliance Issues • Eliminate > No proprietary RBBMS license fees
  • 81 Session 1 MySQL Overview ● Introduction to MySQL ● Install/Use MySQL ● Configure MySQL ● MySQL binlog ● Backup and Recover MySQL ● Master/Slave Replication ● MySQL Enterprise ● MySQL Enterprise Monitor
  • 82 Query Anlyzer 的改善 效果 - 視覺化查 看 SQL 指令和系統負荷的關連,以節省找出 看 耗用資源多的查 詢 的 時 間 。 詢的時間。
  • 83 錯誤警示 用途 - 協助您找出以前無從偵測到的失敗或傳回錯誤結果 的查 詢 。 詢。
  • 84 Query Analyzer 以圖形化使用者介面支援 EXPLAIN 産生的門檻時間 用途 - 可對單一或一組資料庫更有彈性且細緻的控制 EXPLAIN 之産生
  • 85 在線放入産品更新 / 警示,支持服務 用途 - 提供單一,基於網路的主控台以進行監控 MySQL 産品更新和追踪支持狀態。
  • 86 連線放入産品支持問題警示
  • 87 Advisor, Rule And Graph Administration Security Upgrade Custom • Monitors and Advises • Monitors and • Monitors and Advises • Built by DBA to on Optimal Advises on Bugs that affect Enforce Organization Configuration and Unplanned Security current installation specific best practices. Variable Settings Changes • Provides update path • Create New or Tailor • Ensures • Uncovers Security to correcting MySQL Advisors to fit Recoverability loopholes MRU/QSP needs. Replication Memory Schema Performance Usage • Monitors and Advises • Monitors and Advises • Monitors and Advises on Master/Slave • Monitors for optimal on Unplanned Schema on Optimal Latency Issues use of memory/cache Change Performance Variable • Makes suggestions • Advises on memory • Uncovers Security Settings for improving tuning for better loopholes • Identifies performance replication design performance bottlenecks 超過 130 個的規則 (7 個新的 ), 30 個以上的 (6 個新的 ) 圖示 用途 - 節省撰寫,佈署,版本控制,維護角本的時間。 找出無法自行發掘的問題及調整的機會。
  • 88 Advisor Administration Advisor 現在可監看 : • 未開啟 的 5.1 Event 的 Schedule • 重啟 的 MySQL 的 Server
  • 89 Graph 銀級 : • 連線 - 最大量 金級 : • MyISAM Key Buffer 的使用 白金級 : • Table Lock Wait 比例 • InnoDB Adaptive Hash Index Memory • InnoDB Adaptive Hash Index Searches • InnoDB Adaptive Hash Index Usage
  • 90 Support Services Customer Individual • 詳細的文件和指引 Servers Datacenter • 以在線 / 郵電 / 電話 w/Agent 的方式按步驟協助 支持 Master-Slave Replication • 支持團隊提供遠程 安裝 / 設定服務 Repository Installation Advantage Service 用途 ? 為 Query Analyzer 和 Monitor 提供最短的路徑。