open xke - big data, big mess par bertrand dechoux

25
Big Data, Big Mess ? Par Bertrand Dechoux 1

Upload: xebia-france

Post on 11-May-2015

226 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Big Data, Big Mess ?Par Bertrand Dechoux

1

Page 2: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Experience Hadoop

2

•première contact début 2010•consultant et trainer Hadoop @ Xebia

2

Page 3: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Agenda

3

Et les données ?

Hive, Pig et Cascading

Hadoop MapReduce 101

Api Java, Hadoop Streaming

3

Page 4: Open XKE - Big Data, Big Mess par Bertrand Dechoux

HadoopMapReduce

101 1

4

Page 5: Open XKE - Big Data, Big Mess par Bertrand Dechoux

un problème, une solution

5

Objectifs :

•calcul distribué

•haute volumétrie

Choix :

•commodity hardware

•local read

5

Page 6: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Map et Reduce

6

DATA

reduce

map

DATA DATA DATA

map map map

reduce

DATA DATA

6

Page 7: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Ce qui vous est fourni

7

• des primitives• en Java• fonctionnelles• de batch distribué

7

Page 8: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Api Java,Hadoop Streaming

1

8

Page 9: Open XKE - Big Data, Big Mess par Bertrand Dechoux

L’Api java

9

public class WordCount { public static class Map extends Mapper<LongWritable, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { word.set(tokenizer.nextToken()); context.write(word, one); } } } public static class Reduce extends Reducer<Text, IntWritable, Text, IntWritable> {

public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException { int sum = 0; for (IntWritable val : values) { sum += val.get(); } context.write(key, new IntWritable(sum)); } } public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.waitForCompletion(true); } }

public class WordCount { public static class Map extends Mapper<LongWritable, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.hasMoreTokens()) { word.set(tokenizer.nextToken()); context.write(word, one); } } } public static class Reduce extends Reducer<Text, IntWritable, Text, IntWritable> {

public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException { int sum = 0; for (IntWritable val : values) { sum += val.get(); } context.write(key, new IntWritable(sum)); } } public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "wordcount"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.waitForCompletion(true); } }

9

Page 10: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Industrialisation Simple

10

•dependances -> maven•test -> MRUnit + JUnit + maven•release -> maven + jenkins + nexus

10

Page 11: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Cas d’usage classique

11

•centralisation des logs•comment l’exploitant utilise t il les logs?

11

Page 12: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Beyond Java : Hadoop Streaming

12

•lecture et écriture sur stdin/stdout•integration du legacy•seulement des jobs simples•industrialisation sans problème

12

Page 13: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Hive, Pig etCascading

1

13

Page 14: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Hive et Pig

14

•PigLatin•‘bou!e tout’•DAG

•HiveQL•structuré•tree

14

Page 15: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Industrialisation ?

15

•dependances -> maven•test -> JUnit + maven•release -> maven + jenkins + nexus

15

Page 16: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Industrialisation Laborieuse

16

•1 job MapReduce -> minimum 10 secondes•1 requete -> ???•n requetes -> trop long

16

Page 17: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Cascading

17

•principe similaire à Hive et Pig•une surapi en Java•ou scala : scalding•ou clojure : cascalog

•Hadoop n’est pas la seule plateforme

17

Page 18: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Et les données?1

18

Page 19: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Les fichiers

19

type text SequenceFile Avro

interoperabilité

performance

19

Page 20: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Le filesystem : HDFS

20

•peu de "chiers•des gros "chiers•optimisés pour la lecture en continu

20

Page 21: Open XKE - Big Data, Big Mess par Bertrand Dechoux

La base : HBase

21

•un clone de BigTable•essentiellement une Map avec clefs triées

21

Page 22: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Data Management

22

•HCatalog•inspiré de Hive metastore•décrit les jeux de données

•Avro•un "chier contenant sa description•perfomant

22

Page 23: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Data Management

23

•management = coordination

•data steward / data custodian

23

Page 24: Open XKE - Big Data, Big Mess par Bertrand Dechoux

Tout cela est il important ?

24

24

Page 25: Open XKE - Big Data, Big Mess par Bertrand Dechoux

DesQuestions ?

Merci!

25