valtech - big data & nosql : au-delà du nouveau buzz

66
Big Data et NoSQL au-delà du nouveau buzz

Upload: valtech

Post on 24-Apr-2015

1.804 views

Category:

Technology


0 download

DESCRIPTION

Frederic Sauzet, Consultant, Valtech [email protected] Herve Desaunois, Responsable Technique [email protected] Ces nouvelles bases de données spécialisées comme Hbase et Neo4j sont de très bonnes solutions pour répondre à de nouvelles problématiques : comme un nombre grandissant de données multi-canales à stocker et à exploiter ou à l’exploitation des graphes sociaux du Web 2.0. Les leaders du Web comme Facebook, Twitter, Google, Adobe, Viadeo se sont emparés de ces solutions très performantes de types NoSQL pour bâtir leur empire de données.

TRANSCRIPT

Page 1: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Big Data et NoSQL

au-delà du nouveau buzz

Page 2: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Définition

Méthodologie

Architecture!

Cas d’utilisation

Page 3: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Définition

Page 4: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Définition

«Les technologies Big Data correspondent à une nouvelle génération de technologies et d’architectures, conçues pour retirer une valeur économique de gigantesques volumes de données hétéroclites, en les capturant, en les explorant et/ou en les analysant en un temps record »

4

Page 5: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Sommaire

Ò  Présentation Ò  Cas d’utilisation Ò  Architecture Ò  Cas Pratique Ò  Conclusion Ò  Références Ò  Annexes

5

Méthodologie

Page 6: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Big Data / Méthodologie

La mise en place d’une démarche Big Data est toujours composée de trois étapes :

Ò  Collecter, stocker les données : Partie infrastructure.

Ò  Analyser, corréler, agréger les données : Partie analytique.

Ò  Exploiter, afficher l’analyse Big Data : Comment exploiter les données et les analyses ?

Page 7: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Architecture

Page 8: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Architecture Big Data

Audio, Vidéo, Image

Docs, Texte, XML

Web logs, Clicks,

Social, Graphs,

RSS,

Capteurs, Graphs,

RSS,

Spatial, GPS Autres

Base de données Orientée colonne

NoSQL

Distributed File

System

Map Reduce

Base de données SQL

SQL

Analytiques , Business Intelligent

CO

LLECTER

LES D

ON

NEES

STOC

KA

GE &

OR

GA

NISATIO

N

EXTRA

CTIO

N

AN

ALYSER

&

VISU

ALISER

BUSINESS

Page 9: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Technologie Big Data

Audio, Vidéo, Image

Docs, Texte, XML

Web logs, Clicks,

Social, Graphs,

RSS,

Capteurs, Graphs,

RSS,

Spatial, GPS Autres

HBase, Big Table, Cassandra,

Voldemort, …

HDFS, GFS, S3, …

Oracle, DB2, MySQL, …

SQL

CO

LLECTER

LES D

ON

NEES

STOC

KA

GE &

OR

GA

NISATIO

N

EXTRA

CTIO

N

AN

ALYSER

&

VISU

ALISER

BUSINESS

Page 10: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Architecture Big Data Open Source pour l’entreprise

Page 11: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Big Data full solution

Page 12: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Cas d’utilisation

Page 13: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Cas d’utilisation BigQuery

Page 14: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Cas d’utilisation Hadoop

Ò  Facebook uses Hadoop to store copies of internal log and dimension data sources and as a source for reporting/analytics and machine learning. There are two clusters, a 1100-machine cluster with 8800 cores and about 12 PB raw storage and a 300-machine cluster with 2400 cores and about 3 PB raw storage.

Ò  Yahoo! deploys more than 100,000 CPUs in > 40,000 computers running Hadoop. The biggest cluster has 4500 nodes (2*4cpu boxes w 4*1TB disk & 16GB RAM). This is used to support research for Ad Systems and Web Search and to do scaling tests to support development of Hadoop on larger clusters

Ò  eBay uses a 532 nodes cluster (8 * 532 cores, 5.3PB), Java MapReduce, Pig, Hive and HBase

Ò  Twitter uses Hadoop to store and process tweets, log files, and other data generated across Twitter. They use Cloudera’s CDH2 distribution of Hadoop. They use both Scala and Java to access Hadoop’s MapReduce APIs as well as Pig, Avro, Hive, and Cassandra.

Page 15: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Gartner talk

« D'ici 2015, 4,4 millions d'emplois informatiques seront créés dans le monde pour soutenir le Big Data, dont 1,9 millions aux Etat-Unis », a déclaré Peter Sondergaard, senior vice-président et responsable mondial de la recherche chez Gartner.

Wanted « Sophisticated Statistical Analysis »

100 000 to 500 000 $

Page 16: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase

Page 17: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Présentation

Architecture & API

Cas d’utilisations

Etude de cas

Sécurité

Ecosystème Hadoop

Page 18: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Présentation

Page 19: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Présentation

“HBase is the Hadoop database. Think of it as a distributed scalable Big Data store”

http://hbase.apache.org/

19

Page 20: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Présentation

“Project's goal is the hosting of very large tables – billions of rows X millions of columns – atop clusters of commodity hardware”

http://hbase.apache.org/

20

Page 21: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Présentation

“HBase is an open-source, distributed, versioned, column-oriented store modeled after Google's BigTable”

http://hbase.apache.org/

21

Page 22: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

La trilogie Google

Ò The Google File System http://research.google.com/archive/gfs.html

Ò MapReduce: Simplified Data Processing on Large Cluster http://research.google.com/archive/mapreduce.html

Ò Bigtable: A Distributed Storage System for Structured Data http://research.google.com/archive/bigtable.html

22

Page 23: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Systèmes d’exploitation / Plateforme

23

Page 24: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Installation / démarrage / arrêt

$ mkdir bigdata $ cd bigdata $ wget http://apache.claz.org/hbase/hbase-0.92.1/hbase-0.92.1.tar.gz … $ tar xvfz hbase-0.92.1.tar.gz … $ export HBASE_HOME=`pwd`/hbase-0.92.1 $ $HBASE_HOME/bin/start-hbase.sh … $ $HBASE_HOME/bin/stop-hbase.sh …

24

Page 25: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase Shell / exemple de session $ $HBASE_HOME/hbase shell HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 0.92.1, r1298924, Fri Mar 9 16:58:34 UTC 2012 hbase(main):001:0> list TABLE 0 row(s) in 0.5510 seconds hbase(main):002:0> create 'mytable', 'cf' 0 row(s) in 1.1730 seconds hbase(main):003:0> list TABLE mytable 1 row(s) in 0.0080 seconds hbase(main):004:0> put 'mytable', 'first', 'cf:message', 'hello HBase' 0 row(s) in 0.2070 seconds hbase(main):005:0> get 'mytable', 'first' COLUMN CELL cf:message timestamp=1323483954406, value=hello HBase 1 row(s) in 0.0250 seconds

25

Page 26: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase Shell / Commandes

Ò  Générales Ò status, version

Ò  DDL Ò alter, alter_async, alter_status, create, describe, disable,

disable_all, drop, drop_all, enable, enable_all, exists, is_disabled, is_enabled, list, show_filters

Ò  DML Ò count, delete, deleteall, get, get_counter, incr, put, scan, truncate

Ò  Outils Ò  assign, balance_switch, balancer, close_region, compact, flush,

hlog_roll, major_compact, move, split, unassign, zk_dump Ò  Replication

Ò  add_peer, disable_peer, enable_peer, list_peers, remove_peer, start_replication, stop_replication

Ò  Securité Ò  grant, revoke, user_permission

26

Page 27: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Architecture & API

Page 28: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Architecture logique

28

Page 29: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Table Design

29

Page 30: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Exemple de table

30

Ò Coordonnées des données [rowkey, column family, column qualifier, timestamp] → value [fr.wikipedia.org/wiki/NoSQL, links, count, 1234567890] → 24

Page 31: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase Java API

Ò HBaseAdmin, HTableDescriptor, HColumnDescriptor HTableDescriptor desc = new HTableDescriptor("TableName"); HColumnDescriptor cf = new HColumnDescriptor("Family".getBytes()); desc.addFamily(contentFamily); Configuration conf = HBaseConfiguration.create(); HBaseAdmin admin = new HBaseAdmin(conf); admin.createTable(desc);

31

Page 32: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase Java API

Ò HTablePool & HTableInterface HTablePool pool = new HTablePool(); HTableInterface table = pool.getTable("TableName");

32

Page 33: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase Java API

Ò Put byte[] cellValue = … Put p = new Put("RowKey".getBytes()); p.add("Family".getBytes(), "Qualifier".getBytes(), cellValue); table.put(p);

33

Page 34: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Chemin d’écriture

34

Page 35: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase Java API

Ò Get Get g = new Get("RowKey".getBytes()); g.addColumn("Family".getBytes(), "Qualifier".getBytes()); Result r = table.get(g);

Ò Result byte[] cellValue = r.getValue("Family".getBytes(), "Qualifier".getBytes());

35

Page 36: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase Java API

Ò Scan Scan scan = new Scan(); scan.setStartRow("StartRow".getBytes()); scan.setStopRow("StopRow".getBytes()); scan.addColumn("Family".getBytes(), "Qualifier".getBytes()); ResultScanner rs = table.getScanner(scan); for (Result r : rs) { // … }

36

Page 37: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Chemin de lecture

37

Page 38: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Sommaire

Ò  Présentation Ò  Cas d’utilisation Ò  Architecture Ò  Cas Pratique Ò  Conclusion Ò  Références Ò  Annexes

38

Cas d’utilisations

Page 39: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Cas d’utilisations

39

Page 40: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Cas d’utilisations

40

Vous ?

Page 41: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Etude de cas

Page 42: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Moteur de recherche

42

Page 43: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Table Wikipedia.fr

43

Page 44: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Création de la table Wikipedia

HTableDescriptor desc = new HTableDescriptor("wikipedia");

HColumnDescriptor contentFamily = new

HColumnDescriptor("content".getBytes()); contentFamily.setMaxVersions(1); desc.addFamily(contentFamily); HColumnDescriptor linksFamily = new

HColumnDescriptor("links".getBytes()); linksFamily.setMaxVersions(1); desc.addFamily(linksFamily); Configuration conf = HBaseConfiguration.create(); HBaseAdmin admin = new HBaseAdmin(conf); admin.createTable(desc); 44

Page 45: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

HBase API : insertion de données par les Crawlers

Put p = new Put(Util.toBytes(url)); p.add("content".getBytes(), "text".getBytes(), htmlParseData.getText().getBytes()); List<WebURL> links = htmlParseData.getOutgoingUrls(); int count = 0; for (WebURL outGoingURL : links) { p.add("links".getBytes(), Bytes.toBytes(count++), outGoingURL.getURL().getBytes()); } p.add("links".getBytes(), "count".getBytes(), Bytes.toBytes(count)); try { table.put(p); } catch (IOException e) { e.printStackTrace(); } 45

Page 46: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Table de l’index inversé

46

Page 47: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

MapReduce

47

Page 48: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

MapReduce Index inversé – algorithme

method map(url, text) for all word ∈ text do emit(word, url)

method reduce(word, urls) count ← 0 for all url ∈ urls do put(word, "links", count, url) count ← count + 1 put(word, "links", "count", count)

48

Page 49: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

MapReduce Index inversé – Configuration

public static void main(String[] args) throws Exception { Configuration conf = HBaseConfiguration.create(); Job job = new Job(conf, "Reverse Index Job"); job.setJarByClass(InvertedIndex.class);

Scan scan = new Scan(); scan.setCaching(500); scan.addColumn("content".getBytes(), "text".getBytes()); TableMapReduceUtil.initTableMapperJob("wikipedia", scan, Map.class, Text.class, Text.class, job); TableMapReduceUtil.initTableReducerJob("wikipedia_ri", Reduce.class, job);

job.setNumReduceTasks(1); System.exit(job.waitForCompletion(true) ? 0 : 1);

} 49

Page 50: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

MapReduce Index inversé – Map

public static class Map extends TableMapper<Text, Text> { private static final Pattern PATTERN = Pattern.compile(SENTENCE_SPLITTER_REGEX); private Text key = new Text(); private Text value = new Text();

@Override protected void map(ImmutableBytesWritable rowkey, Result result, Context context) { byte[] b = result.getValue("content".getBytes(), "text".getBytes()); String text = Bytes.toString(b); String[] words = PATTERN.split(text); value.set(result.getRow()); for (String word : words) { key.set(word.getBytes()); try { context.write(key, value); } catch (Exception e) { e.printStackTrace(); } } } }

50

Page 51: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

MapReduce Index inversé – Reduce

public static class Reduce extends TableReducer<Text, Text, ImmutableBytesWritable> { @Override protected void reduce(Text rowkey, Iterable<Text> values, Contex context) { Put p = new Put(rowkey.getBytes()); int count = 0; for (Text link : values) { p.add("links".getBytes(), Bytes.toBytes(count++), link.getBytes()); } p.add("links".getBytes(), "count".getBytes(), Bytes.toBytes(count)); try { context.write(new ImmutableBytesWritable(rowkey.getBytes()), p); } catch (Exception e) { e.printStackTrace(); } } } 51

Page 52: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Question

Comment trier par ordre d’importance les résultats d’une recherche ?

52

Page 53: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Comptage des liens

53

Page 54: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Comptage pondéré

54

Page 55: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Définition récursive

55

Page 56: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Un peu d’algèbre linéaire

56

Page 57: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

PageRank

57

Page 58: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Moteur de recherche

58

Page 59: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Digression 1

59

Google@Stanford, Larry Page et Sergey Brin – 1998 Ò 2-proc Pentium II 300mhz, 512mb, five 9gb drives Ò 2-proc Pentium II 300mhz, 512mb, four 9gb drives Ò 4-proc PPC 604 333mhz, 512mb, eight 9gb drives Ò 2-proc UltraSparc II 200mhz, 256mb, three 9gb drives, six

4gb drives Ò Disk expansion, eight 9gb drives Ò Disk expansion, ten 9gb drives

CPU   2933  MHz  (sur  10  CPUs)  

RAM   1792  MB  

HD   366  GB  

Page 60: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Digression 2

60

Google 1999 – Premier serveur de production

Page 61: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Une formule sans maths J

Données + science + perspicacité = valeur

61

Page 62: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Sécurité

Page 63: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Sécurité

Ò Kerberos Ò Access Control List

63

Page 64: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Sommaire

Ò  Présentation Ò  Cas d’utilisation Ò  Architecture Ò  Cas Pratique Ò  Conclusion Ò  Références Ò  Annexes

64

Ecosystème Hadoop

Page 65: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Ecosystème Hadoop

Ò Hadoop Ò Pig Ò Hive Ò Mahout Ò Whirr

65

Page 66: Valtech  - Big Data & NoSQL : au-delà du nouveau buzz

Thank you