Download - MySQL Roadmap NoSQL HA Fev17
MySQL 5.7 Visão e Roadmap
Airton Lastori [email protected] Fevereiro-2017
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Visão
apresentada no Oracle Open World 2016 em San Francisco, CA
2
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 3
Scale-Out
Ease-of-Use
Out-of-Box Solution
MySQL
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 4
Read Scale-Out
Async Replication + Auto Failover
Write Scale-Out
Sharding
S1
S2
S3
S4
MySQL Vision – 4 Steps
Timeline
MySQL Document Store
Relational & Document Model
MySQL HA
Out-Of-Box HA
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 5
Read Scale-Out
Async Replication + Auto Failover
Write Scale-Out
Sharding
S1
S2
S3
S4
MySQL Vision – S1
Timeline
MySQL Document Store
Relational & Document Model
MySQL HA
Out-Of-Box HA
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 6
http://db-engines.com/en/ranking_trend (jan-2017)
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 7
http://db-engines.com/en/ranking_categories
183 NoSQL
12 categorias
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Usa MySQL como NoSQL
eng.uber.com/schemaless-part-one
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Usa MySQL como NoSQL
eng.uber.com/schemaless-part-one
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 10
Exemplo CRUD Document API MySQL 5.7.12+
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 11
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 12
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 13
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 15
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 17
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 18
Banco de Dados Híbrido: Confiabilidade + Flexibilidade
MySQL 5.7
Document Store
Suporte JSON
Nova API
BDs Relacionais Tecnologia madura,
comprovadamente segura. Transações, queries, JOINs
complexos e conjunto extenso de ferrametnas
operacionais
NoSQL Flexibilidade. Escalabilidade
horizontal e facilidade de uso, schemaless, document
store (JSON)
Aplicações Modernas Agile + DevOps com proteção robusta dos dados
Banco de Dados Híbrido Melhor dos mundos, sem trade-offs. Propriedades ACID & confiabilidade de SGBDR + flexibilidade de document store
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Exemplo Modelo híbrido: Schema + Schemaless
19
mysql> CREATE DATABASE product_hybrid_test; mysql> USE product_hybrid_test;
mysql> CREATE TABLE product_info_hybrid (
product_id INT NOT NULL PRIMARY KEY,
description VARCHAR(60) NOT NULL,
price FLOAT NOT NULL,
attributes JSON NOT NULL
);
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 20
Exemplo CRUD modelo híbrido MySQL 5.7.12+
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
CREATE 1
mysql> INSERT INTO product_info_hybrid VALUES (
9,
't-shirt',
20.0,
'{
"size" : "M",
"color" : "red",
"fabric" : "cotton"
}');
Query OK, 1 row affected (0.01 sec)
21
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
CREATE 2
mysql> INSERT INTO product_info_hybrid VALUES (
10,
'socks',
15.0,
'{
"size" : "40"
}');
Query OK, 1 row affected (0.01 sec)
22
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
READ mysql> SELECT * FROM product_info_hybrid;
+------------+-------------+-------+---------------------------------------------------+
| product_id | description | price | attributes |
+------------+-------------+-------+---------------------------------------------------+
| 9 | t-shirt | 20 | {"size": "M", "color": "red", "fabric": "cotton"} |
| 10 | socks | 15 | {"size": "40"} |
+------------+-------------+-------+---------------------------------------------------+
2 rows in set (0.00 sec)
23
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
READ com filtro mysql> SELECT * FROM product_info_hybrid WHERE attributes->"$.size"="40";
+------------+-------------+-------+----------------+
| product_id | description | price | attributes |
+------------+-------------+-------+----------------+
| 10 | socks | 15 | {"size": "40"} |
+------------+-------------+-------+----------------+
1 row in set (0.00 sec)
24
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
UPDATE mysql> UPDATE product_info_hybrid SET attributes = '{"size": "42"}' WHERE
product_id=10;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT * FROM product_info_hybrid;
+------------+-------------+-------+---------------------------------------------------+
| product_id | description | price | attributes |
+------------+-------------+-------+---------------------------------------------------+
| 9 | t-shirt | 20 | {"size": "M", "color": "red", "fabric": "cotton"} |
| 10 | socks | 15 | {"size": "42"} |
+------------+-------------+-------+---------------------------------------------------+
2 rows in set (0.00 sec)
25
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
DELETE mysql> DELETE FROM product_info_hybrid WHERE attributes->"$.size"="42";
Query OK, 1 row affected (0.01 sec)
mysql> SELECT * FROM product_info_hybrid;
+------------+-------------+-------+---------------------------------------------------+
| product_id | description | price | attributes |
+------------+-------------+-------+---------------------------------------------------+
| 9 | t-shirt | 20 | {"size": "M", "color": "red", "fabric": "cotton"} |
+------------+-------------+-------+---------------------------------------------------+
1 row in set (0.00 sec)
26
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Coluna
• Mais integridade no schema, independente da aplicação
• Schema torna a aplicação mais fácil de manter no longo prazo, pois há maior controle nas mudanças
– Espera-se uma maior qualidade dos dados
– Permite aplicação de algumas validações automáticas sobre os dados
JSON
• Mais liberdade para representar dados (ex. Campos custom)
• Denormalização natural, registro auto-contido (ex. facilita escalabilidade horizontal via sharding)
• Protótipos rápidos, comece armazenar dados imediatamente
• Menor preocupação na definição de Tipos de Dados
• Menos dor-de-cabeça para aplicar mudanças no modelo de dados
Oracle Confidential – Internal/Restricted/Highly Restricted 27
Coluna ou JSON? Você escolhe!
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 28
Read Scale-Out
Async Replication + Auto Failover
Write Scale-Out
Sharding
S1
S2
S3
S4
MySQL Vision – S1
Timeline
MySQL Document Store
Relational & Document Model
MySQL HA
Out-Of-Box HA
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 29
Read Scale-Out
Async Replication + Auto Failover
Write Scale-Out
Sharding
S1
S2
S3
S4
MySQL Vision – S2
Timeline
MySQL Document Store
Relational & Document Model
MySQL HA
Out-Of-Box HA
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL Connector
Application MySQL Connector
Application
MySQL Shell
MySQL Connector
Application
MySQL Connector
Application
MySQL InnoDB Cluster – Architecture – S2
MySQL InnoDB
cluster MySQL Enterprise Monitor
…
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL
InnoDB cluster
MySQL InnoDB Cluster – Architecture – S2
M
M M
MySQL Connector
Application
MySQL Router
MySQL Connector
Application
MySQL Router
MySQL Shell
HA
Group Replication
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Master Primário
MySQL Replication
Slave Réplica
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Falhou!
MySQL Replication
Novo Master
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Sem perda de dados e failover facilitado com replicação Semi-síncrona
Topologias resilientes com Múltiplos Slaves
34
Master Slave 1 (local) Primeira opção de failover (sempre mais atualizado)
Slave 2 (remoto) Segunda opção de failover
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Componentes para Roteamento de conexões
MySQL Connectors
• Funcionalidades nativas de Failover ou Load Balancing
MySQL Router (novo )
•Middleware leve
• Roteamento baseado nas conexões
• Failover para o primeiro disponível ou Load Balancing
MySQL Utilities
•mysqlfailover – monitora a replicação, promove novo master e redireciona slaves
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Arquitetura: replication + router + mysqlfailover
Router
App
VIP
mysqlfailover
Read-write
Read-only
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
DC 1 - ativo
Arquitetura: replication + router + mysqlfailover
Router
App
VIP
mysqlfailover
Read-write
Read-only
DC 2 - standby
Router
App
VIP
mysqlfailover
semisync semisync async
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL Group Replication
Grupo 3+ primários atuando como 1
Primário
Réplica
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
High-Availability
1 membro falhou! Grupo continua disponível
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
High-Availability
2 membros falharam Modo Somente Leitura
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL Group Replication: O que é?
• Replicação multi-master para InnoDB
– permite escrita em qualquer nó do cluster
– recuperação automática (failover, switchover e failback)
– Inspirado no protocolo PAXOS: consenso da maioria
• Plug-in disponível no MySQL 5.7.17+ GA
– Suportado em todas plataformas MySQL • Linux, Windows, Solaris, OSX, FreeBSD
41
M
M M
MySQL Connector
Application
MySQL Router
MySQL Connector
Application
MySQL Router
HA
Group Replication
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL Group Replication: O que fornece?
• Uma camada de banco de dados distribuída, simples de usar e com alta disponibilidade
– Topologias Ativo-Ativo, escreva em qualquer nó • Detecção e resolução automática de conflitos
– Reconfiguração automática ao adicionar, remover nós, crashes e falhas
– Distribuído e tolerante a falhas
– Arquitetura shared-nothing , sem necessidade de storage compartilhado
– Compatível com InnoDB
– Modos de operação single-primary ou multi-primary
42
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Master-Slave Replication
Replication vs. Group Replication
Group Replication
Router Router Router
App App App
VIP
mysqlfailover
Read-write
Read-only
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL Group Replication: Casos de Uso
• Replicação Elástica
– Ambientes que exigem uma infra-estrutura de replicação fluida, onde o número de servidores tem de crescer ou encolher dinamicamente e com a menor esforço possível.
• Alternativa a topologias Master-Slave
– Um único servidor Master pode ser um gargalo ou ponto único de falha.
– Escrever em um grupo de nós pode ser mais escalável em certas circunstâncias.
• Sharding com Alta Disponibilidade
– O MySQL Group Replication pode implementar shards altamente disponíveis em um sistema com escalabilidade horizontal.
44
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 46
Read Scale-Out
Async Replication + Auto Failover
Write Scale-Out
Sharding
S1
S2
S3
S4
MySQL Vision – S3
Timeline
MySQL Document Store
Relational & Document Model
MySQL HA
Out-Of-Box HA
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
S1 S2 S3 S4 S…
M
M M
MySQL Connector
Application
MySQL Router
MySQL Connector
Application
MySQL Router
MySQL Shell
HA
MySQL InnoDB Cluster – Architecture - S3 MySQL
InnoDB cluster
Read-Only Slaves
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 48
Read Scale-Out
Async Replication + Auto Failover
Write Scale-Out
Sharding
S1
S2
S3
S4
MySQL Vision – 4 Steps
Timeline
MySQL Document Store
Relational & Document Model
MySQL HA
Out-Of-Box HA
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
S1 S2 S3 S4 S…
M
M M
MySQL Connector
Application
MySQL Router
MySQL Connector
Application
MySQL Router
MySQL Shell
HA
Rep
licaS
et (
Shar
d 1
)
S1 S2 S3 S4 S…
M
M M
MySQL Connector
Application
MySQL Router
HA
Rep
licaS
et (
Shar
d 2
)
S1 S2 S3 S4
M
M M
HA
Rep
licaS
et (
Shar
d 3
)
MySQL Connector
Application
MySQL Router
MySQL InnoDB Cluster – Architecture - S4 MySQL
InnoDB cluster
…
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 50
• Community (GPL)
– Database (InnoDB, MyISAM, MEMORY, etc)
– Cluster (NDB)
• Comercial
– Standard – Enterprise – Cluster CGE – OEM/ISV
• Oracle Cloud – MySQL Cloud Service
Ofertas MySQL
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 51
Enterprise Edition
Escalabilidade Autenticação
Firewall Auditoria novo TDE
Criptografia
MySQL Enterprise Monitor Oracle EM for MySQL
Plug-ins
Suporte
Hot Backup
Monitor & Workbench
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 53
+
MySQL Enterprise Edition
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
• Simples & Automatizado
• Integrado
• Oracle Premier Support
• Enterprise Backup, Monitor, Security
54
Novo! MySQL Cloud Service
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 55 cloud.oracle.com/mysql
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 56
Treinamentos e Certificações
MySQL 5.6 Database Administrator MySQL 5.6 Developer
education.oracle.com/mysql