+ All Categories
Home > Documents > MySQL Administration and Management

MySQL Administration and Management

Date post: 16-Sep-2018
Category:
Upload: ngotuyen
View: 230 times
Download: 1 times
Share this document with a friend
53
<Insert Picture Here> Craig Sylvester MySQL Sales Consultant MySQL Administration and Management Essentials 1 Monday, August 15, 2011
Transcript

<Insert Picture Here>

Craig SylvesterMySQL Sales Consultant

MySQL Administration and Management Essentials

1Monday, August 15, 2011

Safe Harbor Statement

The following is intended to outline our general product

direction. It is intended for information purposes only, and

may not be incorporated into any contract. It is not a

commitment to deliver any material, code, or functionality,

and should not be relied upon in making purchasing

decision. The development, release, and timing of any

features or functionality described for Oracle’s products

remains at the sole discretion of Oracle.

2Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Tool Categories for DBAs/Admins

• Basic Command Lines• Internal Schemas / Scripts• GUIs for rapid design, development,

admin• Backup and Recovery • Monitoring and Management• Performance and Stress Testing

3Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Basic Command Lines

4Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL “Client Programs”

http://dev.mysql.com/doc/refman/5.5/en/programs-client.html

mysql Mysql command line/shell for SQL statements

mysqladmin Performing administrative operations. You can use it to check the server's configuration and current status, to create and drop databases, and more

mysqlcheck Performs table maintenance: It checks, repairs, optimizes, or analyzes tables

mysqldump Used to export a database(s) for backup or transfer to another server. The dump contains SQL statements to create tables, populate it with data, or both. Can also generate files in CSV, delimited text, or XML format.

mysqlimport Command-line interface to the LOAD DATA INFILE SQL statement..

mysqlshow Shows databases, their tables, or a table's columns or indexes.

mysqlslap A diagnostic program designed to emulate client load for a MySQL server and to report the timing of each stage. It works as if multiple clients are accessing the server.

5Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Startup Programs

mysqld The mysql daemonmysqld_safe Script - recommended way to start on Unix.

Starts angel process for mysqld daemon.mysql.server Used on systems (Linux and Solaris) that use

System V-style run directories to start and stop system services. Also used by the Mac OS X

mysqld_multi Manage Multiple MySQL Servers running on different ports or sockets

http://dev.mysql.com/doc/refman/5.5/en/programs-server.html

6Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Internal Schemas / Scripts

7Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Information_Schema

ANSI SQL (SQL:2003) - a method of accessing database metadata

Views that allow you to look at the description of your database objects

http://dev.mysql.com/doc/refman/5.5/en/information-schema.html

8Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Performance_Schema

• Used to monitor low level events- Inspect internal execution of the server at runtime

• Collects data using “instrumentation points” in the server source code.

• This data is stored in tables in the performance_schema database.

• “Activate” performance_schema to collect data

- Add performance_schema to my.cnf file

http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html

9Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Workbench

The Official MySQL GUI ApplicationCombines Three Major Feature Sets in One ToolCross platform and Native UI (Windows, Linux, Mac OS X)

10Monday, August 15, 2011

SQL Editor - Color Syntax Highlighting Object Management - Import/Export, Browser and EditConnection Management - Wizard, Concurrent, SSHMulti-Pane Results View, In-grid data edits

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Workbench - Development

11Monday, August 15, 2011

Visual Design - Create and Manage ModelsForward/Reverse EngineerCompare and Synchronize SchemasChange Management and Documentation

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Workbench - Modeling

12Monday, August 15, 2011

Full listing of server and status variablesConfiguration, Start/Stop, ReplicationUsers, Security, and Session Management

- Roles supportImport/Export Dump Files

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Workbench - Administration

13Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Workbench - Utilitiesmysqldbcopy Copy databases between servers.

mysqldbexport Export databases to a file in different formats: SQL, CSV, and tab-separated files (and more).

mysqldbimport Import object definitions and/or data from a file—in different formats into a database.

mysqlindexcheck Check for redundant/duplicate indexes on a list of tables or databases. Can generate DROP statements to remove redundant indexes.

mysqlmetagrep Search MySQL servers for objects containing fields matching a pattern.

mysqlprocgrep Search MySQL servers for processes matching a pattern and perform actions.

mysqlreplicate Setup replication between two servers.

mysqlserverclone Start a new instance of a server to experiment with. This is used to test the utilities, but can be used whenever you need to set up a scratch server to test something.

mysqluserclone Copy a MySQL user to one or more new users on another server

http://wb.mysql.com/utilities/index.htmlAnd more coming soon. Contribute your own.

14Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL WorkbenchStandard Edition

(next page)

15Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL WorkbenchStandard Edition

16Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL WorkbenchStandard Edition

Model ValidationGeneral Schema Validation

MySQL Specific Schema Validation- Integrity- Syntax- Duplicated identifiers

17Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Backup and Recovery

18Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

DBA Challenge

Core responsibility for backup and recoveryBut, its not easy

Databases are growing exponentiallyBackup times are increasing even faster

Your Backups impact other activitiesEnd UsersDBA Maintenance

And your storage costs are out of controlAnd when bad things happen

Needs to workTaking forever to recover

19Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Database Backup Types Advantages & Disadvantages

20Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Backup Tools

• Hot Backup (online)- MySQL Enterprise Backup - mysqlbackup

• Export/Import (a logical backup)- mysqldump

• Standby Copy (hot swap)- MySQL Replication

• Cold Backup (offline)- Simple File Copies when server is shutdown

• File System Volume Managers (snapshots)- LVM for example

21Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

mysqldump

• Advantages- Good for small databases or tables- Good assurance that database files are not corrupt - Logical Backup – thus flexible and portable

• Disadvantages- Very slow restore times- Uses database processing cycles and resources- Not online (requires Transaction or Locks on Tables

in the database)- Not incremental (requires a Full Backup every time)- Not consistent (unless transaction is used)

22Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Replication

• Advantages- Rolling “snapshot”- Quick Recovery - via failover- Non-Blocking- Works well in conjunction with other backup options

• Disadvantages- Only latest “Point in Time” (point it time keeps

moving forward)- Not historical- Not for archival purposes- Doesn’t protect from “oops”

23Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

LVM Snapshots

• Advantages- Quick- Feature of Linux- Good to use in conjunction with backups

• Disadvantages- It’s a snapshot

• Still need to make a backup copy – which is “full” in size

- Performance degrades with each concurrent snapshot• Snapshots need to be released

- Cross File System Limitations

24Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Enterprise Backup

• Advantages- Physical Backup (so it’s fast – esp. restores)- Flexible - many options - Archival- Scalable- Consistent- Supported

• Disadvantages- Requires some planning

25Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Enterprise Backup

• Online Backup for MySQL databases• High Performance• Full, Incremental, Partial Backups

- Compressed Tables- Partition files- In-memory database

• Compression• Point in Time Recovery• Metadata on status, progress, history• Unlimited Database Size• Streaming, single file support

- Backup to tape device

MEB BackupFiles

MySQL Database Files

mysqlbackup

26Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Monitoring and Management

27Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Enterprise Monitor

Consolidated view

Enterprise Support• SNMP

• LDAP

• Customizable

Query Analysis with Correlation Graphs

28Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Management Reporters

DBAs/Administrators

MEM Agents

MEM Agents

MEM Server

Stand alonedatabases

Replicationdatabases

ClusterServers

Enterprise Monitor Deployment

29Monday, August 15, 2011

MySQL Expert Advisors

150+ Rules

50+ MySQL/OS specific Graphs

30Monday, August 15, 2011

MySQL Expert Advisors - Upgrade Details

31Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

• Auto-detects, groups & maintains Master/Slave topologies

• Consolidated, real time status/synch check

• Notifications on Synch Issues

Automated Replication Monitor

32Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

EM - Query Analyzer

33Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Query Execution Drill Downs

Explain Plan

Example query with variable substitution

Trace query exec back to source code

34Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Example of adding a custom advisor (or rule)

35Monday, August 15, 2011

Enterprise Monitor - Create New Rule

36Monday, August 15, 2011

Enterprise Monitor - Copy Existing Rule

37Monday, August 15, 2011

Enterprise Monitor - Copy Existing Rule

38Monday, August 15, 2011

Enterprise Monitor - Copy Existing Rule

39Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Let’s generate some events(we’ll use Workbench)

40Monday, August 15, 2011

Workbench - Create Table

41Monday, August 15, 2011

Enterprise Monitor - Check Events

42Monday, August 15, 2011

Enterprise Monitor - Check Event Details

43Monday, August 15, 2011

Enterprise Monitor - Query Analyzer

Here are the CREATE TABLE

details

44Monday, August 15, 2011

Workbench - Create User

45Monday, August 15, 2011

Enterprise Monitor - Check Events

Select the Group from Servers browserand filter on Rules

46Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Query Analysis thru Agent Proxy

47Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

MySQL Database

(SQL statements & result sets)

1. MySQL Enterprise Monitor & Query Analyzer2. MySQL Agent3. Connector/NET (v6.2+) or Connector/J (v5.1+)4. MySQL Enterprise Plugin for Connector

List of components to download & configure:

(MySQL & OS monitoring

data)

3. Connector

Query Analysis thru .NET or Java

4. Plugin for Connector

(SQL performance data: statements, examples, EXPLAINs, aggregated

stats)

3306

18080

2. MySQL Agent

1. MySQL Enterprise Monitor (Service Manager, Dashboard)‏

Application Server

48Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Query Analysis thru Aggregator

PHP and C connectors - release candidates

available

49Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Performance and Stress Testing

50Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Performance/Stress Testing

• Sysbench- http://sysbench.sourceforge.net/

• DBT-2- Like OLTP benchmark- Very popular with many MySQL users- http://samurai-mysql.blogspot.com/2009/03/

settingup-dbt-2.html

51Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

Additional Resources

• https://edelivery.oracle.com/- Download Enterprise Monitor, Enterprise Backup,

other tools- Download MySQL database

• https://mysql.com- Info on MySQL Products, Editions, Licensing options- TCO calculator

• https://dev.mysql.com- Documentation- Developer Zone Articles, How to’s

52Monday, August 15, 2011

© 2011 Oracle Corporation – Proprietary and Confidential

53Monday, August 15, 2011


Recommended