MySQL para Desenvolvedores de Games
-
Upload
mysql-brasil -
Category
Documents
-
view
340 -
download
4
description
Transcript of MySQL para Desenvolvedores de Games
![Page 1: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/1.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1
Airton Lastori [email protected]
14-mar-2013
MySQL para Desenvolvedores de Games
![Page 2: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/2.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 2
@MySQLBR
meetup.com/MySQL-BR
facebook.com/MySQLBR
MySQLBR
![Page 3: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/3.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 3
Alguns clientes MySQL
![Page 4: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/4.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 4
Alguns clientes MySQL
fonte: alexa.com/topsites 30-jan-2013
![Page 5: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/5.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 5
Alguns clientes MySQL
mysql.com/customers
![Page 6: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/6.jpg)
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
![Page 7: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/7.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 7
MySQL: casos de sucesso
+ de 20 indústrias
mysql.com/customers
![Page 8: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/8.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 8
Indústria: Games
mysql.com/customers/industry/?id=83
![Page 9: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/9.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 9
Seu game precisa de um SGBD?
Qual o tipo de distribuição do game?
Download, Streaming, Online, Mobile...
![Page 10: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/10.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 10
Quase todos tipos de games modernos
necessitam de um sistema robusto de
armazenamento de dados
Dependendo da distribuição, o banco de dados pode ser
embarcado, centralizado ou distribuído.
![Page 11: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/11.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 11
Game sem UI
MySQLgame
mysqlgame.com
![Page 12: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/12.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 12
Como escolher um SGBD?
Desafio de desenvolvedor #1
![Page 13: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/13.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 13
…pense nos requisitos não funcionais…
![Page 14: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/14.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 14
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.
![Page 15: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/15.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 15
MySQL para desenvolvedores
Portfolio
Ambiente de desenvolvimento
Escalabilidade e Alta-disponibilidade
Conhecendo melhor o
universo MySQL para
fazer boas escolhas…
![Page 16: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/16.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 16
MySQL para desenvolvedores
Portfolio
Ambiente de desenvolvimento
Escalabilidade e Alta-disponibilidade
Conhecendo melhor o
universo MySQL para
fazer boas escolhas…
![Page 17: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/17.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 17
MySQL Database Community Server
MySQL Cluster
MySQL Workbench
MySQL Connectors
MySQL Proxy
Documentação não GPL
Forums, Lists, Bugs, Blogs…
Compromisso Oracle com MySQL Community Portfólio disponível para download e uso sob GPL
![Page 18: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/18.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 18
Conectores: amplo suporte a várias linguagens
Oracle
• Connector/ODBC
• Connector/Net (ADO.NET)
• Connector/Python
• Connector/J (JDBC)
• Connector/C (C API)
• Connector/C++ (C++ API)
Comunidade
• PHP
• Perl
• Ruby
• TCL
• Eiffel
• …
dev.mysql.com/doc/refman/5.5/en/connectors-apis.html
![Page 19: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/19.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 19
Oracle Premier Lifetime Support
Oracle Product Certifications/Integrations
MySQL Enterprise High Availability
MySQL Enterprise Security
MySQL Enterprise Scalability
MySQL Enterprise Backup
MySQL Enterprise Monitor/Query Analyzer
MySQL Workbench
MySQL Enterprise Edition Maior produtividade e mitigação de riscos
MySQL Enterprise Audit
![Page 20: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/20.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 20
MySQL para desenvolvedores
Portfolio
Ambiente de desenvolvimento
Escalabilidade e Alta-disponibilidade
Conhecendo melhor o
universo MySQL para
fazer boas escolhas…
![Page 21: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/21.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 21
Desafio de desenvolvedor #2
Instalação básica, ambiente de
desenvolvimento…
...em 15 minutos, ou menos!
![Page 22: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/22.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 22
![Page 23: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/23.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 23
mysql.com/downloads/mysql
No Linux ou Mac, prefira os binários
![Page 24: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/24.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 24
Client mysql / mysql.exe
Server mysqld / mysqld.exe
Cliente-Servidor
![Page 25: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/25.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 25
Iniciar ou Parar o servidor MySQL no Windows
…ou via MySQL Notifier
![Page 26: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/26.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 26
Iniciar ou Parar o servidor MySQL no Linux
/usr/local/mysql/bin> mysqld_safe --defaults-file=/etc/my.cnf &
/usr/local/mysql/bin> mysqladmin shutdown
Parar:
Iniciar:
dev.mysql.com/doc/refman/5.5/en/mysqld-safe.html
![Page 27: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/27.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 27
Primeira conexão
C:\Program Files\MySQL\MySQL Server 5.5\bin>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>
![Page 28: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/28.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 28
Teste via MySQL Workbench 1/2
![Page 29: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/29.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 29
Teste via MySQL Workbench 2/2
![Page 30: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/30.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 30
App + Connector JDBC, ODBC, .Net, PHP, Python, Perl, Ruby, Native C API…
Server mysqld / mysqld.exe
Cliente-Servidor
![Page 31: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/31.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 31
Desafio de desenvolvedor #3
Hello World…
...em Java
![Page 32: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/32.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 32
Adicione o driver MySQL ao CLASSPATH caminho completo do .jar
C:\>set CLASSPATH
CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip;C:\Program
Files\MySQL\mysql-connector-java-5.1.22\mysql-connector-java-5.1.22-bin.jar
Confira:
![Page 33: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/33.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 33
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…
![Page 34: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/34.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 34
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!
![Page 35: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/35.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 35
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,
![Page 36: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/36.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 36
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
![Page 37: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/37.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 37
MySQL para desenvolvedores
Portfolio
Ambiente de desenvolvimento
Escalabilidade e Alta-disponibilidade
Conhecendo melhor o
universo MySQL para
fazer boas escolhas…
![Page 38: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/38.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 38
Desafio do desenvolvedor #4
Projetar uma solução para
disponibilidade 24x7…
...a famosa alta-disponibilidade
![Page 39: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/39.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 39
% 9 9 9 9 35 dias 4 days 50 min 5 min 8 horas
Replicação
Clustering &
Virtualização
Clustering &
Redundância
Geográfica
ISPs &
Corporativo
On-Line
Services
eCommerce
Telecoms, Militar
. 9 4 dias
Cu
sto
& C
om
ple
xid
ad
e
Alta-Disponibilidade
![Page 40: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/40.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 40
Aplicação
Master Slave
• Modelo assíncrono (padrão)
• Modelo semi-síncrono (a partir da versão 5.5)
Escritas & Leituras
Replicação MySQL
![Page 41: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/41.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 41
Aplicação
Master Slave
• Master down
• Slave promovido para Master
Escritas & Leituras
MySQL failover
![Page 42: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/42.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 42
Replicação
Clustering &
Virtualização
Clustering &
Redundância
Geográfica
Replicação
DRBD
Cu
sto
& C
om
ple
xid
ad
e
Alta-Disponibilidade
% 9 9 9 9 35 dias 4 days 50 min 5 min 8 horas
eCommerce
Telecoms, Militar
. 9 4 dias
ISPs &
Corporativo
On-Line
Services
![Page 43: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/43.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 43
Soluções certificadas MySQL HA: resumo
mysql.com/why-mysql/white-papers/mysql_wp_ha_strategy_guide.php
MySQL 5.6
Replication
Windows
Cluster
Solaris
Cluster
Oracle VM
Template DRBD
MySQL
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
Modo de clusterização Master +
Slaves
Active /
Passive
Active /
Passive
Active /
Passive
Active /
Passive
Multi-
Master
Dispensa Shared Storage ✔ ✖ ✖ ✖ ✔ ✔
Ponto único de suporte ✔ ✖ ✔ ✔ ✔ ✔
![Page 44: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/44.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 44
Desafio do desenvolvedor #5
Projetar uma solução que possa
crescer para comportar milhões
de usuários…
![Page 45: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/45.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 45
Scale Out
• Adicionar mais servidores para
aumentar performance
• MySQL adota esta abordagem
em sistemas altamente
escaláveis em hardware
commodity (Intel / AMD)
Scale Up
• Trocar por hardware mais
poderoso, adicionar memória,
CPU
• Outras soluções normalmente
usam hardware proprietário
(SMP)
Escalabilidade: horizontal vs vertical
![Page 46: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/46.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 46
2008
até 4 CPU
MySQL 5.0
MySQL AB
até 16 CPU
MySQL 5.1
Sun
até 32 CPU
MySQL 5.5
Oracle
até 48 CPU
MySQL 5.6
Evolução da escalabilidade do MySQL
2009 2010 2013
![Page 47: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/47.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 50
Replicação MySQL: escalando LEITURAS
• Divisão de leituras e escritas (R/W Split)
• É possível adicionar mais slaves, dividir a carga
Leituras
Aplicação
Master Slave
Escritas & Leituras
![Page 48: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/48.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 51
Data Node 1
Data Node 2
Data Node 3
Data Node 4
Table T1
P2
P3
P4
P1
Data Sharding: escalando ESCRITAS
![Page 49: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/49.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 52
Data Node 1
Data Node 2
F1
Data Node 3
Data Node 4
Table T1
P2
P3
P4
P1
Data Sharding: escalando ESCRITAS
![Page 50: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/50.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 53
Data Node 1
Data Node 2
F1
F3
Data Node 3
Data Node 4
Table T1
P2
P3
P4
P1
Data Sharding: escalando ESCRITAS
![Page 51: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/51.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 54
Data Node 1
Data Node 2
F1
F3
Data Node 3
Data Node 4
F2
Table T1
P2
P3
P4
P1
Data Sharding: escalando ESCRITAS
![Page 52: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/52.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 55
Data Node 1
Data Node 2
F1
F3
Data Node 3
Data Node 4
F2
F4
Table T1
P2
P3
P4
P1
Data Sharding: escalando ESCRITAS
![Page 53: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/53.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 56
Desafios do desenvolvedor #4 + #5
É possível combinar alta-
disponibilidade e escalabilidade?
...assim como Facebook, Twitter, Youtube
![Page 54: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/54.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 57
Data Node 1
Data Node 2
F1
F1
Data Node 3
Data Node 4
Table T1
P2
P3
P4
P1
Data Sharding + Replicação
![Page 55: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/55.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 58
Data Node 1
Data Node 2
F1 F3
F1
Data Node 3
Data Node 4
Table T1
P2
P3
P4
P1 F3
Data Sharding + Replicação
![Page 56: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/56.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 59
Data Node 1
Data Node 2
F1 F3
F3 F1
Data Node 3
Data Node 4
F2
F2
Table T1
P2
P3
P4
P1
Alta-Disponibilidade: Replicação Síncrona
![Page 57: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/57.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 60
Data Node 1
Data Node 2
F1 F3
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Table T1
P2
P3
P4
P1
Data Sharding + Replicação
![Page 58: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/58.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 61
Data Node 1
Data Node 2
F1 F3
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Gro
up
1
Table T1
P2
P3
P4
P1
Data Sharding + Replicação
Gro
up
2
![Page 59: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/59.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 62
Data Node 1
Data Node 2
F1 F3
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Gro
up
1
Table T1
P2
P3
P4
P1
Data Sharding + Replicação
Gro
up
2
![Page 60: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/60.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 64
MySQL Cluster
• Arquitetura shared-nothing in-memory parallel
• Modelo relacional ACID, SQL
Carrier Grade Database
• 99.999% de disponibilidade
• Self-healing, failover abaixo de 1 segundo Alta Disponibilidade
• Performance em tempo real para altas cargas
• Latência baixa e preditiva Alta Performance
• Elasticidade, crescimento incremental
• Escalabilidade linear, distribuition aware Escalabilidade
• Open Source, hardware commodity
• APIs NoSQL (C++, Java, Memcached, Node.js) Open Source
![Page 61: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/61.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 65
Alguns Clientes MySQL Cluster
![Page 62: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/62.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 66
Alguns Clientes MySQL Cluster
![Page 63: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/63.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 67
MySQL Cluster Data Nodes
Data Layer
Clients
Application Layer
Management
MySQL Cluster: auto-sharding
Table T1
P2
P3
P4
P1 F1
F3
F3
F1 F2
F4
F4
F2
Management
![Page 64: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/64.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 68
Os mesmos dados
acessados
simultaneamente
através de interfaces
SQL e NoSQL
APIs de Acesso aos Dados
![Page 65: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/65.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 69
•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
Caso de sucesso
![Page 66: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/66.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 70
MySQL Cluster Auto-Install (beta)
Simples de instalar e provisionar clusters multi-node
Complementa MySQL Cluster Manager no gerenciamento de cliclo de vida
![Page 67: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/67.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 71
1. Download MCM/Cluster edelivery.oracle.com:
2. Unzip e execute o comando:
MySQL Cluster Manager Para testes em uma única máquina
C:\MySQL\mcm\bin> mcmd –bootstrap
MySQL Cluster Manager 1.1.2 started
Connect to MySQL Cluster Manager by running “C:\MySQL\mcm\bin\mcm" -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:\MySQL\mcm\cluster\bin\mysql" -h NOVA -P 3306 -u root
![Page 68: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/68.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 72
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/
![Page 69: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/69.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 73
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
![Page 70: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/70.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 74
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
![Page 71: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/71.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 75
Sumário
O MySQL é o banco de dados open source mais popular do
mundo, usado em grandes sites, games, 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!
![Page 72: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/72.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 76
@MySQLBR
meetup.com/MySQL-BR
facebook.com/MySQLBR
Obrigado!
![Page 73: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/73.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 77
Perguntas?
MySQL para Desenvolvedores
![Page 74: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/74.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 78
Clients & Connectors 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
Monitor
Workbench
Utilities
mysqld
Clients and Apps
Arquitetura MySQL Server
Storage Engines InnoDB, MyISAM, Memory, Archive, Cluster (NDB API), etc…
Filesystems, Files and Logs Data, Index, Redo, Undo, Binary, Error, Slow
![Page 75: MySQL para Desenvolvedores de Games](https://reader035.fdocuments.in/reader035/viewer/2022081403/5560c19dd8b42a033c8b5667/html5/thumbnails/75.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 79
Storage Engines
MyISAM InnoDB NDB Cluster
Transações ✖ ✔ ✔
Nível de Lock Tabela Linha Linha
Replicação Assíncrona ou
Semi-síncrona
Assíncrona ou
Semi-síncrona Síncrona, Multi-master
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