MySQL Una Introduccion Tecnica


Published on

MySQL A Technical Introduction in Spanish.
Some basics around getting started with MySQL if your database competency lies in another technology.
Based on another presentation, it steps further into installation options, configuration and basic admin tasks.

Published in: Technology, News & Politics
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • MySQL is at the heart of the largest and most successful web, mobile and cloud services
    9 of the top 10 most traficked properties
    Most deployed in the cloud
    Gives MySQL unique insight into how to build and operate databases behind these services: developers, consultants and support
    Packaged that insight into a series of Web Ref Archs
  • For business critical big data applications, we provide MySQL EE which includes tech support and tooling to provide highest levels of scalability, security and uptime
    Give more detail on how specific features of EE can be used to support big data pipeline
  • User connections are mapped to execution threads on a one-to-one basis with each connection/thread assignment remaining intact until the client terminates the connection. While this model serves and scales most web deployment use cases very well it does have the potential to limit scalability as connection and query loads rapidly increase. For the most highly trafficked applications when concurrent connections grow from hundreds to thousands and associated query executions grow proportionally
    In these use cases the MySQL Thread Pool addresses the limitations to scalability by:
    Managing/controlling query execution until the MySQL server has the resources to execute it.
    Splitting threads into managed Thread Groups. Inbound connections are assigned to a group via a round-robin algorithm and the number of concurrent connections/threads per group is limited based on queue prioritization and nature of queries awaiting execution. Transactional queries are given a higher priority in queue than non-transactional, but queue prioritization can be overridden at the user level as needed.
  • Data security on the web is critical and increasingly mandated – no matter the size of user-base for your application.
    PCI compliance guidelines ensure credit card data is secure within e-commerce apps. From a corporate standpoint, Sarbanes-Oxley, HIPAA, etc. guard medical, financial, public sector and other personal data with required logging, archiving and "upon request" access to audit trails that reveal the eyes and hands that have viewed and acted upon the most sensitive of data. In all use cases, requirements for capturing application level user activity are most commonly implemented on the back-end database.
    To meet these requirements, MySQL provides an open pluggable audit interface that enables all MySQL users to write their own auditing solutions based on application-specific requirements. To help users quickly and seamlessly add auditing compliance to new and existing services MySQL Enterprise Edition includes MySQL Enterprise Audit an easy to use policy-based auditing solution
  • MySQL Enterprise Audit Set Up and Use Case
    DBA enables auditing on MySQL Server
    When a user connects, all of their activities logged – as shown in section 3
  • In addition to auditing, MySQL also supports an open, pluggable authentication interface that enables users to develop plug-ins to authenticate MySQL client connections against external resource such as LDAP, Linux PAM, Windows Active Directory, etc. This enables MySQL to easily integrate with existing security standards and infrastructure that have been established to protect data from your web and mobile applications.
    As with auditing, MySQL Enterprise Edition provides ready to use external authentication modules for applications that authenticate users via Pluggable Authentication Modules (“PAM”) or native Windows OS services. The modules are developed and fully supported by Oracle.
    Security and auditing important in all of the ref archs
  • Implementing proper database backup and disaster recovery plans to protect against accidental loss of data, database corruption, hardware/operating system crashes or any natural disasters is one of the most important responsibilities of the Database Administrator (DBAs).
    MySQL is distributed with the mysqldump client backup tool. Alternatively MySQL Enterprise Backup provides DBAs with a higher performance, online “hot” backup solution with data compression technology.
    MySQL Enterprise Backup performs online "Hot", non-blocking backups of MySQL databases. Full backups can be performed on all InnoDB data while MySQL is online, without interrupting queries or updates. In addition, incremental backups are supported so that only data that has changed from a previous backup are backed up. Also partial backups are supported when only certain tables or tablespaces need to be backed up.
    MySQL Enterprise Backup restores data from a full backup with full backward compatibility. Consistent Point-in-Time Recovery (PITR) enables restoration to a specific point in time. Using MySQL backups and binlog, you can also perform fine-grained roll forward recovery to a specific transaction. A partial restore allows recovery of targeted tables or tablespaces. In addition, you can restore backups to a separate location, or create clones for fast replication setup or administration.
    MySQL Enterprise Backup supports creating compressed backup files, typically reducing backup size from 70% to over 90% when compared to the size of actual database files, reducing storage and other costs.
    MySQL Enterprise Backup is provided as part of MySQL Enterprise Edition.
  • MySQL Enterprise Monitor, included with MySQL Enterprise Edition, is a distributed web application that continually monitors your MySQL servers and proactively sends SNMP/SMTP alerts on potential problems and tuning opportunities, before they become costly outages 
    Enterprise Dashboard for Monitoring all MySQL Servers
    Using the Enterprise Dashboard, you can monitor MySQL and OS specific metrics for single or groups of servers, and can stay on top of all their replication topologies. The Enterprise Dashboard is designed so you can easily understand the complete security, availability, and performance landscape of all MySQL servers in one place, all from a thin, browser-based console.
    Availability and Performance Diagnosis
    The Enterprise Dashboard includes a color-coded Heat Chart that provides an at-a-glance view into the availability and performance of all of the MySQL servers across the enterprise.
  • The MySQL Enterprise Monitor differs from traditional third-party database monitors in that it supplies a complete set of MySQL Advisors that are designed to automatically examine a MySQL server’s configuration, security, and performance levels; identify problems and tuning opportunities; and provide the you with specific corrective actions.
  • MySQL Query Analyzer: Included in the MySQL Enterprise Monitor, the Query Analyzer helps developers and DBAs improve complex query performance by accurately pinpointing SQL code that can be optimized. Queries are presented in an aggregated view across all MySQL servers so developers can filter for specific query problems and identify the code that consumes the most resources. Queries can be analyzed during active development and continuously monitored and tuned when in production.
  • # cd /usr/local/mysql
    # scripts/mysqll_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data
  • # cd /var
  • mysql> show create table like ‘City’;
    mysql> show create table like ‘City’ G
    mysql> create table City_temp like City;  maintains PK’s, FK’s, indexes, etc.
    is not the same as
    mysql> create table City_temp as select * from City;
    mysql> SELECT now(), SYSDATE(), SLEEP(2), SYSDATE(), now();
    -- now()= when transaction began.
    -- sysdate()= executed everytime.
  • MySQL Una Introduccion Tecnica

    1. 1. 1Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    2. 2. MySQL: Una Introducción Técnica. Keith Hollman MySQL Principal Sales Consultant
    3. 3. 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 decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 3Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    4. 4. Agenda  MySQL introducción: Arquitectura y Componentes.  Enterprise Edition & Community.  Instalación.  Seguridad.  Empezando con MySQL Server.  Tareas de Administración. 4Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    5. 5. MySQL Introducción: Software, Arquitectura y Componentes 5Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    6. 6. Empresas Líderes dependen de MySQL 6Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    7. 7. MySQL Introducción  15 MM Installations  70.000 download/day  3rd DB in the World  LAMP Stack  Facebook: 190.000 fans growing 35% Y on Y  1st DB in the Cloud  3.000 ISV and OEMs  9 out of 10 top Universities  9 out of 10 top Web properties 7Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    8. 8. MySQL Introducción Software  Community  Enterprise  Enterprise  Embedded Opensource, GPLv2. product pack “MySQL Database” Standard, Enterprise, Carrier Grade Edition. Classic (MySQL Essentials), Standard, Enterprise, Carrier Grade Edition.  Paquetes instaladores:  Ficheros comprimidos: 8Copyright © 2013, Oracle and/or its affiliates. All rights reserved. rpm, msi. tar.gz, MSWin zip “no installer”.
    9. 9. MySQL Introducción Arquitectura y Componentes 9Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    10. 10. MySQL Introducción Arquitectura y Componentes  Modelo de Procesamiento – 1ª capa: mysqld parsea, optimiza & ejecuta SQL para leer / escribir. – 2ª capa: Depende del Storage Engine.  ¿Por qué elegiría un Storage Engine en particular? – Almacenamiento, transaccional / ACID, bloqueos / integridad referencial, optimización (extrayendo / escribiendo datos), funcionalidades especiales. – Depende del funcionamiento que se quiere conseguir desde la aplicación.  Transparente al usuario final. 10Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    11. 11. MySQL Introducción Conectores / APIs  ¿Necesitas que varias aplicaciones con diferente codificación se conecten al mismo servidor MySQL? – Connector/Net, Connector/J, Connector/Python, Connector/ODBC, Connector/C (libmysql), Connector/C++, MySQL native driver for PHP (mysqlnd), libmysqld (mysql embebido).  ¿Qué configuración tiene que tener? – Connection pooling, balanceo de carga, failover, preparados para entornos Replica (lect./escr.), cambiar entre distintos SQLModes, etc. – Client / server diferenciación / separación, reducir tamaños de instalación.  ¿Quieres saber más? 11Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    12. 12. Enterprise Edition y Community. 12Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    13. 13. Ediciones de MySQL Enterprise y Open Source m Enterprise MySQL Community m 13Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    14. 14. MySQL Ediciones Funcionalidades Standard SE Enterprise EE Cluster CGE MySQL Database ✔ ✔ ✔ MySQL Connectors ✔ ✔ ✔ MySQL Replication ✔ ✔ ✔ ✔ ✔ MySQL Partitioning MySQL Workbench SE ✔ ✔ ✔ Storage Engine: MyISAM ✔ ✔ ✔ Storage Engine: InnoDB ✔ ✔ ✔ Storage Engine: NDB ✔ MySQL Enterprise Monitor ✔ ✔ MySQL Enterprise Backup ✔ ✔ MySQL Cluster Manager ✔ MySQL Enterprise Security ✔ ✔ MySQL Enterprise Scalability ✔ ✔ ✔ Disponible sólo en la edición comercial. 14Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    15. 15. MySQL Enterprise Edition Los Niveles más altos en Seguridad, Rendimiento y Disponibilidad. Oracle Premier Lifetime Support MySQL Enterprise Security MySQL Enterprise Audit MySQL Enterprise Scalability MySQL Enterprise High Availability 15Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Oracle Product Certifications/Integrations MySQL Enterprise Monitor/Query Analyzer MySQL Enterprise Backup MySQL Workbench
    16. 16. MySQL Enterprise Scalability MySQL Thread Pool  MySQL default thread-handling – excelente rendimiento, puede limitar escalabilidad según y como crecen los usuarios. – Las conexiones se asignan a 1 thread para la duración de la conexión, el mismo thread para todas las sentencias.  Thread Pool API, permite a los usuarios crea su propio pool de threads.  MySQL Thread Pool mejora el rendimiento de manera sostenido, escalando en unísono con el crecimiento de los usuarios. – El Thread Pool contiene un número de thread groups configurables, gestionando hasta 4096 threads re-utilizables por grupo. – Los Threads se priorizan, sentencias se encolan para limitar las ejecuciones concurrentes y la carga en el servidor, mejora la escalabilidad al mismo ritmo que crecen las conexiones. 16Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    17. 17. MySQL Enterprise Audit Auditado basado en políticas para aplicaciones MySQL  MySQL Audit API – permite a los usuario a añadir auditado.  MySQL Enterprise Audit ofrece políticas de auditoría Nuevo! predeterminadas.  Por defecto log de todas las conexiones, logins, actividad SQL en todas o instancias MySQL específicas.  Políticas definido por usuario, filtros y rotación de logs.  activación / desactivión dinámica: no requiere reinicio.  Salida XML según la especificación de auditado Ayuda a las aplicaciones MySQL cumplir con los estándares regulatorias. (LOPD, HIPAA, Sarbanes-Oxley, PCI, etc.) 17Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    18. 18. MySQL Enterprise Audit Flow 3. La conexión y consulta de Joe se registra, 1. El DBA lo activa en Server1 Server1 2. El usuario Joe conecta y consulta a Server1 18Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    19. 19. MySQL Enterprise Backup        Online, high performance backup for InnoDB (scriptable interface) Full, Incremental, Partial Backups (with compression) Point in Time, Full, Partial Recovery options Enterprise Advisor Monitoring and Alerts on Backup Operations mysqlbackup mysqlbackup Metadata on status, progress, history Unlimited Database Size MySQL MySQL MEB Backup Cross-Platform MEB Backup Database Files - Windows, Linux, Unix Files Files Database Files Ensures quick, online backup and recovery of your on premise and Cloud based MySQL applications. 20Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    20. 20. MySQL Enterprise Monitor  Web-based, global view of MySQL/Cluster applications (onpremise and Cloud deployments)  Automated, rules-based monitoring and alerts (SMTP, SNMP enabled)  Query capture, monitoring, analysis and tuning, correlated with Monitor graphs  Real-time Replication Monitor with auto-discovery of master-slave topologies  Integrated with Oracle Support 21Copyright © 2013, Oracle and/or its affiliates. All rights reserved. A Virtual MySQL DBA Assistant!
    21. 21. MySQL Query Analyzer  Centralized monitoring of queries without Slow Query Log, SHOW PROCESSLIST;  Aggregated view of query execution counts, time, and rows  Visual “grab and go” correlation with Monitor graphs  Enabled via Connectors (PHP, JDBC, .Net) or MySQL Proxy Saves you time parsing atomic executions from logs. Finds problems you cannot find yourself. 23Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    22. 22. Instalación. 24Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    23. 23. Instalación ZIP (Generic Binaries)  10 pasos con los directorios consolidados, customizable. RPM  1 paso (por paquete rpm), distintos directorios, fijos. MySQL Server (mysqld_safe  mysqld)  my.cnf / my.ini: datadir (db dirs, .frm, .MYD, .MYI, .ibd) / socket / port / user / pid-file. 25Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    24. 24. Instalación ZIP # groupadd mysql Next command is optional # useradd -r -g mysql mysql # cp support-files/my-medium.cnf /etc/my.cnf # cd /usr/local # bin/mysqld_safe --user=mysql & # tar zxvf /path/to/mysql-VERSION-OS.tar.gz # ln -s full-path-to-mysql-VERSION-OS mysql Next command is optional # cp support-files/mysql.server /etc/init.d/mysql.server # cd mysql # chown -R mysql . # chgrp -R mysql . # scripts/mysql_install_db --user=mysql # chown -R root . # chown -R mysql data 26Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Ubuntu: “libaio” requisito: ‘sudo apt-get libaio1’ MySQL 5.6 Reference Manual 2.2. Installing MySQL from Generic Binaries on Unix/Linux
    25. 25. Instalación RPM Instalar los rpm’s que necesitas / quieres, ej.: MySQL-server-VERSION.glibc23.i386.rpm, MySQL-client-VERSION.glibc23.i386.rpm, MySQL-embedded-VERSION.glibc23.i386.rpm … # rpm -i MySQL-server-VERSION.glibc23.i386.rpm # rpm -i MySQL-client-VERSION.glibc23.i386.rpm etc.. (v5.6) El usuario mysql está creado, la contraseña del usuario root para administrar MySQL está en $HOME/.mysql.secret y automáticamente se ejecuta 27Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Si luego hacemos una actualización de la versión, upgrade, hay que actualizar todos los paquetes instalados, no sólo los que queramos. Los principales directorios usados son: /usr/bin/mysql Ubicación CLI ‘mysql’, etc. /usr/sbin/mysqld “mysqld” y otros. /var/lib/mysql Bases de datos (esquemas), logs. /usr/share/mysql Ficheros de soporte, ejemplos de my.cnf, etc. MySQL 5.6 Reference Manual 2.5.1. Installing MySQL from RPM Packages on Linux
    26. 26. Instalación Una vez instalado… Arranque | Parada: # bin/mysqld_safe --user=mysql & # mysql.server | /etc/init.d/mysql start | stop Accediendo / conectando: # mysql –uroot –pcontraseña ([client],[mysql] opciones en my.cnf) mysql> use sakila; mysql> show tables; mysql> use mysql; select * from user limit 3; ... 3 rows in set (0.00 sec) 28Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    27. 27. 29Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    28. 28. Empezando con MySQL Server. 30Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    29. 29. Empezando con MySQL Server. Seguridad inicial # mysql –uroot mysql> grant all on *.* to ‘root’@’’ identified by ‘password’;  mysql_secure_installation script.  mysql_config_editor , .mylogin.cnf encrypted option file.  SSL Keys & Certificates: parametrización por herramienta.  Proxy (non GA)  Enterprise Security: PAM & External Authentication (LDAP).  Oracle Secure Backup integration.  MEM Security Advisor 31Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    30. 30. Empezando con MySQL Server. Creando cuentas mysql> select user, host from mysql.user; mysql> create user 'keith'@'192.168.1.%' identified by 'hollman'; mysql> show grants for 'keith'@'192.168.1.%'; +----------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'keith'@'192.168.1.%' IDENTIFIED BY PASSWORD '*24D81B2006F09C3C56D6E41FBD88134C72F60C9F' | +----------------------------------------------------------------------------------------------------------------+ mysql> grant all on *.* to 'keith'@'192.168.1.%'; | GRANT ALL PRIVILEGES ON *.* TO 'keith'@'192.168.1.%‘ ... mysql> revoke all on *.* from 'keith'@'192.168.1.%'; | GRANT USAGE ON *.* TO 'keith'@ '192.168.1.%‘ ... mysql> drop user 'keith'@'192.168.1.%'; mysql> show grants for 'keith'@'192.168.1.%'; ERROR 1141 (42000): There is no such grant defined for user 'keith' on host '192.168.1.%' 32Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    31. 31. Empezando con MySQL Server. Accediendo, S/I/U/D, Import y Export. # mysql --help # mysql -uroot -pcontraseña -P3306 -h192.168.1.2 # mysql --user=root --password=contraseña --port=3307 --host=localhost # mysql (usar las opciones de [mysql] y/o [client] en el my.cnf / my.ini) MSWin: C:ProgramDataMySQLMySQL Server 5.6my.ini Linux: /etc/my.cnf, $HOME/.my.cnf, /usr/local/mysql/my.cnf mysql> status; mysql> select version(); use sakila; select * from store; select * from mysql.user; mysql> select now(); select sysdate(); select sleep(2); select sysdate(); select now(); mysql> select now(), sysdate(), sleep(2), sysdate(), now(); mysql> insert into ... ; delete from ... ; update nombre_tabla set ... ; mysqlimport mysqldump mysql> load data infile ‘path_al_fichero’ into table ‘nombre_table’; mysql> select * into outfile ‘path_al_fichero’ [...] from nombre_tabla; 33Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    32. 32. Empezando con MySQL Server. Bases de datos de ejemplo  Sakila  Employees  Menagerie  World  World_innodb 34Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    33. 33. Tareas de Administración. 35Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    34. 34. Tareas de Administración Configuración / option file.  my.ini / my.cnf (example file) – innodb_file_per_table, innodb_buffer_pool_size, binlog_format, log-bin, log-output, etc.  Socket y puertos, shared-memory-base-name (Win), etc. – multi_mysqld != oratab  Host, usuarios, contraseña y encryptación. – mysql_config_editor (mysql --login-path=admin)  Cambiando el comportamiento – sql_mode ‘oracle’ – --safe-updates / --i-am-a-dummy  Error, General & Slow log. 36Copyright © 2013, Oracle and/or its affiliates. All rights reserved. option.
    35. 35. Tareas de Administración Clientes & Utilidades  CLI – mysql –uroot –pcontra –P 3306 –S /tmp/mysql.sock –h localhost – mysql –e … mysql --help … – mysqladmin (shutdown, ping, shutdown_timeout, create database) – mysqlcheck (check, optimize, repair, analyze) – mysqlbinlog, mysqldumpslow, mysqlslap, myisamchk, etc.  Workbench python Utilities – mysqlreplicate, mysqlrplshow, mysqlrpladmin, mysqlrplcheck, mysqlfailover – mysqldbexport, mysqldbimport, mysqldbcopy, mysqldiff, mysqlserverinfo, mysqluserclone, etc. 37Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    36. 36. Tareas de Administración Charset & Collations  Character Set :: conjunto de simbolos y codificaciones Collation :: conjunto de reglas para comparar caracteres en un charset. :: case sensitive, case insensitive & binary (_cs, _ci & _bin)  Cada charset tiene al menos 1 collation, el por defecto. (show character set;)  2 charsets no pueden tener el mismo collation.  Almacenamiento del dato y comunicación entre MySQL Server y cliente.  Configurado a nivel de servidor, sesión, database, tabla y columna. – A nivel de sesión: set names ‘utf8’; 38Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    37. 37. Tareas de Administración Charset & Collations CREATE TABLE `kk` ( id_es varchar(10) collate latin1_spanish_ci, id_utf varchar(10) collate utf8_general_ci) default charset=latin1 collate=latin1_spanish_ci; insert into kk values ('áéíóúñ¿?', 'áéíóúñ¿?'); select * from kk; +----------+----------+ | id_es | id_utf | +----------+----------+ | áéíóúñ¿? | áéíóúñ¿? | +----------+----------+ 39Copyright © 2013, Oracle and/or its affiliates. All rights reserved. select hex(id_es),length(id_es) from kk; +------------------+---------------+ | hex(id_es) | length(id_es) | +------------------+---------------+ | E1E9EDF3FAF1BF3F | 8 | +------------------+---------------+ select hex(id_utf), length(id_utf) from kk; +--------------------------------+----------------+ | hex(id_utf) | length(id_utf) | +--------------------------------+----------------+ | C3A1C3A9C3ADC3B3C3BAC3B1C2BF3F | 15 | +--------------------------------+----------------+
    38. 38. Tareas de Administración Storage Engines  InnoDB (por defecto >5.5.5) Transaccional / OLTP.  OLTP, Integridad Referencial, Bloqueos por fila, FullText (5.6), recuperable ante fallos, múltiples Buffers y Caches.  MyISAM (por defecto <5.5.5) Web, alto lectura, baja escritura.  .MYD/.MYI ficheros portables, alta compresión, FullText y búsquedas GIS, formato de fila fija para acceso rápido, inserciones concurrentes, escrituras precede por encima de consultas.  NDB / NDBCluster Cluster, 99.999% disponible.  Específico para Cluster: HA, OLTP, réplicas, particiones y fragmentos, auto-sharding, etc. Otros: MEMORY (fast performance, .frm files on disk, fixed length rows, hash & btree indexes, table contents temporary*, --init-file.), FEDERATED (Acceder a tablas remotas.), CSV (Almacenar datos en formato CSV.), ARCHIVE (Archivar, select & insert sólo.), BLACKHOLE (Particular uso sin generar IO.), EXAMPLE (¿Quieres crear tu propio motor?) 40Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    39. 39. Tareas de Administración Transacciones  ACID – START TRANSACTION / BEGIN, SAVEPOINT, COMMIT, ROLLBACK, ROLLBACK TO SAVEPOINT, RELEASE SAVEPOINT, SET AUTOCOMMIT. – Usa el storage engine adecuado, es decir, transaccional (SHOW ENGINESG)  Problemas transaccionales: – Lecturas Dirty (leer cambios no-comiteados ) – Lecturas non-repeatable (dentro de la misma transacción la misma operación de lectura, da distintos resultados) – Lecturas Phantom (filas phantom, una fila que aparece que no estaba antes ) 41Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    40. 40. Tareas de Administración Transacciones  Isolation levels – READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ & SERIALIZABLE.  Global, sesión o en memoria (hasta siguiente reinicio). – my.cnf: transaction-isolation = READ-COMMITTED – Sesión: set transaction isolation level READ COMMITTED; – Global: set global transaction isolation level READ COMMITTED;  Por defecto, REPEATABLE READ. – SELECT @@tx_isolation; 42Copyright © 2013, Oracle and/or its affiliates. All rights reserved. SELECT @@GLOBAL.tx_isolation;
    41. 41. Tareas de Administración Bloqueos  Depende del Storage Engine.  2 tipos para protegerse: – Shared: Clientes que leen permiten leer a otros, pero escrituras deben esperar que todas las lecturas hayan acabado. – Exclusive: Si un cliente quiere escribir, todos deben esperar a leer o escribir hasta que la escritura haya acabado.  Uso: – select… LOCK IN SHARED MODE; – select… FOR UPDATE; 43Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    42. 42. Tareas de Administración Mantenimiento de tablas  Tablas – show create table like … – create table tabla2 like tabla1 != create table tabla2 as select * from… – show table status like …; – mysqlcheck (tablas e índices), check, analyze, repair, optimize.  Indices / Keys – check table … extended; | mysqlcheck –extended – Utilities: mysqlindexcheck  Particionamiento – Filosofía y dependerá de la aplicación y necesidad. – Hash, Range o Key, Sub-particiones, (5.6) hints para partition-pruning. 44Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    43. 43. Tareas de Administración Programación  Connectors / APIs – Librerias y drivers estándar, permitiendo acceso a bajo nivel (haciendo uso de funciones para comunicarse con mysql) – Connector/J, Connector/ODBC, Connector/NET, Connector/C++, Connector/Python, PHP (mysqli, ext/mysqli, PDO_MYSQL), etc.  Stored Routines & Security “With the large number of client programs that are available for MySQL, why would you want to write your own?” – Acceso a datos de tablas: DEFINER en la definición de la rutina, y luego dar EXECUTE.  Triggers (before, after, insert, update, delete) 45Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    44. 44. Tareas de Administración Backup & Recovery SQL extractos / dump  mysqldump / select into outfile mysqldump -P3306 -uroot -poracle --host= --database sakila --log-error=d:dump_sakila.log -q -r D:dump_sakila1.sql | mysql -uroot -poracle -P3307 < D:dump_sakila.sql  mysqlimport / load data infile (no crea las tablas)  tee / no-tee MySQL Enterprise Backup  mysqlbackup: Full / Incremental, a cinta (Rman, single image, aplicar logs al backup incremental (PITR partial recovery example), cualquier tipo de tabla, auto-bloqueo, con compresión, OSB, etc. 46Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    45. 45. Tareas de Administración Optimización  show processlist;  Explain plan: explain select …  Procedure analyse: select… from… PROCEDURE ANALYSE()G  PERFORMANCE_SCHEMA  MEM Query Analyzer 47Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    46. 46. Listos? 48Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    47. 47. 49Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    48. 48. Del mundo Oracle, que debo dejar atrás? 50Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    49. 49. MySQL Cluster Carrier Grade Edition ESCALABILIDAD LECT. Y ESCR. 99.999% DISPONIBLE RESPUESTA EN REAL-TIME APIS SQL Y NOSQL TCO BAJO, FLEXIBLE 51Copyright © 2013, Oracle and/or its affiliates. All rights reserved. • ‘Auto-sharding’ y ‘Multi-master’ • Transaccional, ACID, base de datos relacional • Diseño ‘Shared-nothing’, ningún Punto Único de Fallo • Operaciones On-Line: Escale, actualice esquemas, etc. • Alta carga, rendimiento ‘real-time’ • Baja latencia predecible, accesos multi-thread • Consultas relacionales y complejas + Accesos de ‘Key/Value’ • MySQL, Memcached, C++, Java, JPA, HTTP / REST • Ediciones GPL y Comercial • Hardware de ‘commodity’, herramientas de gestión y monitorización
    50. 50. “Llegué a contactar con cada anarquista India en Londres. Su valentía me impresionó, pero sentí que su ambición estaba desencaminado. Sentí que la violencia no era un remedio para los males de India, y que su pueblo requería el uso de una arma más impactante y diferente para protegerse.” Mohandas Karamchand Gandhi Hind Swaraj 1908 52Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    51. 51. 53Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Mgmt Data Nodes Capa Aplicación Clientes MySQL Cluster CGE Escalabilidad On-Line
    52. 52. MySQL Cluster CGE Conceptos Claves  Partición – Particionamiento horizontal – Una parte de la tabla, cada partición contiene un conjunto de filas – Número de particiones = número de data nodes  Fragmento – La copia de una partición  Réplica – La copia completa de los datos  ‘Node Group’ – Creado automáticamente – # de grupos = # de data nodes / # de réplicas – Mientras que haya siempre un ‘data node’ en cada ‘node group’ tendremos una copia completa de los datos. 54Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    53. 53. Siguientes Pasos Prueba MySQL 5.7 DMR MySQL Blog: Lo Último. Involucre MySQL Consulting MySQL 5.6 OCP DBA / Dev Oracle University cursos 55Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    54. 54. Más documentación  Guía para desarrolladores y DBA para las Novedades de MySQL 5.6 (en Español)  White Papers técnicos.  Reference Manual. 56Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    55. 55. blog: 57Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    56. 56. Ahora me toca a mi… 58Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    57. 57. 59Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
    58. 58. 60Copyright © 2013, Oracle and/or its affiliates. All rights reserved.