mysql e big data

51
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | MySQL e Big Data Airton Lastori [email protected] maio/2015

Upload: mysql-brasil

Post on 24-May-2015

1.112 views

Category:

Technology


0 download

DESCRIPTION

O MySQL pode ser integrado dentro de um ciclo de vida de Big Data, permitindo a unificação de dados de fontes diversas e multi-estruturados em plataformas diversificadas de processamento paralelo como Hadoop, para produzir mais conhecimento de uma maneira difícil de imaginar anos atrás.

TRANSCRIPT

Page 1: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL e Big Data

Airton Lastori [email protected] maio/2015

Page 2: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

The following is intended to outline our general product direction. It is intended for

information purposes only, and may not be incorporated into any contract. It is not a

commitment to deliver any material, code, or functionality, and should not be relied

upon in making purchasing decision. The development, release, and timing of any

features or functionality described for Oracle’s products remains at the sole

discretion of Oracle.

Safe Harbor Statement

Page 3: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Por que Big Data é importante?

US HEALTH CARE

$300 B

Aumenta valor anual da indústria em

US RETAIL

60+%

Aumenta lucros da indústria em

MANUFACTURING

–50%

Diminui custos de engenharia em

GLOBAL PERSONAL LOCATION DATA

$100 B

Aumenta o faturamento dos serviços em

EUROPE PUBLIC SECTOR ADMIN

€250 B

Aumenta o faturamento dos serviços em

“Em um mundo Dig Data, um competidor que falhar ao desenvolver suficientemente suas capacidades ficará para trás.”

McKinsey Global Institute

Page 4: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Analistas falando sobre Big Data

“The area of greatest interest to my clients is Big Data and its role in helping businesses understand customers better.”

“Almost half of IT departments in enterprises in North America, Europe and Asia-Pacific plan to invest in Big Data analytics in the near future.”

Michael Maoz, Gartner

“Big Data Will Help Shape Your Market’s Next Big Winners.”

Brian Hopkins, Forrester

Tony Baer, Ovum

“CIOs will need to be realistic about their approach to 'Big Data' analytics and focus on specific use cases where it will have the biggest business impact.”

Philip Carter, IDC

Page 5: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Aplicações mais comuns

• Recomendações na Web

• Análise de Comportamento/Sentimento

• Análise Campanha de Marketing

• Retenção de Clientes

• Detecção de Fraude

• Pesquisa e Desenvolvimento

• Modelagem de Risco

• Aprendizado de Máquina Fonte: http://wikibon.org/blog/big-data-statistics/

Além de outras aplicações que ainda estamos descobrindo…

Page 6: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Caso de uso: Loja On-Line

Usuários Navegação

Recomendações Perfil,

Histórico de Compras

Web Logs: Páginas Visitadas, Comentários, Posts

Interações em Mídias Sociais, Preferências, Marcas com “Curtir”

Recomendações

Conversas Telefônicas

Page 7: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Caso de Sucesso

• sistema de publicidade online que identifica o visitante e exibe conteúdo direcionado ao seu perfil

• 2 TB de web logs são capturados, com 22 bilhões de linhas por mês processadas pelo MySQL

• Atualmente, considerando apenas uma instância MySQL, há 8 TB de dados armazenados com 5GB de crescimento por dia

Big Data

“O MySQL é uma parte essencial da nossa estratégia de Big Data. A integração com Hadoop permite-nos melhorar e crescer o nosso negócio de publicidade digital com rapidez e agilidade.”

Josafá Santos IT Manager, boo-box

mysql.com/why-mysql/case-studies/1billion-advertisements-mysql-hadoop.html

Page 8: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Não há consenso na definição, mas há fatos

O que é?

Big Data = Datasets volumosos: 90% dos dados gerados nos últimos 2 anos Crescimento muito rápido: ~50x maior velocidade Fontes variadas:

web, dispositivos móveis, sensores, câmeras… produção voluntária e não-volutária de qualidade varíavel

Variabilidade de formatos: dados estruturados e não-estruturados Se bem aproveitados, muitas oportunidades, muito valor

Page 9: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Desafios Big Data

VOLUME VELOCIDADE VARIEDADE VARIABILIDADE

SOCIAL

BLOG

SMART METER

10110010100100100110101010101110010101010010

PROBLEMA: os sistemas convencionais não foram projetados para isso!

Page 10: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Desisões baseadas em novos data sets

Transações

Arquitetura tradicional: Decisões basedas nos dados do seu banco de dados

Big Data: Decisões baseadas em todos dados capturáveis

Video e Imagens

Dados gerados por máquinas Dados Sociais

Documentos

Transações IoT

Page 11: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Fonte: 451 Group

Page 12: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Fonte: http://db-engines.com/en/ranking_trend (mai/15)

Page 13: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Big Data Lifecycle

ANALYZE

DECIDE ACQUIRE

ORGANIZE

Page 14: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Oracle Stack, pronto para usar

Acquire Organize Analyze Decide

Dados Web Adquiridos em MySQL

Analizados com Oracle Exadata

Organizados com Oracle Big Data

Appliance

Decida usando o poder do Oracle

Exalytics

oracle.com/us/technologies/big-data/index.html

Page 15: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL + Hadoop: Integrados

*de acordo com fornecedores Hadoop

Page 16: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

BI Solutions

ACQUIRE

ORGANIZE ANALYZE

DECIDE

Hadoop Applier

Big Data Lifecycle com MySQL+Hadoop

Page 17: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Por que Hadoop? (1/3)

• Armazenamento de data sets de grandes volumes

• Processamento paralelo em grande velocidade

• Facilidade em tratar de fontes de dados variadas

• Variedade de formatos dos dados –estruturados e não estruturados (schemaless)

Page 18: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Por que Hadoop? (2/3) Adoção

Fonte: http://blogs.gartner.com/merv-adrian/2015/02/18/hadoop-adoption-moving-but-not-necessarily-forward

Page 19: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Por que Hadoop? (3/3) Projetado para resolver problemas de Big Data

• Escalabilidade horizontal para milhares de nós –Hardware commodity ou Cloud

• Alta-disponibilidade com replicação e self-healing

• Inicialmente modelo de processamento batch (Map/Reduce) –Extensível com queries interativas via Apache Drill, Cloudera Impala,

Stinger etc.

Page 20: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Page 21: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Interfaces NoSQL para MySQL Database MySQL Cluster

Big Data Lifecycle com MySQL+Hadoop

ANALYZE

DECIDE

ORGANIZE

ACQUIRE

Page 22: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL na fase ACQUIRE benefícios e exemplos

• Consultas de análise em tempo real –Resposta instantânea para processos de decisão

–Exemplo: detecção de fraude do PayPal utilizando MySQL Cluster

• Filtro inicial de dados, antes de carregar no Hadoop –“Anonimização” dos usuários

–Exemplo: resultados de exames médicos, dados financeiros

• Dados que exigem maior segurança na origem –Confirmação de autenticação, Auditoria, Backup

Page 23: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

NewSQL

Page 24: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 24

Page 25: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Interface NoSQL no MySQL Metas de Design: Velocidade, Flexibilidade e Segurança

Totalmente

transacional e

compatível com

ACID

Operações

Chave / Valor

com máxima

performance

NoSQL + SQL

combinados no

mesmo data set

Inclui também operações DDL online

Page 26: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

<estado:SP,Campinas>

prefix key value

<estado:SP,Campinas>

key value

Prefix Table Key-col Val-col policy

estado: mapa.cidades sigla_estado cidade cluster

Config tables

sigla_estado ... cidade ...

SP ... Campinas ...

Tabela cidades do DB mapa

visão da Aplicação

visão MySQL

SELECT * FROM mapa.cidades WHERE cidade LIKE ’C%’;

MySQL com Memcached Schema Configurável

Page 27: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Performance no MySQL 5.6

Throughput até 9x maior para “SET / INSERT”

0

10000

20000

30000

40000

50000

60000

70000

80000

8 32 128 512

TPS

Client Connections

MySQL 5.6: NoSQL Benchmarking

Memcached API

SQL

Page 28: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL Cluster: Interfaces NoSQL

Page 29: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

• NoSQL C++ API, flexaSynch benchmark

• 30 x Intel E5-2600 Intel Servers, 2 socket, 64GB

• ACID Transactions, Synchronous Replication

0

5

10

15

20

25

2 4 6 8 10 12 14 16 18 20 22 24 26 28 30

Mill

ion

s o

f U

PD

ATE

s p

er

Seco

nd

MySQL Cluster Data Nodes

20 Milhões de UPDATEs / seg

Page 30: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Qual API devo usar com o MySQL Cluster?

SQL

• Padrão da indústria

• Joins e Queries complexas

• Modelo relacional

ClusterJ / OpenJPA

• ORM Java

• Simplicidade

• Acesso nativo e rápido ao Cluster

• Ex: Web e Telco

memcached

• chave/valor

• Simples de usar

• Driver para diversas linguagens

• Ex: PHP Proxy

node.js

• Javascript

• Mesma tecnologia do browser no lado do servidor

• Ex: Mobile Apps

mod_ndb

• REST/JSON

• HTML

• Uso do Apache httpd

C++

• Performance extrema

• Tempo real

• Desenvolvedor experiente

• Mais baixo nível

Page 31: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Importe Dados no Hadoop com Apache Sqoop MySQL Hadoop Applier

Big Data Lifecycle com MySQL+Hadoop

ANALYZE

DECIDE ACQUIRE

ORGANIZE

Page 32: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Apache Sqoop • Apache Top Level Project, parte do projeto Hadoop

• Desenvolvido pela Cloudera

• Data import / export, em lote com schedule

• Entre o Hadoop (HDFS) e data stores externos

• Arquitetura JDBC Connector

• Suporta plug-ins para funcionalidades específicas

• Conector “Fast Path” para MySQL

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Page 33: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Transactional Data

HDFS Storage Sqoop Job

Map

Map

Map

Map

Hadoop Cluster

Sqoop Import

Gather Metadata

Submit Map Only Job Import

Page 34: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL Hadoop Applier

Integração em tempo real do

MySQL para Hadoop

Cada tabela mapeada para

um diretório Hive data

warehouse

Possibilita usufruir de

ferramentas de análise do

eco-sistema Hadoop

Construído sobre MySQL

Binlog API e libhdfs library

Artigos dev.mysql.com

Download labs.mysql.com

Page 35: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Mapeando MySQL no HDFS Schema

Page 36: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Big Data Lifecycle com MySQL+Hadoop

Analise Exporte Dados Decida

ANALYZE

DECIDE

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Page 37: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Page 38: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 40

Page 39: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

HDFS Storage Sqoop Job

Map

Map

Map

Map

Hadoop Cluster

Sqoop Export

Gather Metadata

Submit Map Only Job

Transactional & Analytics Data

Export

Page 40: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL como base de relatórios para BI

Page 42: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Arquitetura de Referência MySQL+Hadoop

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Page 43: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Alta-disponibilidade + escalabilidade de escrita com sharding MySQL Fabric (parte do MySQL Utilities)

• Alta disponibilidade: – Monitoramento do Server com failover automático e

transparente para aplicação

• Conectores devem ser “Fabric-aware”: – Java, PHP, Python

• Sem Proxy, sem latencia extra e SPoF

• Escalabilidade de escrita com sharding: – Aplicação define a shard key (Range ou Hash)

– Ferramentas para re-sharding

– Tabelas globais & global updates

MySQL Fabric

Connector

Application

Read-slaves

SQL

Master group

Read-slaves

Master group

Page 44: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 46

Próximos passos com MySQL e Big Data

Paper: MySQL and Hadoop

Instale: mysql.com/downloads

Hadoop Applier: alastori.com.br

Estes Slides: slideshare.net/MySQLBR/mysql-e-big-data

1

2

3

4

Oracle Confidential – Internal/Restricted/Highly Restricted 46

Page 45: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

Whitepaper: Unlocking New Big Data Insights with MySQL 2015 http://www.mysql.com/why-mysql/white-papers/mysql-and-hadoop-guide-to-big-data-integration

Whitepaper

Page 46: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL Enterprise Edition Suporte + Backup + Monitor + Workbench + Plug-ins

Escalabilidade Segurança

Firewall Auditoria

Criptografia

Oracle Enterprise Manager for MySQL

Page 47: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

MySQL for Beginners Ed 3

MySQL for Database Administrators Ed 3.1

MySQL Performance Tuning

MySQL High Availability

MySQL Cluster

MySQL DBA

Introduction to MySQL 5.5

MySQL Developers Techniques

MySQL for Beginners Ed 3

MySQL and PHP Developing Dynamic Web

Applications

MySQL for Developers Ed 2

MySQL Advanced Stored Procedures

MySQL Developer

education.oracle.com/mysql

Opcional

Necessário

Oracle Certified Professional, MySQL 5.6

DBA

Oracle Certified Expert, MySQL Cluster DBA

Certificações

Oracle Certified Professional, MySQL 5.6

Developer

Treinamentos e certificações

Page 48: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |

@MySQLBR meetup.com/MySQL-BR facebook.com/MySQLBR

pt.planet.mysql.com

Page 49: MySQL e Big Data

Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 51

Passos para adoção do Big Data

Identificação de dados que pode usar Internos (BD corporativo, departamentais, planilhas, logs) e Externos (parceiros,

fornecedores, governo, APIs públicas, mídias sociais)

Identificação de oportunidades consultoria, piloto

Infra tecnológia e organizacional nuvem, capacitação

Estratégia tecnológica CIO, CDO

1

2

3

4

Oracle Confidential – Internal/Restricted/Highly Restricted 51

Page 51: MySQL e Big Data