hadoop 1.2.1 compilation - university of michigantimtu/site/share/hadoop_compile.pdf ·...

20
Hadoop 1.2.1 compilation Chun-Chen Tu [email protected]

Upload: others

Post on 02-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Hadoop 1.2.1 compilation

Chun-Chen Tu

[email protected]

Page 2: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Platform

• Virtualbox 4.3.6

– CPU 1 core 8G RAM

– Ubuntu 12.04 server 64-bit

• Hadoop 1.2.1

Page 3: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Outline

• Download Eclipse

• Import Hadoop to Eclipse

• Compile changed sources into jar

Page 4: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Download Eclipse

• You should install java jdk first.

• google “eclipse download”

– http://www.eclipse.org/downloads/

– And download it.

Page 5: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

tar Eclipse

In terminal

Find the location you downloaded Eclipse

Usually in ~/Downloads

cd ~/Downloads

tar xvf eclipse*

and you’ll get a eclipse directory

move it under home

mv eclipse ~/

Page 6: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Two ways to run EclipseNote: You should install JAVA first

By terminal:

~/eclipse/eclipse

By GUI:

double click

the icon

Page 7: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

• Selected the workspace of eclipse

• Just use default

Page 8: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Import Hadoop

• First, get the source – http://ftp.twaren.net/Unix/Web/apache/hadoop/common

/hadoop-1.2.1/

– ftp://hadoop:[email protected]/hadoop-1.2.1.tar.gz

• tar it and move it under home, named as hadoop

Page 9: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Build hadoop for eclipse

• sudo apt-get install ant autoconf libtool

• sudo aptitude install libtool

• cd ~/hadoop

• ant

• ant eclipse

Page 10: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Eclipse ant setup

ANT_HOME

Page 11: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Eclipse include tools.jar

Page 12: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import
Page 13: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Hadoop code style

Import the formatter from here

Page 14: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Import hadoop project

Page 15: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import
Page 16: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Select the folder after tarwhich is ~/hadoop for our condition

Page 17: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Compile changed hadoop

• As for example, we want to add message before jar.

• We modified the code org.apache.hadoop.util.RunJar.java

Page 18: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Note: It should be System.err.println not System.out.println

Page 19: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Generate new jar

• By using ant.

• In terminal

• cd ~/workspace/hadoop

• ant jar

• The new jar appears at ~/workspace/hadoop/build

• Since RunJar.java is a part of hadoop-core.jar, we only have to replace the hadoop-core.jar with new one.

Page 20: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import

Hi Mom, it’s me