Friday, March 18th 2011, 8:56pm
Tags
Apache,
Elephant Bird,
hadoop,
hbase,
hive,
Hive SerDe,
pig,
twitter
Abstract
Hier erfahrt ihr wie ihr Elephant Bird installiert. Elephant Bird stellt Bibliotheken von Twitter für LZO, Thrift, Protocol Buffer und anderen Hadoop verwandten Projekten zur Verfügung.
Es enthält Tools für Pig, Hive SerDe, HBase, uvm
Article
Elephant Bird benötigt einen aktuellen Compiler für Protocol Buffers (mindestens Version 2.3)
Der Protocol Buffers Compiler ist den Ubuntu Paketquellen enthalten und vorinstalliert, andernfalls könnt ihr ihn je nach Distribution wie folgt nachinstallieren.
|
Bash
|
1
|
sudo apt-get install protobuf-compiler
|
Elephant Bird benötigt außerdem, dass Thrift auf eurem Computer installiert ist. Wie ihr Thrift installieren könnt erfahrt ihr in diesem Wiki Beitrag:
Apache Thrift Installation
Um die JAR Dateien für Elephant Bird zu bauen wird ant verwendet. Neben ant müsst ihr noch die aktuelle JDK installieren.
Statt der Sun JDK könnt ihr natürlich auch openjdk-6-jdk verwenden. Aber gerade wenn ihr die Cloudera Distribution verwendet, dann bringen einige Pakete die Sun JDK bereits als Paketabhängigkeit mit.
|
Bash
|
1
|
sudo apt-get install sun-java6-jdk ant
|
Ladet euch nun die aktuellste stabile Version von Elephant Bird herunter:
https://github.com/kevinweil/elephant-bird
Mit wget funktioniert der Download wie folgt. Ihr solltet den SSL Check für github deaktivieren.
|
Bash
|
1
|
wget --no-check-certificate https://github.com/kevinweil/elephant-bird/tarball/master
|
Nun entpackt ihr die Dateien und startet anschließend das Bauen der JAR Dateien
|
Bash
|
1
2
3
|
tar xvfz kevinweil-elephant-bird*
cd elephant-bird/
ant
|
Die erfolgreiche Installation sieht bei mir wie folgt aus:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
Buildfile: /home/tb/elephant-bird/build.xml
release:
[echo] Building in release mode...
init:
compile-protobuf:
[exec] Result: 1
[apply] Applied thrift to 1 file and 0 directories.
[apply] Applied protoc to 4 files and 0 directories.
[javac] /home/tb/elephant-bird/build.xml:170: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 9 source files to /home/tb/elephant-bird/build/classes
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] /home/tb/elephant-bird/build.xml:116: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 45 source files to /home/tb/elephant-bird/build/classes
[javac] /home/tb/elephant-bird/src/java/com/twitter/elephantbird/pig/util/ProtobufToPig.java:13: warning: com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDateTimeException is Sun proprietary API and may be removed in a future release
[javac] import com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDateTimeException;
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 warning
compile:
[javac] /home/tb/elephant-bird/build.xml:90: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 52 source files to /home/tb/elephant-bird/build/classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
jar:
[mkdir] Created dir: /home/tb/elephant-bird/dist
[jar] Building jar: /home/tb/elephant-bird/dist/elephant-bird-1.2.1.jar
release-jar:
BUILD SUCCESSFUL
Total time: 9 seconds
|
Ihr findet die Elephant Bird JAR Datei von Elephant Bird im dist Ordner.
Elelphant Bird in der Version 1 unterstütz kein Pig 0.8, wie es in den Cloudera Quellen zu finden ist. Elephant Bird in Version 2 mit Unterstützung für Pig 0.8 ist zum Gegenwärtigen Zeitpunkt noch in der Entwicklung. Um den aktuellen Snapshot zu bauen, müsst ihr die Quellen aus git kompilieren.
|
Bash
|
1
2
3
4
5
6
7
|
git clone https://github.com/dvryaboy/elephant-bird.git
cd elephant-bird
git branch -t pig-08 remotes/origin/pig-08
git checkout pig-08
# build jar file with ant
ant
|
Der Name der Jar Datei und auch die Paketnamen der Pig Loader haben sich verändert. Hier ein Beispiel Pig Script:
|
Source code
|
1
2
|
register dist/elephant-bird-2.0-SNAPSHOT.jar;
raw_data = load '/tmp/thrift/' using com.twitter.elephantbird.pig8.load.LzoThriftBlockPigLoader('com.example.thrift.VectorSequence');
|
Request deletion
report critical content