Frederic Sauzet, Consultant, Valtech
Frederic.Sauzet@valtech.fr
Herve Desaunois, Responsable Technique
Herve.Desaunois@valtech.fr
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.
4. 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
5. Sommaire
Ò Présentation
Ò Cas d’utilisation
Ò Architecture
Ò Cas Pratique
Ò Conclusion
Ò Références
Ò Annexes
5
Méthodologie
6. 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 ?
8. 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
COLLECTER
LESDONNEES
STOCKAGE&ORGANISATIONEXTRACTION
ANALYSER
&
VISUALISER
BUSINESS
9. 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
COLLECTER
LESDONNEES
STOCKAGE&ORGANISATIONEXTRACTION
ANALYSER
&
VISUALISER
BUSINESS
14. 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.
15. 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 $
19. Présentation
“HBase is the Hadoop database. Think of it as
a distributed scalable Big Data store”
http://hbase.apache.org/
19
20. 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
21. Présentation
“HBase is an open-source, distributed,
versioned, column-oriented store modeled
after Google's BigTable”
http://hbase.apache.org/
21
22. 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
25. 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
30. 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
31. 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
32. HBase Java API
Ò HTablePool & HTableInterface
HTablePool pool = new HTablePool();
HTableInterface table = pool.getTable("TableName");
32
33. HBase Java API
Ò Put
byte[] cellValue = …
Put p = new Put("RowKey".getBytes());
p.add("Family".getBytes(),
"Qualifier".getBytes(),
cellValue);
table.put(p);
33
35. 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
36. 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
44. 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
45. 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
48. 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