SlideShare a Scribd company logo
1 of 77
Download to read offline
MySQL para Desenvolvedores


Airton Lastori
airton.lastori@oracle.com



30-jan-2013
1   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
@MySQLBR                                                            facebook.com/MySQLBR

                                                                                                                                               MySQLBR
                                       meetup.com/MySQL-BR




2   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
3   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alguns clientes MySQL




4   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alguns clientes MySQL




                                                                   fonte: alexa.com/topsites 30-jan-2013
5   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alguns clientes MySQL




                                                                                          mysql.com/customers
6   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alguns clientes MySQL




                                                                                          mysql.com/customers
7   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Tipos de aplicação
             70%
             60%
             50%
             40%
             30%
             20%
             10%
                                                                                                                                               Enterprise
              0%
                                                                                                                                               Community




8   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Desafio de desenvolvedor #1




                          Quais são os requisitos não
                         funcionais da minha aplicação?



9   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Na escolha da solução, considerar...



                         Escalabilidade, performance, disponibilidade,
                       estabilidade, segurança, simplicidade, flexibilidade,
                      custo total de propriedade, conhecimento da equipe...


                                        Ah! Não esqueça da fase de produção, dos DBAs...
                                            ferramentas, suporte, rotinas de manutenção.

10   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL para desenvolvedores

                                                                                                                                                Conhecendo melhor o
                                                     Portfolio                                                                                  universo MySQL para
                                                                                                                                                fazer boas escolhas…


                                    Ambiente de
                                  desenvolvimento


                               Escalabilidade e
                              Alta-disponibilidade

11   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL para desenvolvedores

                                                                                                                                                Conhecendo melhor o
                                                     Portfolio                                                                                  universo MySQL para
                                                                                                                                                fazer boas escolhas…


                                    Ambiente de
                                  desenvolvimento


                               Escalabilidade e
                              Alta-disponibilidade

12   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Compromisso Oracle com MySQL Community
       Portfólio disponível para download e uso sob GPL


                                                                                                                    MySQL Database Community Server
                                                                                                                    MySQL Cluster
                                                                                                                    MySQL Workbench
                                                                                                                    MySQL Connectors
                                                                                                                    MySQL Proxy
                                                                                                                    Documentação não GPL
                                                                                                                    Forums, Lists, Bugs, Blogs…

13   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Conectores: amplo suporte a várias linguagens

                                                     Oracle                                                                                              Comunidade

              •      Connector/ODBC                                                                                                             •   PHP
              •      Connector/Net (ADO.NET)                                                                                                    •   Perl
              •      Connector/Python                                                                                                           •   Ruby
              •      Connector/J (JDBC)                                                                                                         •   TCL
              •      Connector/C (C API)                                                                                                        •   Eiffel
              •      Connector/C++ (C++ API)                                                                                                    •   …


                                   dev.mysql.com/doc/refman/5.5/en/connectors-apis.html

14   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL Enterprise Edition
       Maior produtividade e mitigação de riscos


                                                                                                      Oracle Premier
                                                                                                     Lifetime Support
                                                        MySQL Enterprise                                                             Oracle Product
                                                           Security                                                            Certifications/Integrations

                               MySQL Enterprise                                                                                                   MySQL Enterprise
                                   Audit                                                                                                        Monitor/Query Analyzer

                  MySQL Enterprise                                                                                                                       MySQL Enterprise
                     Scalability                                                                                                                             Backup

               MySQL Enterprise
                                                                                                                                                           MySQL Workbench
               High Availability

15   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL para desenvolvedores

                                                                                                                                                Conhecendo melhor o
                                                     Portfolio                                                                                  universo MySQL para
                                                                                                                                                fazer boas escolhas…


                                    Ambiente de
                                  desenvolvimento


                               Escalabilidade e
                              Alta-disponibilidade

16   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Desafio de desenvolvedor #2




                      Instalação básica, ambiente de
                             desenvolvimento…

                                                                              ...em 15 minutos, ou menos!


17   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
18   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
No Linux ou Mac, prefira os binários




                                                                       mysql.com/downloads/mysql

19   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Cliente-Servidor



                                                                                                                       Client
                                                                                                            mysql / mysql.exe


                                                                                                                     Server
                                                                                                         mysqld / mysqld.exe




20   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Iniciar ou Parar o servidor MySQL no Windows




          …ou via MySQL Notifier




21   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Iniciar ou Parar o servidor MySQL no Linux

          Iniciar:
          /usr/local/mysql/bin> mysqld_safe --defaults-file=/etc/my.cnf &




          Parar:
          /usr/local/mysql/bin> mysqladmin shutdown




                                         dev.mysql.com/doc/refman/5.5/en/mysqld-safe.html

22   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Primeira conexão
          C:Program FilesMySQLMySQL Server 5.5bin>mysql -uroot -p
          Enter password: ****
          Welcome to the MySQL monitor.                                                    Commands end with ; or g.
          Your MySQL connection id is 8
          Server version: 5.5.28 MySQL Community Server (GPL)


          Copyright (c) 2000, 2012, 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>



23   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Teste via MySQL Workbench 1/2




24   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Teste via MySQL Workbench 2/2




25   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Cliente-Servidor



                                                                                                     App + Connector
                                                            JDBC, ODBC, .Net, PHP, Python, Perl, Ruby, Native C API…


                                                                                                                         Server
                                                                                                            mysqld / mysqld.exe




26   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Desafio de desenvolvedor #3




                                                                            Hello World…


                                                                                                             ...em Java


27   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Adicione o driver MySQL ao CLASSPATH
           caminho completo do .jar




             Confira:
               C:>set CLASSPATH
               CLASSPATH=.;C:Program Files (x86)Javajre6libextQTJava.zip;C:Program
                 FilesMySQLmysql-connector-java-5.1.22mysql-connector-java-5.1.22-bin.jar




28   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
HelloMysql.java 1/2
              import java.sql.*;
              public class HelloMysql {
                 public static void main(String args[]){
                 System.out.println("Tentando conectar ao MySQL...");
                 try {
                        Class.forName("com.mysql.jdbc.Driver");
                        String url = "jdbc:mysql://localhost:3306/mysql";
                        String usuario = "root";
                        String senha = "root";
                        Connection con = DriverManager.getConnection(url, usuario, senha);
                        System.out.println("URL: " + url);
                        System.out.println("Connection: " + con);
                                                                                                                                                Continua…
29   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
HelloMysql.java 2/2
                        Statement stmt = con.createStatement();                                                                                 //objeto Statement
                        ResultSet rs;                                           //objeto ResultSet
                        rs = stmt.executeQuery("SELECT * FROM world.country");
                        System.out.println("Ola mundo!");
                        while(rs.next()){
                   String nomePais = rs.getString("Name");
                           System.out.print(nomePais + ", ");
                        }//end while
                        con.close();
                    } catch( Exception e ) {
                        e.printStackTrace();
                    }//end catch
                 }//end main
              }//end class HelloMysql
                                                                                                                                                              PRONTO!
30   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
java HelloMysql
            C:tutorial>javac HelloMysql.java


            C:tutorial>java HelloMysql
            Tentando conectar ao MySQL...
            URL: jdbc:mysql://localhost:3306/mysql
            Connection: com.mysql.jdbc.JDBC4Connection@ed07f45
            Ola mundo!
            Aruba, Afghanistan, Angola, Anguilla, Albania, Andorra, Netherlands Antilles, Un
            ited Arab Emirates, Argentina, Armenia, American Samoa, Antarctica, French South
            ern territories, Antigua and Barbuda, Australia, Austria, Azerbaijan, Burundi, B
            elgium, Benin, Burkina Faso, Bangladesh, Bulgaria, Bahrain, Bahamas, Bosnia and
            Herzegovina, Belarus, Belize, Bermuda, Bolivia, Brazil, Barbados, Brunei, Bhutan
            …
            ietnam, Vanuatu, Wallis and Futuna, Samoa, Yemen, Yugoslavia, South Africa, Zamb
            ia, Zimbabwe,



31   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Próximo passo: documentação

          Reference Manual
                    1. Tutorial
                    2. SQL Syntax
                    3. Connectors & APIs, Memcached
                    4. Functions, Views, Stored Programs
                    5. Optimization



                                                    dev.mysql.com/doc/refman/5.5/en/index.html

32   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL para desenvolvedores

                                                                                                                                                Conhecendo melhor o
                                                     Portfolio                                                                                  universo MySQL para
                                                                                                                                                fazer boas escolhas…


                                    Ambiente de
                                  desenvolvimento


                               Escalabilidade e
                              Alta-disponibilidade

33   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Desafio do desenvolvedor #4




                                     Projetar uma solução para
                                       disponibilidade 24x7…

                                                                            ...a famosa alta-disponibilidade


34   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alta-Disponibilidade
                                                                                                                                                Clustering &

                            Custo & Complexidade
                                                                                                                                                Redundância
                                                                                                                                                  Geográfica

                                                                                                                         Clustering &
                                                                                                                         Virtualização


                                                                                            Replicação


                                                                                                     ISPs &                           On-Line        eCommerce
                                                                                                     Corporativo                      Services       Telecoms, Militar

                                                     9
                                                   35 dias
                                                                                 9
                                                                            4 days
                                                                            4 dias
                                                                                          .                      9
                                                                                                           8 horas
                                                                                                                                                9
                                                                                                                                           50 min
                                                                                                                                                           9
                                                                                                                                                         5 min           %
35   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Replicação MySQL
                                                                                               Aplicação



                                    Escritas & Leituras


                                                Master                                                                                     Slave




                                          • Modelo assíncrono (padrão)
                                          • Modelo semi-síncrono (a partir da versão 5.5)

36   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL failover
                                                                                               Aplicação



                                                                                                                               Escritas & Leituras


                                                Master                                                                                     Slave




                                          • Master down
                                          • Slave promovido para Master

37   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alta-Disponibilidade
                                                                                                                           Clustering &
                                                                                                                          Redundância
                            Custo & Complexidade                                                                            Geográfica

                                                                             Clustering &
                                                                             Virtualização                                                          DRBD


                                                               Replicação
                                                                                                  Replicação

                                                                                                     ISPs &                           On-Line       eCommerce
                                                                                                     Corporativo                      Services      Telecoms, Militar

                                                     9
                                                   35 dias
                                                                                 9
                                                                            4 days
                                                                            4 dias
                                                                                          .                      9
                                                                                                           8 horas
                                                                                                                                                9
                                                                                                                                           50 min
                                                                                                                                                          9
                                                                                                                                                        5 min           %
38   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Soluções certificadas MySQL HA: resumo
                                                                                         MySQL 5.6                      Windows                 Solaris    Oracle VM              MySQL
                                                                                                                                                                        DRBD
                                                                                         Replication                     Cluster                Cluster    Template               Cluster

            Nível de disponibilidade                                                          99.9%                      99.95%                 99.99%     99.99%      99.99%     99.999%

            Auto-Failover                                                                        ✔                            ✔                   ✔          ✔           ✔          ✔
            Sem perda de dados durante                                                            ✔
            failover                                                                      Semi-Sync
                                                                                                                              ✔                   ✔          ✔           ✔          ✔

            Plataformas suportadas                                                                All                   Windows                 Solaris     Linux       Linux       All

                                                                                           Master +                      Active /               Active /   Active /    Active /   Multi-
            Modo de clusterização                                                           Slaves                       Passive                Passive    Passive     Passive    Master

            Dispensa Shared Storage                                                              ✔                            ✖                   ✖          ✖           ✔          ✔
            Ponto único de suporte                                                               ✔                            ✖                   ✔          ✔           ✔          ✔

                             mysql.com/why-mysql/white-papers/mysql_wp_ha_strategy_guide.php
39   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Desafio do desenvolvedor #5



                  Projetar uma solução que possa
                   crescer para comportar milhões
                            de usuários…


40   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Escalabilidade: horizontal vs vertical
            Scale Out                                                                                                               Scale Up
            • Adicionar mais servidores para                                                                                        • Trocar por hardware mais
              aumentar performance                                                                                                    poderoso, adicionar memória,
            • MySQL adota esta abordagem                                                                                              CPU
              em sistemas altamente                                                                                                 • Outras soluções normalmente
              escaláveis em hardware                                                                                                  usam hardware proprietário
              commodity (Intel / AMD)                                                                                                 (SMP)




41   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Evolução da escalabilidade do MySQL



                  2008                                                               2009                                                        2010         2013


               até 4 CPU                                                         até 16 CPU                                                     até 32 CPU   até 48 CPU
               MySQL 5.0                                                         MySQL 5.1                                                      MySQL 5.5    MySQL 5.6

               MySQL AB                                                                  Sun                                                      Oracle




42   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Benchmarks MySQL 5.5 vs 5.6

             Sysbench
             32-core
             Mesmo Hardware
             Tuning ótimo




43   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Benchmarks MySQL 5.5 vs 5.6

             Sysbench
             32-core
             Mesmo Hardware
             Tuning ótimo



                                                                                                                           Sysbench
                                                                                                                             32-core
                                                                                                                        Same Hardware
                                                                                                                        Optimal Tuning




44   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Escalabilidade horizontal
                                                                                                    Particionamento
       Replicação MySQL                                                                                                                             Data Sharding
                                                                                                       Funcional
     • método mais simples e                                                             • dividir a carga em múltiplos                         • método de maior sucesso
       mais comum                                                                          nós, com responsabilidades                             para escalar aplicações
                                                                                           distintas                                              MySQL de grande porte
     • indicado para aplicações                                                                                                                   hoje
       de LEITURA intensiva                                                              • os nós podem ter
                                                                                           redundância via replicação                           • dados compartilhados em
     • problemas com cache                                                                 para alta-disponibilidade                              tabelas/caches globais,
       duplicado em aplicações                                                           • normalmente não é                                      SOA
       com datasets grandes                                                                transparente para a aplicação                        • difícil de adaptar
                                                                                           e também recorre ao scale up                           aplicações legadas
                                                                                           para cada database funcional,
                                                                                           o que impõe limites




45   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Replicação MySQL: escalando LEITURAS
                                                                                               Aplicação



                                    Escritas & Leituras                                                                                  Leituras



                                                Master                                                                                     Slave




                                          • Divisão de leituras e escritas (R/W Split)
                                          • É possível adicionar mais slaves, dividir a carga

46   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding: escalando ESCRITAS
                                      Table T1                                                                                                  Data Node 1



                                                                                                          P1                                    Data Node 2

                                                                                                          P2
                                                                                                          P3                                    Data Node 3

                                                                                                          P4
                                                                                                                                                Data Node 4




47   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding: escalando ESCRITAS
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1


                                                                                                          P1                                    Data Node 2

                                                                                                          P2
                                                                                                          P3                                    Data Node 3

                                                                                                          P4
                                                                                                                                                Data Node 4




48   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding: escalando ESCRITAS
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1


                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3
                                                                                                          P2
                                                                                                          P3                                    Data Node 3

                                                                                                          P4
                                                                                                                                                Data Node 4




49   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding: escalando ESCRITAS
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1


                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3
                                                                                                          P2
                                                                                                          P3                                    Data Node 3
                                                                                                                                                F2
                                                                                                          P4
                                                                                                                                                Data Node 4




50   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding: escalando ESCRITAS
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1


                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3
                                                                                                          P2
                                                                                                          P3                                    Data Node 3
                                                                                                                                                F2
                                                                                                          P4
                                                                                                                                                Data Node 4
                                                                                                                                                F4




51   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Desafios do desenvolvedor #4 + #5




                        É possível combinar alta-
                     disponibilidade e escalabilidade?

                                                         ...assim como Facebook, Twitter, Youtube


52   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding + Replicação
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1


                                                                                                          P1                                    Data Node 2
                                                                                                                                                          F1
                                                                                                          P2
                                                                                                          P3                                    Data Node 3

                                                                                                          P4
                                                                                                                                                Data Node 4




53   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding + Replicação
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1        F3


                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3        F1
                                                                                                          P2
                                                                                                          P3                                    Data Node 3

                                                                                                          P4
                                                                                                                                                Data Node 4




54   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alta-Disponibilidade: Replicação Síncrona
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1        F3


                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3        F1
                                                                                                          P2
                                                                                                          P3                                    Data Node 3
                                                                                                                                                F2
                                                                                                          P4
                                                                                                                                                Data Node 4
                                                                                                                                                          F2




55   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding + Replicação
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1        F3


                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3        F1
                                                                                                          P2
                                                                                                          P3                                    Data Node 3
                                                                                                                                                F2        F4
                                                                                                          P4
                                                                                                                                                Data Node 4
                                                                                                                                                F4        F2




56   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding + Replicação
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1        F3




                                                                                                                                                               Group 1
                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3        F1
                                                                                                          P2
                                                                                                          P3                                    Data Node 3
                                                                                                                                                F2        F4
                                                                                                          P4




                                                                                                                                                               Group 2
                                                                                                                                                Data Node 4
                                                                                                                                                F4        F2




57   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Data Sharding + Replicação
                                      Table T1                                                                                                  Data Node 1
                                                                                                                                                F1        F3




                                                                                                                                                               Group 1
                                                                                                          P1                                    Data Node 2
                                                                                                                                                F3        F1
                                                                                                          P2
                                                                                                          P3                                    Data Node 3
                                                                                                                                                F2        F4
                                                                                                          P4




                                                                                                                                                               Group 2
                                                                                                                                                Data Node 4
                                                                                                                                                F4        F2




58   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Casos de muito sucesso

            Facebook
            Youtube
            Twitter
            Flickr
            Evernote
            Pinterest
           …



                                                                                             highscalability.com
59   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL Cluster: auto-sharding
                                           Clients



                                                                                           Application Layer




Management                                                                                                                                         Management


                                                                                                   Data Layer                                             Table T1
                                                       F1                        F3                       F2                        F4                               P1
                                                       F3                        F1                       F4                        F2                               P2
                                                                                                                                                                     P3
                                                                               MySQL Cluster Data Nodes                                                              P4

   60   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
APIs de Acesso aos Dados




                                                                                                                                                  Os mesmos dados
                                                                                                                                                          acessados
                                                                                                                                                    simultaneamente
                                                                                                                                                através de interfaces
                                                                                                                                                       SQL e NoSQL



61   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Alguns Clientes MySQL Cluster




62   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Caso de sucesso
                                                                                                                                       •2 milhões usuários, com 30.000 novos
                                                                                                                                       usuários por dia
                                                                                                                                       •10.000 usuários concorrentes
                                                                                                                                       •10.000 Transações Por Segundo
                                                                                                                                       •99.999% uptime

                                                                                                                                       “The MySQL support service has
                                                                                                                                       been essential in helping us for
                                                                                                                                       troubleshooting and giving
                                                                                                                                       recommendations for the production
                                                                                                                                       cluster.”
                                                                                                                                                 Carlos Morales (DBA), Playfulplay.com

                       blogs.oracle.com/MySQL/entry/mysql_cluster_powers_el_chavo
63   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL Cluster
                      Carrier Grade                                                           • Arquitetura shared-nothing in-memory parallel
                       Database                                                               • Modelo relacional ACID, SQL

                                                                                              • 99.999% de disponibilidade
           Alta Disponibilidade                                                               • Self-healing, failover abaixo de 1 segundo

                                                                                              • Performance em tempo real para altas cargas
               Alta Performance                                                               • Latência baixa e preditiva

                                                                                              • Elasticidade, crescimento incremental
                     Escalabilidade                                                           • Escalabilidade linear, distribuition aware

                                                                                              • Open Source, hardware commodity
                       Open Source                                                            • APIs NoSQL (C++, Java, Memcached, Node.js)

64   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL Cluster Auto-Install (beta)




       Simples de instalar e provisionar clusters multi-node
       Complementa MySQL Cluster Manager no gerenciamento de cliclo de vida

65   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL Cluster Manager
        Para testes em uma única máquina
        1.            Download MCM/Cluster edelivery.oracle.com:
        2.            Unzip e execute o comando:
             C:MySQLmcmbin> mcmd –bootstrap
             MySQL Cluster Manager 1.1.2 started
             Connect to MySQL Cluster Manager by running “C:MySQLmcmbinmcm" -a NOVA:1862
             Configuring default cluster 'mycluster'...
             Starting default cluster 'mycluster'...
             Cluster 'mycluster' started successfully
               ndb_mgmd NOVA:1186
               ndbd NOVA
               ndbd NOVA
               mysqld NOVA:3306
               mysqld NOVA:3307
               ndbapi *
             Connect to the database by running “C:MySQLmcmclusterbinmysql" -h NOVA -P 3306 -u root


66   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Mais sobre como começar com MySQL Cluster


                                                                                                                Whitepaper:
                                                                                                                MySQL Cluster Evaluation Guide
                                                                                                                February 2012
                                                                                                                mysql.com/why-mysql/white-papers/mysql-
                                                                                                                cluster-evaluation-guide/




67   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Exemplos Memcached API


              On-demand Webinar:
              NoSQL Memcached API for MySQL Cluster
              22 August 2012
              mysql.com/news-and-events/on-demand-webinars/display-od-723.html




68   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Exemplos JavaScript / Node.js API


              Blog:
              Tutorial Getting Started with the NoSQL JavaScript / Node.js API for
              MySQL Cluster
              10 June 2012
              blogs.oracle.com/MySQL/entry/tutorial_getting_started_with_the




69   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Novo Desafio do desenvolvedor




                                                                                            Big Data



70   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL in the Big Data Lifecycle
                                                                                                                                                ACQUIRE
                                          DECIDE
                BI Solutions

                                                                                                                                                  NoSQL APIs



                                                                                                                                                   Binlog API
                                  ANALYZE                                                                                                       ORGANIZE


71   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL e Big Data


                                                                                                                Whitepaper:
                                                                                                                MySQL and Hadoop – Big Data Integration
                                                                                                                December 2012
                                                                                                                mysql.com/why-mysql/white-papers/mysql-
                                                                                                                and-hadoop-guide-to-big-data-integration/




72   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Sumário

                   O MySQL é o banco de dados open source mais popular do
                    mundo, usado em grandes sites, aplicações mobile e
                    embarcadas.
                   Há várias opções de arquiteturas e APIs, oferecendo enorme
                    flexibilidade, escalabilidade e alta-disponibilidade.
                   Instale e comece a usar em menos de 15min. Use e abuse da
                    documentação!



73   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
@MySQLBR                                                            facebook.com/MySQLBR

                                                                                                                                                Obrigado!
                                        meetup.com/MySQL-BR




74   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
MySQL para Desenvolvedores


Perguntas?


75   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Arquitetura MySQL Server

                  Clients and Apps
                                                                                                                                  Clients & Connectors
                   mysqld                                                                          Native C API, JDBC, ODBC, .Net, PHP, Ruby, Python, VB, Perl




                                                                                         Connection Pool, SQL Interface, Parser, Optimizer, Caches
                  Enterprise Management
                   Services and Utilities

                           Backup & Recovery                                                                                            Storage Engines
                                Monitor                                                              InnoDB, MyISAM, Memory, Archive, Cluster (NDB API), etc…
                              Workbench
                                Utilities
                                                                                                                           Filesystems, Files and Logs
                                                                                                                   Data, Index, Redo, Undo, Binary, Error, Slow




76   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12
Storage Engines
                                                                                        MyISAM                                                   InnoDB              NDB Cluster
      Transações                                                                                   ✖                                                  ✔                      ✔

      Nível de Lock                                                                           Tabela                                                 Linha                  Linha
                                                                                      Assíncrona ou                                             Assíncrona ou
      Replicação                                                                                                                                                   Síncrona, Multi-master
                                                                                      Semi-síncrona                                             Semi-síncrona
      Foreign Keys                                                                                 ✖                                                  ✔                a partir da v7.3

      Full-text indexes                                                                            ✔                                            a partir da v5.6             ✖

      Compressão de dados                                                           somente Leitura                                                   ✔                      ✖

      Caches                                                                        somente Índices                                             Dados e Índices       Dados e Índices

      Suporte Geospacial                                                    Tipos de Dados e Índices                                   somente Tipos de Dados      somente Tipos de Dados

      Limite de armazenamento                                                                 256TB                                                  64TB                  384EB

                                                  dev.mysql.com/doc/refman/5.5/en/storage-engines.html

77   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.   Insert Information Protection Policy Classification from Slide 12

More Related Content

Similar to MySQL para Desenvolvedores

Posscon my sql56
Posscon my sql56Posscon my sql56
Posscon my sql56Dave Stokes
 
What is new in MySQL? (Lars Thalmann)
What is new in MySQL? (Lars Thalmann)What is new in MySQL? (Lars Thalmann)
What is new in MySQL? (Lars Thalmann)Ontico
 
From Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise EditionFrom Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise Edition郁萍 王
 
MySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de GamesMySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de GamesMySQL Brasil
 
MySQL Community and Commercial Edition
MySQL Community and Commercial EditionMySQL Community and Commercial Edition
MySQL Community and Commercial EditionMario Beck
 
MySQL HA Solutions
MySQL HA SolutionsMySQL HA Solutions
MySQL HA SolutionsMat Keep
 
MySQL For Oracle Developers
MySQL For Oracle DevelopersMySQL For Oracle Developers
MySQL For Oracle DevelopersRonald Bradford
 
MySQL Enterprise Monitor
MySQL Enterprise MonitorMySQL Enterprise Monitor
MySQL Enterprise MonitorTed Wennmark
 
MySQL 8: Ready for Prime Time
MySQL 8: Ready for Prime TimeMySQL 8: Ready for Prime Time
MySQL 8: Ready for Prime TimeArnab Ray
 
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql ClusterSanto Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql ClusterSanto Leto
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
20191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv120191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv1Ivan Ma
 
MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...
MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...
MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...GeneXus
 
20200613 my sql-ha-deployment
20200613 my sql-ha-deployment20200613 my sql-ha-deployment
20200613 my sql-ha-deploymentIvan Ma
 
My sql crashcourse_2012
My sql crashcourse_2012My sql crashcourse_2012
My sql crashcourse_2012sqlhjalp
 
Oracle enterprise architects day
Oracle enterprise architects dayOracle enterprise architects day
Oracle enterprise architects dayAyodele Peter Boglo
 
Developing Applications with MySQL and Java
Developing Applications with MySQL and JavaDeveloping Applications with MySQL and Java
Developing Applications with MySQL and JavaMark Matthews
 

Similar to MySQL para Desenvolvedores (20)

MySQL Spatial
MySQL SpatialMySQL Spatial
MySQL Spatial
 
Posscon my sql56
Posscon my sql56Posscon my sql56
Posscon my sql56
 
What is new in MySQL? (Lars Thalmann)
What is new in MySQL? (Lars Thalmann)What is new in MySQL? (Lars Thalmann)
What is new in MySQL? (Lars Thalmann)
 
From Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise EditionFrom Nice to Have to Mission Critical: MySQL Enterprise Edition
From Nice to Have to Mission Critical: MySQL Enterprise Edition
 
Simple Way for MySQL to NoSQL
Simple Way for MySQL to NoSQLSimple Way for MySQL to NoSQL
Simple Way for MySQL to NoSQL
 
MySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de GamesMySQL para Desenvolvedores de Games
MySQL para Desenvolvedores de Games
 
MySQL Community and Commercial Edition
MySQL Community and Commercial EditionMySQL Community and Commercial Edition
MySQL Community and Commercial Edition
 
MySQL HA Solutions
MySQL HA SolutionsMySQL HA Solutions
MySQL HA Solutions
 
MySQL For Oracle Developers
MySQL For Oracle DevelopersMySQL For Oracle Developers
MySQL For Oracle Developers
 
MySQL Enterprise Monitor
MySQL Enterprise MonitorMySQL Enterprise Monitor
MySQL Enterprise Monitor
 
MySQL Tech Tour Nov, 2013
MySQL Tech Tour Nov, 2013MySQL Tech Tour Nov, 2013
MySQL Tech Tour Nov, 2013
 
MySQL 8: Ready for Prime Time
MySQL 8: Ready for Prime TimeMySQL 8: Ready for Prime Time
MySQL 8: Ready for Prime Time
 
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql ClusterSanto Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
Santo Leto - MySQL Connect 2012 - Getting Started with Mysql Cluster
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
 
20191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv120191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv1
 
MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...
MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...
MySQL 20 años: pasado, presente y futuro; conoce las nuevas características d...
 
20200613 my sql-ha-deployment
20200613 my sql-ha-deployment20200613 my sql-ha-deployment
20200613 my sql-ha-deployment
 
My sql crashcourse_2012
My sql crashcourse_2012My sql crashcourse_2012
My sql crashcourse_2012
 
Oracle enterprise architects day
Oracle enterprise architects dayOracle enterprise architects day
Oracle enterprise architects day
 
Developing Applications with MySQL and Java
Developing Applications with MySQL and JavaDeveloping Applications with MySQL and Java
Developing Applications with MySQL and Java
 

More from MySQL Brasil

MySQL como Document Store PHP Conference 2017
MySQL como Document Store PHP Conference 2017MySQL como Document Store PHP Conference 2017
MySQL como Document Store PHP Conference 2017MySQL Brasil
 
MySQL no Paypal Tesla e Uber
MySQL no Paypal Tesla e UberMySQL no Paypal Tesla e Uber
MySQL no Paypal Tesla e UberMySQL Brasil
 
Alta disponibilidade com MySQL Enterprise
Alta disponibilidade com MySQL EnterpriseAlta disponibilidade com MySQL Enterprise
Alta disponibilidade com MySQL EnterpriseMySQL Brasil
 
MySQL Roadmap NoSQL HA Fev17
MySQL Roadmap NoSQL HA Fev17MySQL Roadmap NoSQL HA Fev17
MySQL Roadmap NoSQL HA Fev17MySQL Brasil
 
Segurança no MySQL
Segurança no MySQLSegurança no MySQL
Segurança no MySQLMySQL Brasil
 
5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQL5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQLMySQL Brasil
 
Alta disponibilidade no MySQL 5.7 GUOB 2016
Alta disponibilidade no MySQL 5.7 GUOB 2016Alta disponibilidade no MySQL 5.7 GUOB 2016
Alta disponibilidade no MySQL 5.7 GUOB 2016MySQL Brasil
 
MySQL 5.7 como Document Store
MySQL 5.7 como Document StoreMySQL 5.7 como Document Store
MySQL 5.7 como Document StoreMySQL Brasil
 
Enabling digital transformation with MySQL
Enabling digital transformation with MySQLEnabling digital transformation with MySQL
Enabling digital transformation with MySQLMySQL Brasil
 
Alta Disponibilidade no MySQL 5.7 para aplicações em PHP
Alta Disponibilidade no MySQL 5.7 para aplicações em PHPAlta Disponibilidade no MySQL 5.7 para aplicações em PHP
Alta Disponibilidade no MySQL 5.7 para aplicações em PHPMySQL Brasil
 
Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7MySQL Brasil
 
NoSQL no MySQL 5.7
NoSQL no MySQL 5.7NoSQL no MySQL 5.7
NoSQL no MySQL 5.7MySQL Brasil
 
10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em Startups10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em StartupsMySQL Brasil
 
Novidades do MySQL para desenvolvedores ago15
Novidades do MySQL para desenvolvedores ago15Novidades do MySQL para desenvolvedores ago15
Novidades do MySQL para desenvolvedores ago15MySQL Brasil
 
Estratégias de Segurança e Gerenciamento para MySQL
Estratégias de Segurança e Gerenciamento para MySQLEstratégias de Segurança e Gerenciamento para MySQL
Estratégias de Segurança e Gerenciamento para MySQLMySQL Brasil
 
Novidades do Universo MySQL julho-15
Novidades do Universo MySQL julho-15Novidades do Universo MySQL julho-15
Novidades do Universo MySQL julho-15MySQL Brasil
 
Serviços Escaláveis e de Alta Performance com MySQL e Java
Serviços Escaláveis e de Alta Performance com MySQL e JavaServiços Escaláveis e de Alta Performance com MySQL e Java
Serviços Escaláveis e de Alta Performance com MySQL e JavaMySQL Brasil
 
MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15MySQL Brasil
 

More from MySQL Brasil (20)

MySQL como Document Store PHP Conference 2017
MySQL como Document Store PHP Conference 2017MySQL como Document Store PHP Conference 2017
MySQL como Document Store PHP Conference 2017
 
MySQL no Paypal Tesla e Uber
MySQL no Paypal Tesla e UberMySQL no Paypal Tesla e Uber
MySQL no Paypal Tesla e Uber
 
MySQL 8.0.1 DMR
MySQL 8.0.1 DMRMySQL 8.0.1 DMR
MySQL 8.0.1 DMR
 
Alta disponibilidade com MySQL Enterprise
Alta disponibilidade com MySQL EnterpriseAlta disponibilidade com MySQL Enterprise
Alta disponibilidade com MySQL Enterprise
 
MySQL Roadmap NoSQL HA Fev17
MySQL Roadmap NoSQL HA Fev17MySQL Roadmap NoSQL HA Fev17
MySQL Roadmap NoSQL HA Fev17
 
Segurança no MySQL
Segurança no MySQLSegurança no MySQL
Segurança no MySQL
 
5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQL5 razões estratégicas para usar MySQL
5 razões estratégicas para usar MySQL
 
Alta disponibilidade no MySQL 5.7 GUOB 2016
Alta disponibilidade no MySQL 5.7 GUOB 2016Alta disponibilidade no MySQL 5.7 GUOB 2016
Alta disponibilidade no MySQL 5.7 GUOB 2016
 
MySQL 5.7 como Document Store
MySQL 5.7 como Document StoreMySQL 5.7 como Document Store
MySQL 5.7 como Document Store
 
Enabling digital transformation with MySQL
Enabling digital transformation with MySQLEnabling digital transformation with MySQL
Enabling digital transformation with MySQL
 
Alta Disponibilidade no MySQL 5.7 para aplicações em PHP
Alta Disponibilidade no MySQL 5.7 para aplicações em PHPAlta Disponibilidade no MySQL 5.7 para aplicações em PHP
Alta Disponibilidade no MySQL 5.7 para aplicações em PHP
 
Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7
 
NoSQL no MySQL 5.7
NoSQL no MySQL 5.7NoSQL no MySQL 5.7
NoSQL no MySQL 5.7
 
OpenStack & MySQL
OpenStack & MySQLOpenStack & MySQL
OpenStack & MySQL
 
10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em Startups10 Razões para Usar MySQL em Startups
10 Razões para Usar MySQL em Startups
 
Novidades do MySQL para desenvolvedores ago15
Novidades do MySQL para desenvolvedores ago15Novidades do MySQL para desenvolvedores ago15
Novidades do MySQL para desenvolvedores ago15
 
Estratégias de Segurança e Gerenciamento para MySQL
Estratégias de Segurança e Gerenciamento para MySQLEstratégias de Segurança e Gerenciamento para MySQL
Estratégias de Segurança e Gerenciamento para MySQL
 
Novidades do Universo MySQL julho-15
Novidades do Universo MySQL julho-15Novidades do Universo MySQL julho-15
Novidades do Universo MySQL julho-15
 
Serviços Escaláveis e de Alta Performance com MySQL e Java
Serviços Escaláveis e de Alta Performance com MySQL e JavaServiços Escaláveis e de Alta Performance com MySQL e Java
Serviços Escaláveis e de Alta Performance com MySQL e Java
 
MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15MySQL The State of the Dolphin - jun15
MySQL The State of the Dolphin - jun15
 

Recently uploaded

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 

Recently uploaded (20)

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 

MySQL para Desenvolvedores

  • 1. MySQL para Desenvolvedores Airton Lastori airton.lastori@oracle.com 30-jan-2013 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 2. @MySQLBR facebook.com/MySQLBR MySQLBR meetup.com/MySQL-BR 2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 3. 3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 4. Alguns clientes MySQL 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 5. Alguns clientes MySQL fonte: alexa.com/topsites 30-jan-2013 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 6. Alguns clientes MySQL mysql.com/customers 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 7. Alguns clientes MySQL mysql.com/customers 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 8. Tipos de aplicação 70% 60% 50% 40% 30% 20% 10% Enterprise 0% Community 8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 9. Desafio de desenvolvedor #1 Quais são os requisitos não funcionais da minha aplicação? 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 10. Na escolha da solução, considerar... Escalabilidade, performance, disponibilidade, estabilidade, segurança, simplicidade, flexibilidade, custo total de propriedade, conhecimento da equipe... Ah! Não esqueça da fase de produção, dos DBAs... ferramentas, suporte, rotinas de manutenção. 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 11. MySQL para desenvolvedores Conhecendo melhor o Portfolio universo MySQL para fazer boas escolhas… Ambiente de desenvolvimento Escalabilidade e Alta-disponibilidade 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 12. MySQL para desenvolvedores Conhecendo melhor o Portfolio universo MySQL para fazer boas escolhas… Ambiente de desenvolvimento Escalabilidade e Alta-disponibilidade 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 13. Compromisso Oracle com MySQL Community Portfólio disponível para download e uso sob GPL  MySQL Database Community Server  MySQL Cluster  MySQL Workbench  MySQL Connectors  MySQL Proxy  Documentação não GPL  Forums, Lists, Bugs, Blogs… 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 14. Conectores: amplo suporte a várias linguagens Oracle Comunidade • Connector/ODBC • PHP • Connector/Net (ADO.NET) • Perl • Connector/Python • Ruby • Connector/J (JDBC) • TCL • Connector/C (C API) • Eiffel • Connector/C++ (C++ API) • … dev.mysql.com/doc/refman/5.5/en/connectors-apis.html 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 15. MySQL Enterprise Edition Maior produtividade e mitigação de riscos Oracle Premier Lifetime Support MySQL Enterprise Oracle Product Security Certifications/Integrations MySQL Enterprise MySQL Enterprise Audit Monitor/Query Analyzer MySQL Enterprise MySQL Enterprise Scalability Backup MySQL Enterprise MySQL Workbench High Availability 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 16. MySQL para desenvolvedores Conhecendo melhor o Portfolio universo MySQL para fazer boas escolhas… Ambiente de desenvolvimento Escalabilidade e Alta-disponibilidade 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 17. Desafio de desenvolvedor #2 Instalação básica, ambiente de desenvolvimento… ...em 15 minutos, ou menos! 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 18. 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 19. No Linux ou Mac, prefira os binários mysql.com/downloads/mysql 19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 20. Cliente-Servidor Client mysql / mysql.exe Server mysqld / mysqld.exe 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 21. Iniciar ou Parar o servidor MySQL no Windows …ou via MySQL Notifier 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 22. Iniciar ou Parar o servidor MySQL no Linux Iniciar: /usr/local/mysql/bin> mysqld_safe --defaults-file=/etc/my.cnf & Parar: /usr/local/mysql/bin> mysqladmin shutdown dev.mysql.com/doc/refman/5.5/en/mysqld-safe.html 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 23. Primeira conexão C:Program FilesMySQLMySQL Server 5.5bin>mysql -uroot -p Enter password: **** Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 8 Server version: 5.5.28 MySQL Community Server (GPL) Copyright (c) 2000, 2012, 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> 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 24. Teste via MySQL Workbench 1/2 24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 25. Teste via MySQL Workbench 2/2 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 26. Cliente-Servidor App + Connector JDBC, ODBC, .Net, PHP, Python, Perl, Ruby, Native C API… Server mysqld / mysqld.exe 26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 27. Desafio de desenvolvedor #3 Hello World… ...em Java 27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 28. Adicione o driver MySQL ao CLASSPATH caminho completo do .jar Confira: C:>set CLASSPATH CLASSPATH=.;C:Program Files (x86)Javajre6libextQTJava.zip;C:Program FilesMySQLmysql-connector-java-5.1.22mysql-connector-java-5.1.22-bin.jar 28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 29. HelloMysql.java 1/2 import java.sql.*; public class HelloMysql { public static void main(String args[]){ System.out.println("Tentando conectar ao MySQL..."); try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/mysql"; String usuario = "root"; String senha = "root"; Connection con = DriverManager.getConnection(url, usuario, senha); System.out.println("URL: " + url); System.out.println("Connection: " + con); Continua… 29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 30. HelloMysql.java 2/2 Statement stmt = con.createStatement(); //objeto Statement ResultSet rs; //objeto ResultSet rs = stmt.executeQuery("SELECT * FROM world.country"); System.out.println("Ola mundo!"); while(rs.next()){ String nomePais = rs.getString("Name"); System.out.print(nomePais + ", "); }//end while con.close(); } catch( Exception e ) { e.printStackTrace(); }//end catch }//end main }//end class HelloMysql PRONTO! 30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 31. java HelloMysql C:tutorial>javac HelloMysql.java C:tutorial>java HelloMysql Tentando conectar ao MySQL... URL: jdbc:mysql://localhost:3306/mysql Connection: com.mysql.jdbc.JDBC4Connection@ed07f45 Ola mundo! Aruba, Afghanistan, Angola, Anguilla, Albania, Andorra, Netherlands Antilles, Un ited Arab Emirates, Argentina, Armenia, American Samoa, Antarctica, French South ern territories, Antigua and Barbuda, Australia, Austria, Azerbaijan, Burundi, B elgium, Benin, Burkina Faso, Bangladesh, Bulgaria, Bahrain, Bahamas, Bosnia and Herzegovina, Belarus, Belize, Bermuda, Bolivia, Brazil, Barbados, Brunei, Bhutan … ietnam, Vanuatu, Wallis and Futuna, Samoa, Yemen, Yugoslavia, South Africa, Zamb ia, Zimbabwe, 31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 32. Próximo passo: documentação Reference Manual 1. Tutorial 2. SQL Syntax 3. Connectors & APIs, Memcached 4. Functions, Views, Stored Programs 5. Optimization dev.mysql.com/doc/refman/5.5/en/index.html 32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 33. MySQL para desenvolvedores Conhecendo melhor o Portfolio universo MySQL para fazer boas escolhas… Ambiente de desenvolvimento Escalabilidade e Alta-disponibilidade 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 34. Desafio do desenvolvedor #4 Projetar uma solução para disponibilidade 24x7… ...a famosa alta-disponibilidade 34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 35. Alta-Disponibilidade Clustering & Custo & Complexidade Redundância Geográfica Clustering & Virtualização Replicação ISPs & On-Line eCommerce Corporativo Services Telecoms, Militar 9 35 dias 9 4 days 4 dias . 9 8 horas 9 50 min 9 5 min % 35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 36. Replicação MySQL Aplicação Escritas & Leituras Master Slave • Modelo assíncrono (padrão) • Modelo semi-síncrono (a partir da versão 5.5) 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 37. MySQL failover Aplicação Escritas & Leituras Master Slave • Master down • Slave promovido para Master 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 38. Alta-Disponibilidade Clustering & Redundância Custo & Complexidade Geográfica Clustering & Virtualização DRBD Replicação Replicação ISPs & On-Line eCommerce Corporativo Services Telecoms, Militar 9 35 dias 9 4 days 4 dias . 9 8 horas 9 50 min 9 5 min % 38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 39. Soluções certificadas MySQL HA: resumo MySQL 5.6 Windows Solaris Oracle VM MySQL DRBD Replication Cluster Cluster Template Cluster Nível de disponibilidade 99.9% 99.95% 99.99% 99.99% 99.99% 99.999% Auto-Failover ✔ ✔ ✔ ✔ ✔ ✔ Sem perda de dados durante ✔ failover Semi-Sync ✔ ✔ ✔ ✔ ✔ Plataformas suportadas All Windows Solaris Linux Linux All Master + Active / Active / Active / Active / Multi- Modo de clusterização Slaves Passive Passive Passive Passive Master Dispensa Shared Storage ✔ ✖ ✖ ✖ ✔ ✔ Ponto único de suporte ✔ ✖ ✔ ✔ ✔ ✔ mysql.com/why-mysql/white-papers/mysql_wp_ha_strategy_guide.php 39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 40. Desafio do desenvolvedor #5 Projetar uma solução que possa crescer para comportar milhões de usuários… 40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 41. Escalabilidade: horizontal vs vertical Scale Out Scale Up • Adicionar mais servidores para • Trocar por hardware mais aumentar performance poderoso, adicionar memória, • MySQL adota esta abordagem CPU em sistemas altamente • Outras soluções normalmente escaláveis em hardware usam hardware proprietário commodity (Intel / AMD) (SMP) 41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 42. Evolução da escalabilidade do MySQL 2008 2009 2010 2013 até 4 CPU até 16 CPU até 32 CPU até 48 CPU MySQL 5.0 MySQL 5.1 MySQL 5.5 MySQL 5.6 MySQL AB Sun Oracle 42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 43. Benchmarks MySQL 5.5 vs 5.6 Sysbench 32-core Mesmo Hardware Tuning ótimo 43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 44. Benchmarks MySQL 5.5 vs 5.6 Sysbench 32-core Mesmo Hardware Tuning ótimo Sysbench 32-core Same Hardware Optimal Tuning 44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 45. Escalabilidade horizontal Particionamento Replicação MySQL Data Sharding Funcional • método mais simples e • dividir a carga em múltiplos • método de maior sucesso mais comum nós, com responsabilidades para escalar aplicações distintas MySQL de grande porte • indicado para aplicações hoje de LEITURA intensiva • os nós podem ter redundância via replicação • dados compartilhados em • problemas com cache para alta-disponibilidade tabelas/caches globais, duplicado em aplicações • normalmente não é SOA com datasets grandes transparente para a aplicação • difícil de adaptar e também recorre ao scale up aplicações legadas para cada database funcional, o que impõe limites 45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 46. Replicação MySQL: escalando LEITURAS Aplicação Escritas & Leituras Leituras Master Slave • Divisão de leituras e escritas (R/W Split) • É possível adicionar mais slaves, dividir a carga 46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 47. Data Sharding: escalando ESCRITAS Table T1 Data Node 1 P1 Data Node 2 P2 P3 Data Node 3 P4 Data Node 4 47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 48. Data Sharding: escalando ESCRITAS Table T1 Data Node 1 F1 P1 Data Node 2 P2 P3 Data Node 3 P4 Data Node 4 48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 49. Data Sharding: escalando ESCRITAS Table T1 Data Node 1 F1 P1 Data Node 2 F3 P2 P3 Data Node 3 P4 Data Node 4 49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 50. Data Sharding: escalando ESCRITAS Table T1 Data Node 1 F1 P1 Data Node 2 F3 P2 P3 Data Node 3 F2 P4 Data Node 4 50 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 51. Data Sharding: escalando ESCRITAS Table T1 Data Node 1 F1 P1 Data Node 2 F3 P2 P3 Data Node 3 F2 P4 Data Node 4 F4 51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 52. Desafios do desenvolvedor #4 + #5 É possível combinar alta- disponibilidade e escalabilidade? ...assim como Facebook, Twitter, Youtube 52 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 53. Data Sharding + Replicação Table T1 Data Node 1 F1 P1 Data Node 2 F1 P2 P3 Data Node 3 P4 Data Node 4 53 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 54. Data Sharding + Replicação Table T1 Data Node 1 F1 F3 P1 Data Node 2 F3 F1 P2 P3 Data Node 3 P4 Data Node 4 54 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 55. Alta-Disponibilidade: Replicação Síncrona Table T1 Data Node 1 F1 F3 P1 Data Node 2 F3 F1 P2 P3 Data Node 3 F2 P4 Data Node 4 F2 55 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 56. Data Sharding + Replicação Table T1 Data Node 1 F1 F3 P1 Data Node 2 F3 F1 P2 P3 Data Node 3 F2 F4 P4 Data Node 4 F4 F2 56 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 57. Data Sharding + Replicação Table T1 Data Node 1 F1 F3 Group 1 P1 Data Node 2 F3 F1 P2 P3 Data Node 3 F2 F4 P4 Group 2 Data Node 4 F4 F2 57 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 58. Data Sharding + Replicação Table T1 Data Node 1 F1 F3 Group 1 P1 Data Node 2 F3 F1 P2 P3 Data Node 3 F2 F4 P4 Group 2 Data Node 4 F4 F2 58 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 59. Casos de muito sucesso  Facebook  Youtube  Twitter  Flickr  Evernote  Pinterest … highscalability.com 59 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 60. MySQL Cluster: auto-sharding Clients Application Layer Management Management Data Layer Table T1 F1 F3 F2 F4 P1 F3 F1 F4 F2 P2 P3 MySQL Cluster Data Nodes P4 60 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 61. APIs de Acesso aos Dados Os mesmos dados acessados simultaneamente através de interfaces SQL e NoSQL 61 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 62. Alguns Clientes MySQL Cluster 62 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 63. Caso de sucesso •2 milhões usuários, com 30.000 novos usuários por dia •10.000 usuários concorrentes •10.000 Transações Por Segundo •99.999% uptime “The MySQL support service has been essential in helping us for troubleshooting and giving recommendations for the production cluster.” Carlos Morales (DBA), Playfulplay.com blogs.oracle.com/MySQL/entry/mysql_cluster_powers_el_chavo 63 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 64. MySQL Cluster Carrier Grade • Arquitetura shared-nothing in-memory parallel Database • Modelo relacional ACID, SQL • 99.999% de disponibilidade Alta Disponibilidade • Self-healing, failover abaixo de 1 segundo • Performance em tempo real para altas cargas Alta Performance • Latência baixa e preditiva • Elasticidade, crescimento incremental Escalabilidade • Escalabilidade linear, distribuition aware • Open Source, hardware commodity Open Source • APIs NoSQL (C++, Java, Memcached, Node.js) 64 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 65. MySQL Cluster Auto-Install (beta)  Simples de instalar e provisionar clusters multi-node  Complementa MySQL Cluster Manager no gerenciamento de cliclo de vida 65 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 66. MySQL Cluster Manager Para testes em uma única máquina 1. Download MCM/Cluster edelivery.oracle.com: 2. Unzip e execute o comando: C:MySQLmcmbin> mcmd –bootstrap MySQL Cluster Manager 1.1.2 started Connect to MySQL Cluster Manager by running “C:MySQLmcmbinmcm" -a NOVA:1862 Configuring default cluster 'mycluster'... Starting default cluster 'mycluster'... Cluster 'mycluster' started successfully ndb_mgmd NOVA:1186 ndbd NOVA ndbd NOVA mysqld NOVA:3306 mysqld NOVA:3307 ndbapi * Connect to the database by running “C:MySQLmcmclusterbinmysql" -h NOVA -P 3306 -u root 66 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 67. Mais sobre como começar com MySQL Cluster Whitepaper: MySQL Cluster Evaluation Guide February 2012 mysql.com/why-mysql/white-papers/mysql- cluster-evaluation-guide/ 67 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 68. Exemplos Memcached API On-demand Webinar: NoSQL Memcached API for MySQL Cluster 22 August 2012 mysql.com/news-and-events/on-demand-webinars/display-od-723.html 68 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 69. Exemplos JavaScript / Node.js API Blog: Tutorial Getting Started with the NoSQL JavaScript / Node.js API for MySQL Cluster 10 June 2012 blogs.oracle.com/MySQL/entry/tutorial_getting_started_with_the 69 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 70. Novo Desafio do desenvolvedor Big Data 70 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 71. MySQL in the Big Data Lifecycle ACQUIRE DECIDE BI Solutions NoSQL APIs Binlog API ANALYZE ORGANIZE 71 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 72. MySQL e Big Data Whitepaper: MySQL and Hadoop – Big Data Integration December 2012 mysql.com/why-mysql/white-papers/mysql- and-hadoop-guide-to-big-data-integration/ 72 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 73. Sumário  O MySQL é o banco de dados open source mais popular do mundo, usado em grandes sites, aplicações mobile e embarcadas.  Há várias opções de arquiteturas e APIs, oferecendo enorme flexibilidade, escalabilidade e alta-disponibilidade.  Instale e comece a usar em menos de 15min. Use e abuse da documentação! 73 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 74. @MySQLBR facebook.com/MySQLBR Obrigado! meetup.com/MySQL-BR 74 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 75. MySQL para Desenvolvedores Perguntas? 75 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 76. Arquitetura MySQL Server Clients and Apps Clients & Connectors mysqld Native C API, JDBC, ODBC, .Net, PHP, Ruby, Python, VB, Perl Connection Pool, SQL Interface, Parser, Optimizer, Caches Enterprise Management Services and Utilities Backup & Recovery Storage Engines Monitor InnoDB, MyISAM, Memory, Archive, Cluster (NDB API), etc… Workbench Utilities Filesystems, Files and Logs Data, Index, Redo, Undo, Binary, Error, Slow 76 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12
  • 77. Storage Engines MyISAM InnoDB NDB Cluster Transações ✖ ✔ ✔ Nível de Lock Tabela Linha Linha Assíncrona ou Assíncrona ou Replicação Síncrona, Multi-master Semi-síncrona Semi-síncrona Foreign Keys ✖ ✔ a partir da v7.3 Full-text indexes ✔ a partir da v5.6 ✖ Compressão de dados somente Leitura ✔ ✖ Caches somente Índices Dados e Índices Dados e Índices Suporte Geospacial Tipos de Dados e Índices somente Tipos de Dados somente Tipos de Dados Limite de armazenamento 256TB 64TB 384EB dev.mysql.com/doc/refman/5.5/en/storage-engines.html 77 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12