Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG

44
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

description

Classic Oracle DBAs are somewhat starved for the "big overview" knowledge that will make them better decision makers and less hesitant to use MySQL. The aim is to allow an existing Oracle DBA to get to grips with a MySQL environment, concentrating on the real focus points, and highlighting the similarities of both RDBMS'. And both worlds provide the necessary tools to avoid a sleepless night.

Transcript of Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG

Page 1: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Page 2: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Embracing Database Diversity:

The New Oracle / MySQL DBA

Keith Hollman

MySQL Principal Sales Consultant EMEA

Page 3: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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.

Safe Harbor Statement

Page 4: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

Today

When is it appropriate to use one or the other.

What assumptions do I have to leave behind?

What assumptions is it safe to bring forward with me?

What is a storage engine and why should I care?

What are the equivalent tools MySQL has for monitoring and backup? What are big

differences from Oracle equivalents?

What other tools work with MySQL.

And what about High Availability?

What is Carrier Grade Edition and why do you call it that? When would I use it?

What do I need to know about MySQL security?

Page 5: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Today

• Classic Oracle DBA’s & MySQL DBA’s.

• Wide ranges of Oracle solutions and doubts appear

concerning 2 of the most popular databases on the

planet.

– Main focus points.

– Similarities of both RDBMS'.

• The power of tools

– Housekeeping & how to make it easier for all.

Page 6: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Overview

MySQL Server (mysqld_safe mysqld)

• my.cnf / my.ini: datadir (db dirs, .frm, .MYD, .MYI) / socket / port / user

/ pid-file.

Starting | Stopping:

# mysql.server | /etc/init.d/mysql start | stop

Accessing:

# mysql –uroot –ppassword ([client],[mysql] options in

my.cnf)

mysql> use sakila;

mysql> show tables;

Page 7: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

One or the Other…

Page 8: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

When is it appropriate to use one or the

other.

• GPL / Opensource / LAMP stack.

• Enterprise Edition

• Speed / quick to market vs existing application complexity.

– Web-based, SaaS / Cloud, customized apps, embedded.

– High-end Enterprise Packaged apps, ERP, HRMS, CRM, etc.

• Specific use cases vs “one-size-fits-all”.

– Offload certain functionalities for specific use: Web, OLTP, BI, etc.

• TCO: Reduced / limited / unknown budget.

• Mix: ETL use of both: ODI / GG.

Page 9: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What assumptions is it safe to bring

forward with me? • Standard SQL (S/I/U/D, joins, etc.) …… sql_mode=‘ORACLE’

• OLTP VLDB, Replication & HA, memory preferred, IO fine tuning, thread conc.

• Buffers & caches, datatypes, statements & functions.

• Locks, rollbacks, redo (InnoDB), event logging.

• Hot non-blocking backup, Monitoring, Thread pool, Security, other features..

• 1 main configuration / options file.

• Data flexibility: Export / Import (5.6 RC transportable tablespaces)

• GUI Tools do exist.

• Oracle Certified Professional certification path (Dev, DBA, Cluster).

• My Oracle Support: 1-Stop for Oracle RDBMS Server & MySQL Server. … & some other “nice things to have” (dummy mode, mysqld_safe, …)

Page 10: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What assumptions do I have to leave

behind? • Controlfiles

• Listener

• Replication (X platform)

• User = Schema

• Install pre-reqs & go-live time.

• A Database instance = Database

• MySQL Databases to Server

instance is n:1 (per sw install)

• Multiple .ora’s: tnsnames, sqlnet,..

• Localizations: Charset at DB level.

• .. from DUAL;

• Commodity Hardware. Scale-out vs

scale-up.

• Lot’s of ‘tablespaces’.

• Table partitioning vs sharding & Tb

per table = Application is db-aware.

• Certified and/or Supported

platforms.

• Technical Comparison.

Page 11: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What is a Storage Engine

• Performance, Concurrency, & Locking (careful……).

• Processing model.

– Upper tier, mysqld parses & optimizes SQL in order to retrieve / store.

– Lower tier: Storage Engine dependant.

• Transparent to the end user.

– Except: Create | Alter table ENGINE option; Index types; commit/rollback.

• What IS storage engine dependent:

– Storage, transactional, locking, BnR, optimization (data retrieval/storing), special

features.

• Forks.

and why should I care?

Page 12: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What is a Storage Engine

• InnoDB (default >5.5.5)

– OLTP, Referential Integrity, Row Locking, FullText (5.6), crash recoverable, Multiple Buffers &

Caches.

• MyISAM (default <5.5.5)

– .MYD/.MYI portable files, high compression, FullText & GIS search, Fixed row format for

speed, concurrent inserts, writes precede over selects.

• MEMORY

– fast performance, .frm files on disk, fixed length rows, hash & btree indexes, table contents

temporary*, --init-file.

• NDB (Cluster)

– Specific to Cluster: HA, OLTP, replicas, partitions & fragments, server aware, etc.

• CSV, BLACKHOLE, EXAMPLE, ARCHIVE, MERGE/MRG_MYISAM...

and why should I care? Types.

Page 13: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What are the equivalent MySQL tools

• CLI: mysql, mysqladmin (..shutdown_timeout..), mysqlcheck(c,r,o,a)

mysqldump (backup), mysqlimport, innochecksum, myisam_ftdump,

myisamchk, mysqlbinlog, mysqlshow, mysqlhotcopy (MyISAM+unix)…

• Oracle Packs != MySQL Enterprise Edition Components / Tools.

• Enterprise Monitor

– Agent / Server: Query Analyzer / Replication /

• Enterprise Backup

– mysqlbackup: Any table-type / auto-locking / full, Incremental / Disk, tape /

compression / Oracle Secure Backup integration, …

• Binlog usage (D&R, Replication, auto-purging, viewing ops on a particular

database, etc.)

…for monitoring and backup?

Page 14: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What other tools work with MySQL.

• MySQL Workbench

– Server, User & Object administration.

– Reverse Engineering of Data models: GUI & Exportable.

– Utilities: Migration, Replication admin switch|fail-over (5.6 GTIDs), etc.

– Other Admin uses: diskfree, mysqlserverclone, mysqluserclone,

mysqldiff...

• Oracle VM / Oracle Linux (KSplice) HA deployment, templates, etc.

• CLI cont.: mysqlaccess, mysqlbug, mysqlslap, mysqldumpslow, mysql_zap,

mysql_convert_table_format, mysql_find_rows, mysql_fix_extensions, ..

Page 15: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What do I need to know about security?

# mysql –uroot

mysql> grant all on *.* to ‘root’@’192.168.1.1’ identified by

‘password’;

• mysql_secure_installation script.

• SSL Keys & Certificates parametrization.

• Proxy (non GA)

• Enterprise Security: PAM & External Authentication.

– LDAP integration.

• Oracle Secure Backup integration.

• MEM Security Advisor

Page 16: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

And what about High Availability?

• 5 nine’s: 99.999%

• Community:

– MySQL Replication (async & semi-sync) <> Oracle Replication

• Binlogs (Archivelogs), relay log.

– MySQL in clustered environments, heartbeats, SAN, etc.

• Enterprise

– Active–Passive: DRBD & Oracle Linux (pacemaker & corosync)

– Shared disk (o.s. cluster or virtualization)

– Replication & MySQL Utilities (GTIDs, mysqlrpladmin, switchover)

– Enterprise Monitor Replication Advisor.

– MySQL Cluster Carrier Grade Edition. Shared nothing.

Overview

Page 17: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

MySQL Carrier Grade

Edition

Page 18: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

“I came in contact with every known Indian anarchist in

London. Their bravery impressed me, but I felt that their

zeal was misguided. I felt that violence was no remedy

for India's ills, and that her civilisation required the use of

a different and higher weapon for self-protection.”

Mohandas Karamchand Gandhi, Hind Swaraj 1908.

Page 19: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

What is Carrier Grade Edition

• MySQL Cluster Enterprise Edition / “Carrier Grade” extensively used in Telco

solutions: HLR, SDP, HSS, AAA, etc.

• CGE = MySQL Cluster EE <> MySQL in Cluster

• HA measured in “nine’s”: 99.999%

• ACID compliant.

• Shared nothing / Datanodes, Replica’s, Partitions ‘n’ Fragments.

• Self healing.

• MySQL Cluster Manager arbitrators.

• Online: Please don’t use any NF until all nodes have been upgraded.

• Memcached & NDB API

• Assign core Cluster component processes to CPU ‘cores’ for speed.

Why do you call it that? When would I use it?

Page 20: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Cluster Architecture

Page 21: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Cluster Architecture

• More?

Datanodes, Replicas, Node groups, Fragments…

Page 22: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

Data Node 3

Data Node 4 - A partition is portion of a table

- Number of partitions = number of data nodes

- Horizontal partitioning

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

Automatic Data Partitioning

Page 23: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

Data Node 3

Data Node 4 A fragment is a copy of a partition

Number of fragments = # of partitions * # of replicas

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

Automatic Data Partitioning

Page 24: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

Data Node 3

Data Node 4 A fragment is a copy of a partition

Number of fragments = # of partitions * # of replicas

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 25: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1

Primary Fragment

Secondary Fragment

Data Node 3

Data Node 4 Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 26: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1

Primary Fragment

Secondary Fragment

F1

Data Node 3

Data Node 4 Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 27: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4 Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 28: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4 Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 29: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2

Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 30: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2

F2

Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 31: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2

F4 F2

4 Partitions * 2 Replicas = 8 Fragments

Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

P1

Automatic Data Partitioning

Page 32: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 33: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F3

Primary Fragment

Secondary Fragment

F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Fx

Fx

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

F1

F3

Automatic Data Partitioning

Page 34: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

- Node groups are created automatically

- # of groups = # of data nodes / # of replicas

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 35: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

As long as one data node in each node group

is running we have a complete copy of the

data

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 36: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

As long as one data node in each node group

is running we have a complete copy of the

data

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 37: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2 Fx

Fx

As long as one data node in each node group

is running we have a complete copy of the

data

Table T1

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

4 Partitions * 2 Replicas = 8 Fragments

P1

Automatic Data Partitioning

Page 38: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Table T1

Data Node 1

Data Node 2

F1 F3

Primary Fragment

Secondary Fragment

ID FirstName LastName Email Phone

P2

P3

P4

Px Partition

F3 F1

Data Node 3

Data Node 4

F2 F4

F4 F2

Node Group 1

Node Group 2

4 Partitions * 2 Replicas = 8 Fragments

Fx

Fx

- No complete copy of the data

- Cluster shutdowns

automatically

P1

Automatic Data Partitioning

Page 39: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Key Concepts • Partition

– Horizontal partitioning

– A portion of a table, each partition contains a set of rows

– Number of partitions = number of data nodes

• Fragment

– A copy of a partition

• Replica

– A complete copy

of the data

• Node Group

– Created automatically

– # of groups = # of data nodes / # of replicas

– As long as there is one data node in each

node group we have a complete copy of the data

Page 40: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Questions? [email protected]

Page 41: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

My turn to ask…

• Do you always need a storage

engine.

• What is a schema.

• How could I ‘pretend’ to use an

Oracle type db.

• What’s the equivalent of an

archivelog.

• Is MySQL open-source.

• Why would we use the

MEMORY storage engine.

• How could we simulate table

snapshots.

• Other than Cluster, what HA

solutions are there.

• What’s the difference between

Community & Enterprise.

Page 42: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Learn More

• mysql.com

- MySQL Products and Editions

- TCO calculator

- Customer use cases and success stories

• dev.mysql.com

- Downloads, Documentation

- Forums

- PlanetMySQL

• eDelivery.oracle.com

- Download and evaluate all MySQL products

Page 43: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Page 44: Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG

46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.