Successfully reported this slideshow.
1/54
Administering MySQL forOracle DBAsEng. Nelson Calero, OCPUYOUG                          2/54
Administering MySQL for Oracle DBAsAbout me:     http://www.linkedin.com/in/ncalero     Working with Oracle tools and Linu...
Uruguay          4/54
AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 –...
1 - Introduction to the                           MySQL architecturehttp://dev.mysql.com/doc/refman/5.5/en/pluggable-stora...
1 - Introduction to the                                   MySQL architectureMySQL server   • comes in a Community and Ente...
1 - Introduction to the                                   MySQL architecturebinaries    • installed in /usr/bin if using R...
1 - Introduction to the                                 MySQL architectureInternal components   •memory caches    { query ...
1 - MySQL architecture                                 Internal componentsStorage engines: pluggable architecture that ena...
1 - MySQL architecture                                     Internal componentsStorage engine files    • table.frm – table ...
1 - MySQL architecture                                    Internal componentsBinary logs    • All changes done on the serv...
1 - MySQL architecture                                         DatatypesMore data types, more design choices:   • 9 numeri...
1 - MySQL architecture                                      Internal componentsData dictionary    • information_schema: me...
1 - Introduction to the                                     MySQL architectureServer variables    •Similar to Oracle initi...
1 - Introduction to the                                   MySQL architectureStatus variables    •Dynamic counters about se...
1 - MySQL architecture                                        Log FilesSlow query log: can be enabled to record log runnin...
1 - MySQL architecture                                      SecurityUses standard GRANT/REVOKE commandsPrivileges per host...
1 - MySQL architecture                               Locking and transactionsLock handling: specific of the storage engine...
1 - MySQL architecture                                 Locking and transactionsWhat happens if the server crashes?   • Inn...
AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 –...
2 - Comparison with Oracle                                         architectureWhich database flavor?    • Standard? Enter...
2 - Comparison with Oracle                                           SQLSome SQL differences:   •No need for dual. Select ...
2 - Comparison with Oracle                                          SQLCase insensitive char comparisonmysql root@localhos...
2 - Comparison with Oracle                                          SQLSilent conversionsmysql root@localhost.employees>cr...
2 - Comparison with Oracle                                         SQL        mysql root@localhost.employees>select * from...
2 - Comparison with Oracle                                          SQLMany other behaviors can be changed to something Or...
MySQL ToolsConsole          – mysql          – mysqladmin          – mysqldump          – InnoDB Hot Backup: licensed     ...
MySQL ToolsGUI tools   • MySQL Workbench       • Data modeling, SQL development, database management, forward and       re...
AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 –...
3 - Installation and Upgrade• Fresh install:     rpm -Ivh mysql-server• Customization?    •defaults are for a single insta...
3 - InstallationDefault installation    •no root user password. Should be used mysql_secure_installationAutocommit is enab...
3 - InstallationDo not forget about GLOBAL/SESSION variables:   mysql root@localhost.employees>show global variables like ...
3 - InstallationAlso, variables are not persistent when changed with SET:     oraculo:/var/lib/mysql # service mysql resta...
3 - UpgradeJust run rpm -Uvh?    • First on development environments    • Review changes in the new version, looking for: ...
3 - Upgrade               Effect of upgrading binaries with RPM -Uvh (minor version)oraculo:~ # service mysql startWill up...
3 - UpgradeVersion after the upgrade:         oraculo:~ # mysql --version         mysql Ver 14.14 Distrib 5.5.21, for Linu...
AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 –...
4 - MySQL Security & auditing• Privilege ALL includes SUPER, which allows to administer the MySQLserver. Follow least need...
4 - MySQL Security & auditingAuditing   • No built in functionality   • Can be implemented with triggers, sames as with Or...
AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 –...
5 - Performance ManagementNOs:   • way of modify/cheat optimizer statistics as in Oracle   • historical repository like AW...
5 - Performance Management• classical unix tools outside the database     vmstat / oprofile / strace / top     gdb – poor ...
5 - Performance Managementmysql >set profiling=1;                                      mysql >show profile for query 1;Que...
AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 –...
6 - Backup & Recoverymysqldump – logical backup, engine independent       full, database or table       locking based on s...
AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 –...
7 - Designing for High AvailabilityReplication – built in:    • Transfer and apply binary log from master to slaves.    • ...
7 - Designing for High AvailabilityMySQL Cluster   • Different distribution and binaries from MySQL 5.5   • Shared nothing...
Last remarks• MySQL addresses the same problems as Oracle Database.• Do not look for same functionality, but ACID and perf...
Questions?             nelson.calero@gmail.com                                       51/54
Tip: Better command line promptCommand line could be tuned similar to sqlplus with glogin script?         oracle@oraculo:~...
Tip: Better command line promptAdd PROMPT parameter to /etc/my.cnf  [mysql]  no-auto-rehash  prompt=mysql u@h.d>  oraculo:...
54/54
Upcoming SlideShare
Loading in …5
×

Collaborate 2012 - Administering MySQL for Oracle DBAs

1,642 views

Published on

Presentación dada en Collaborate 2012 - http://coll12.mapyourshow.com/5_0/sessions/sessiondetails.cfm?ScheduledSessionID=10ABCE

Published in: Technology
  • Be the first to comment

Collaborate 2012 - Administering MySQL for Oracle DBAs

  1. 1. 1/54
  2. 2. Administering MySQL forOracle DBAsEng. Nelson Calero, OCPUYOUG 2/54
  3. 3. Administering MySQL for Oracle DBAsAbout me: http://www.linkedin.com/in/ncalero Working with Oracle tools and Linux environments since 1996 DBA Oracle (since 2001) & MySQL (since 2005) Oracle University Instructor since 2011 Co-founder and President of the Oracle user Group of Uruguay (UYOUG) since 2009 Computer Engineer. OCP DBA 10g 3/54
  4. 4. Uruguay 4/54
  5. 5. AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 – Security & auditing5 – Performance management6 – Backup & Recovery7 – Designing for High Availability 5/54
  6. 6. 1 - Introduction to the MySQL architecturehttp://dev.mysql.com/doc/refman/5.5/en/pluggable-storage-overview.html 6/54
  7. 7. 1 - Introduction to the MySQL architectureMySQL server • comes in a Community and Enterprise Edition • has many databases • no schemas • two OS processes when running: mysqld and mysqld_safe • listen on port tcp/ip 3306 by default • local connections use sockets (similar to beq in Oracle) • creates one thread per each client connection • thread pool is a commercial feature of 5.5.16 (Oracle shared server) • cost based optimizer • replication is not transactional • cluster is another product, with shared nothing architecture 7/54
  8. 8. 1 - Introduction to the MySQL architecturebinaries • installed in /usr/bin if using RPM installation on most *nix • if using binary distribution (.tar), can be placed in custom directories • Is the way of having different versions on same serverNo OFA or similar.Startup script (/etc/init.d/mysql) has some defaults, changed by configurationfile (/etc/my.cnf) datadir: /var/lib/mysql bindir: /usr/bin 8/54
  9. 9. 1 - Introduction to the MySQL architectureInternal components •memory caches { query | innodb buffer | innodb log | myisam key | user | dictionary } cache • InnoDB undo log - rollback segments •splitted as insert undo and update undo buffer •part of the system tablespace by default •since MySQL 5.6 can be moved: innodb_undo_tablespaces 9/54
  10. 10. 1 - MySQL architecture Internal componentsStorage engines: pluggable architecture that enables different algorithms for handling data. InnoDB – Transactional. Default from 5.5 MyISAM – non transactional. Default before 5.5 Memory – stored only in memory, not persisted to disk NDB – used by the Cluster Archive/Blackhole/Merge/Federated - other specific use enginesMany third parties implementations XtraDB – from Percona. InnoDB improved 10/54
  11. 11. 1 - MySQL architecture Internal componentsStorage engine files • table.frm – table definition, regardless of storage engine used ($datadir/dbname) • InnoDB logs – transactional log, used for crash recovery (ib_logfile1) • 2 by default. Circular rotation. No archiving • InnoDB system tablespace – ibdata1 • Stores all data and metadata by default • Can be changed to external tablespaces: innodb_file_per_table in my.cnf • Stores each table data in one file named table.ibd • other tablespaces – used by NDB similarly as Oracle. 11/54
  12. 12. 1 - MySQL architecture Internal componentsBinary logs • All changes done on the server (called events), in the order they were executed. • Can be inspected easily with the command mysqlbinlog • Configurable format: Statement, Row or Mixed • Needed for replication and point in time recovery • Have a purge (EXPIRE_LOGS_DAYS) and rotation (MAX_BINLOG_SIZE) policy 12/54
  13. 13. 1 - MySQL architecture DatatypesMore data types, more design choices: • 9 numeric. Oracle only has one • INT is 4 bytes, TINYINT 1 byte • UNSIGNED: double possible values for autoincrements •DATE (3 bytes), DATETIME (8 bytes) and TIMESTAMP (4 bytes)Choosing a data type has more impact on the space used • int(N) – similar to Oracle, does not affect bytes used to store 13/54
  14. 14. 1 - MySQL architecture Internal componentsData dictionary • information_schema: metadata about objects • performance_schema: (5.5.3) dynamic metrics about server usage (as v$ views) mysql> SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES -> WHERE TABLE_SCHEMA = performance_schema; +----------------------------------------------+ | TABLE_NAME | +----------------------------------------------+ | cond_instances | | events_waits_current | | events_waits_history | | events_waits_history_long | | events_waits_summary_by_instance | | events_waits_summary_by_thread_by_event_name | | events_waits_summary_global_by_event_name | ... 14/54
  15. 15. 1 - Introduction to the MySQL architectureServer variables •Similar to Oracle initialization parameters, change functionality •Some can be changed dynamically •Can be persistent changed with startup options or parameter file •Global/session scope. Global do not affect session who changed it.mysql root@localhost.information_schema>show variables like query% limit 4;+------------------------------+---------+| Variable_name | Value |+------------------------------+---------+| query_alloc_block_size | 8192 || query_cache_limit | 1048576 || query_cache_min_res_unit | 4096 || query_cache_size | 0 |+------------------------------+---------+ 15/54
  16. 16. 1 - Introduction to the MySQL architectureStatus variables •Dynamic counters about server activity mysql root@localhost.information_schema>show status like qc%; +-------------------------+-------+ | Variable_name | Value | +-------------------------+-------+ | Qcache_free_blocks | 0 | | Qcache_free_memory | 0 | | Qcache_hits | 0 | | Qcache_inserts | 0 | | Qcache_lowmem_prunes | 0 | | Qcache_not_cached | 0 | | Qcache_queries_in_cache | 0 | +-------------------------+-------+ 16/54
  17. 17. 1 - MySQL architecture Log FilesSlow query log: can be enabled to record log running queries long_query_time=N (0 to 10)General log: can be enabled to record all server activity. general_log = ONError log: start, stop and error messages. file hostname.err by default can be changed with log_error=file.log in my.cnf 17/54
  18. 18. 1 - MySQL architecture SecurityUses standard GRANT/REVOKE commandsPrivileges per host/user/database/table/column grant select on employees.* to you@desktop identified by pwd;Data stored on mysql database: user/db/*_priv tables 18/54
  19. 19. 1 - MySQL architecture Locking and transactionsLock handling: specific of the storage engine InnoDB – row level MyISAM – table levelTransactions? • autocommit enabled by default outside transactions • default tx_isolation is REPEATABLE-READ • READ_COMMITED does not work with binlog mode STATEMENT 19/54
  20. 20. 1 - MySQL architecture Locking and transactionsWhat happens if the server crashes? • InnoDB has auto recovery (using ib_logfiles) • MyISAM does not, need manual intervention (myisamchk, repair table)Some parameters needs to be adjusted if using InnoDB and replication: • InnoDB_flush_log_at_trx_commit • sync_binlog • innodb_support_xa 20/54
  21. 21. AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 – Security & auditing5 – Performance management6 – Backup & Recovery7 – Designing for High Availability 21/54
  22. 22. 2 - Comparison with Oracle architectureWhich database flavor? • Standard? Enterprise? Exadata? Big data appliance? • There are different implementation decisions in every detail • Initially created for different purposesFocus on Standard Edition, some picks: • Processes handling • Optimizer features • Locking • Memory managementPick one Oracle functionality, look for that in MySQL. 22/54
  23. 23. 2 - Comparison with Oracle SQLSome SQL differences: •No need for dual. Select without FROM clause works. •Dual exists just for compatibility •No sequences. autoincrement clause at column definition •last_insert_id() can show the autoincrement value of last insert •procedures, but no packages and user defined types •multi-record insert •insert delayed •select into outfile / load data file •drop table if exists •partial indexes (column(N)) looks like function based index, but they do not exists 23/54
  24. 24. 2 - Comparison with Oracle SQLCase insensitive char comparisonmysql root@localhost.employees>select * from employees where first_name=JAANA limit 3;+--------+------------+------------+-----------------+--------+------------+| emp_no | birth_date | first_name | last_name | gender | hire_date |+--------+------------+------------+-----------------+--------+------------+| 52681 | 1956-03-28 | Jaana | Besselaar | M | 1986-09-26 || 53990 | 1960-05-26 | Jaana | Cunliffe | M | 1995-07-09 || 54450 | 1954-02-24 | Jaana | Ranon | F | 1988-08-23 |+--------+------------+------------+-----------------+--------+------------+8 rows in set (0.01 sec) 24/54
  25. 25. 2 - Comparison with Oracle SQLSilent conversionsmysql root@localhost.employees>create table pru (name varchar(10));Query OK, 0 rows affected (0.19 sec)mysql root@localhost.employees>insert into pru values (Jhon),(Lindenbaumgreen);Query OK, 2 rows affected, 1 warning (0.16 sec)Records: 2 Duplicates: 0 Warnings: 1mysql root@localhost.employees>show warnings;+---------+------+-------------------------------------------+| Level | Code | Message |+---------+------+-------------------------------------------+| Warning | 1265 | Data truncated for column name at row 2 |+---------+------+-------------------------------------------+1 row in set (0.00 sec) 25/54
  26. 26. 2 - Comparison with Oracle SQL mysql root@localhost.employees>select * from pru; +------------+ | name | +------------+ | Jhon | | Lindenbaum | +------------+ 2 rows in set (0.00 sec)with SQL_MODE this can be changed: Mysql> set SQL_MODE=strict_all_tables; Query OK, 0 rows affected (0.00 sec) Mysql> insert into pru values (Jhon),(Lindenbaumgreen); ERROR 1406 (22001): Data too long for column name at row 2NOTE: this works because SET uses SESSION scope by default 26/54
  27. 27. 2 - Comparison with Oracle SQLMany other behaviors can be changed to something Oracle-like: • SQL_MODE=ORACLE Equivalent to PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS, NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, NO_AUTO_CREATE_USER. • SQL_MODE=TRADITIONAL Equivalent to STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, and NO_ENGINE_SUBSTITUTION. • Warning: changing SQL_MODE can hurt tools that expect classic behavior • Great reference for going deeper on this: "MySQL Idiosyncrasies that BITE" by Ronald Bradford. 27/54
  28. 28. MySQL ToolsConsole – mysql – mysqladmin – mysqldump – InnoDB Hot Backup: licensed – Third parties Percona Toolkit (former maatkit): many useful script utilities OpenArk: more Percona XtraBackup: OpenSource non locking transactional backup – http://forge.mysql.com/tools/ 28/54
  29. 29. MySQL ToolsGUI tools • MySQL Workbench • Data modeling, SQL development, database management, forward and reverse engineering, change management. • Merge and improvement of old tools from MySQL AB. • Community edition under GPL • MySQL Enterprise Monitor • Real time alerting and monitoring solution • With support contract 29/54
  30. 30. AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 – Security & auditing5 – Performance management6 – Backup & Recovery7 – Designing for High Availability 30/54
  31. 31. 3 - Installation and Upgrade• Fresh install: rpm -Ivh mysql-server• Customization? •defaults are for a single installation, single instance per server. /var/lib/mysql /etc/my.cnf /var/log/mysql/mysqld.log ...• We can create and use our own custom deploy, just to not miss OFA: /u01? /u02/mysql/data 31/54
  32. 32. 3 - InstallationDefault installation •no root user password. Should be used mysql_secure_installationAutocommit is enabled. If we want to change it: mysql root@localhost.employees>set autocommit=off; Query OK, 0 rows affected (0.00 sec) mysql root@localhost.employees>show variables like %autocommit%; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | autocommit | OFF | +---------------+-------+ 1 row in set (0.00 sec) 32/54
  33. 33. 3 - InstallationDo not forget about GLOBAL/SESSION variables: mysql root@localhost.employees>show global variables like autocommit%; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | autocommit | ON | +---------------+-------+ 1 row in set (0.01 sec) mysql root@localhost.employees>set global autocommit=off; Query OK, 0 rows affected (0.00 sec) mysql root@localhost.employees>show global variables like autocommit%; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | autocommit | OFF | +---------------+-------+ 1 row in set (0.00 sec) 33/54
  34. 34. 3 - InstallationAlso, variables are not persistent when changed with SET: oraculo:/var/lib/mysql # service mysql restart Restarting service MySQL Shutting down service MySQL done Starting service MySQL done mysql root@localhost.(none)>show global variables like %autocommit%; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | autocommit | ON | +---------------+-------+ 1 row in set (0.00 sec) => It needs to be changed through startup options, in my.cnf file 34/54
  35. 35. 3 - UpgradeJust run rpm -Uvh? • First on development environments • Review changes in the new version, looking for: • new reserved words that could be in use by our existing tables • parameters in use deprecated/renamed • data conversion needed for some of our columns? • known issues 35/54
  36. 36. 3 - Upgrade Effect of upgrading binaries with RPM -Uvh (minor version)oraculo:~ # service mysql startWill update MySQL now, if you encounter any problems, please read following file: /usr/share/doc/packages/mysql-community-server/README.SuSELog files inconsistency, please merge following files manually: /var/log/mysql/mysqld.log /var/lib/mysql/mysqld.logRunning protected MySQL...Upgrading MySQL...Looking for mysql as: /usr/bin/mysqlLooking for mysqlcheck as: /usr/bin/mysqlcheckRunning mysqlcheck with connection arguments: --port=3306 --socket=/var/run/myRunning mysqlcheck with connection arguments: --port=3306 --socket=/var/run/mySUELDOS.PARAMETROS_REPORTES OK...Running mysql_fix_privilege_tables...OKStarting service MySQL done 36/54
  37. 37. 3 - UpgradeVersion after the upgrade: oraculo:~ # mysql --version mysql Ver 14.14 Distrib 5.5.21, for Linux (x86_64) using readline 6.1Worked without issues during last versions (on OpenSUSE 11.4) 5.5.18-73.1 5.5.18-74.1 5.5.20-75.1 5.5.20-78 5.5.20-80.1 5.5.21-81.1 37/54
  38. 38. AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 – Security & auditing5 – Performance management6 – Backup & Recovery7 – Designing for High Availability 38/54
  39. 39. 4 - MySQL Security & auditing• Privilege ALL includes SUPER, which allows to administer the MySQLserver. Follow least needed principle, and also avoid using %: GRANT SELECT (col1), INSERT (col1,col2) ON employees.employee TO you@desk; GRANT select on employees.* to you@% identified by pwd; GRANT select on *.* to you@%; GRANT ALL on *.* to you@%;• Each user/host combination defines a unique user• Vanilla is not possible to block connections to specific users• Log analysis to have proper auditing in place? • heavily used servers should use replica, TCP or OS mechanisms. 39/54
  40. 40. 4 - MySQL Security & auditingAuditing • No built in functionality • Can be implemented with triggers, sames as with Oracle • TIMESTAMP datatype has automatic updating and initialization, no triggers needed col_name TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 40/54
  41. 41. AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 – Security & auditing5 – Performance management6 – Backup & Recovery7 – Designing for High Availability 41/54
  42. 42. 5 - Performance ManagementNOs: • way of modify/cheat optimizer statistics as in Oracle • historical repository like AWR – Enterprise Monitor with support contract • limits on server CPU/IO usages • ability to rewrite queries on the flyCan: • configure many internal memory areas and number of client threads • use hints to force index usage • use external home made solution for query rewrite 42/54
  43. 43. 5 - Performance Management• classical unix tools outside the database vmstat / oprofile / strace / top gdb – poor mans profiler• inside database • mytop / innotop utilities • explain / explain extended • before MySQL 5.6.3, subqueries in the FROM clause are executed • status variables • com_*, innodb_*, connections • information_schema • show engine status / processlist • profiles 43/54
  44. 44. 5 - Performance Managementmysql >set profiling=1; mysql >show profile for query 1;Query OK, 0 rows affected (0.00 sec) +----------------------+----------+ | Status | Duration |mysql >select count(1) From employees; +----------------------+----------++----------+ | starting | 0.000142 || count(1) | | checking permissions | 0.000017 |+----------+ | Opening tables | 0.140542 || 10000 | | System lock | 0.000039 |+----------+ | init | 0.000022 |1 row in set (0.21 sec) | optimizing | 0.000008 | | statistics | 0.000011 |mysql >show profiles; | preparing | 0.000009 |+----------+------------+--------------------------------+ | executing | 0.000005 || Query_ID | Duration | Query | | Sending data | 0.075795 |+----------+------------+--------------------------------+ | end | 0.000018 || 1 | 0.21665250 | select count(1) From employees | | query end | 0.000007 |+----------+------------+--------------------------------+ | closing tables | 0.000012 |1 row in set (0.00 sec) | freeing items | 0.000020 | | logging slow query | 0.000003 | | cleaning up | 0.000005 | 44/54
  45. 45. AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 – Security & auditing5 – Performance management6 – Backup & Recovery7 – Designing for High Availability 45/54
  46. 46. 6 - Backup & Recoverymysqldump – logical backup, engine independent full, database or table locking based on storage engine usedXtraBackup – open-source hot backup / non-locking tool from PerconaHotbackup with InnoDB hotbackup: mysqldump --single-transaction --master-data XtraBackup: innobackupex /data/backups Needs an extra step to prepare prior to use in recovery www.percona.com/doc/percona-xtrabackup/ 46/54
  47. 47. AGENDA1 – Brief Intro to main MySQL architectural components2 – Comparison Oracle vs MySQL3 – Installation and Upgrades4 – Security & auditing5 – Performance management6 – Backup & Recovery7 – Designing for High Availability 47/54
  48. 48. 7 - Designing for High AvailabilityReplication – built in: • Transfer and apply binary log from master to slaves. • Simple to setup. • Flexible to create cascade configurations. • Can be partial, filtering by DB, tables, and combined. • Asynchronous. Semi-sync in 5.5. • Easy to break. Needs periodical consistency checks. • No conflict resolution. Needs manual intervention when detected. • Not automated failover for HA. • Apply single threaded until 5.6. • Can be configured as circular, but it needs application level coding to avoid inconsistencies. 48/54
  49. 49. 7 - Designing for High AvailabilityMySQL Cluster • Different distribution and binaries from MySQL 5.5 • Shared nothing architecture: Data nodes, SQL nodes and Manager. • Data is stored redundant among Data nodes • Online operations: backup, upgrade, node provisioning • Memory usage tied to data handled and #nodes in the cluster • 7.2 recent in production with many improvementsOther solutions • SAN/DRBD: Protection from server failures • Pacemaker: Cluster resource manager. Automation of HA among servers. • Galera: Synchronous replication as server plugin. Community and Enterprise. • Tungsten: MultiMaster replication at application level. Community and Enterprise. 49/54
  50. 50. Last remarks• MySQL addresses the same problems as Oracle Database.• Do not look for same functionality, but ACID and performance. • Some specific task can be easier (example: Partitioning).• Need to develop custom scripts for admin tasks, using standard OS tools.• Big community of users.• Being FOSS software, source code is available. This allows to overcome lack ofspecialized tools for specific issues, and depending on your skills you can fix yourown problems, and benefit the community.• Many improvements by other companies (as Percona and Facebook). 50/54
  51. 51. Questions? nelson.calero@gmail.com 51/54
  52. 52. Tip: Better command line promptCommand line could be tuned similar to sqlplus with glogin script? oracle@oraculo:~> sqlplus / as sysdba SQL*Plus: Release 11.2.0.2.0 Production on Tue Feb 28 22:09:00 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production 22:09:01 SYS@XE> oracle@oraculo:~> tail $ORACLE_HOME/sqlplus/admin/glogin.sql set pagesize 200 set linesize 120 SET TIME ON TIMING ON SET SQLPROMPT &_user@&_connect_identifier> 52/54
  53. 53. Tip: Better command line promptAdd PROMPT parameter to /etc/my.cnf [mysql] no-auto-rehash prompt=mysql u@h.d> oraculo:~ # mysql Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 7 Server version: 5.5.21-log Source distribution Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type help; or h for help. Type c to clear the current input statement. mysql root@localhost.(none)>use information_schema Database changed mysql root@localhost.information_schema> 53/54
  54. 54. 54/54

×