背景:
ubuntu-12.04
JDK 1.7
Hadoop 1.1.2
步骤:
1.解压
把Hadoop的tar包拷贝到指定目录,使用tar -zxvf hadoop-version.tar.gz命令解压。
2.测试单点(本步骤可省略)
进入hadoop目录:
cd hadoop-1.1.2/
cp conf/*.xml input
bin/hadoop jar hadoop-examples-1.1.2.jar grep input output 'dfs[a-z.]+'
cat output/*
bin/hadoop jar hadoop-examples-1.1.2.jar grep input output 'dfs[a-z.]+'
cat output/*
3.伪分布式的配置
3.1在hadoop的conf/hadoop-env.sh中配置JAVA_HOME
3.2配置基本信息:
conf/core-site.xml:
<configuration> <property> <name>fs.default.name</name> <value>hdfs://localhost:9000</value> </property> </configuration>
conf/hdfs-site.xml:
<configuration> <property> <name>dfs.replication</name> <value>1</value> </property> </configuration>
conf/mapred-site.xml:
<configuration> <property> <name>mapred.job.tracker</name> <value>localhost:9001</value> </property> </configuration>3.3启动:
bin/hadoop namenode -format
bin/start-all.sh
4. Browse the web interface for the NameNode and the JobTracker; by default they are available at:
- NameNode - http://localhost:50070/
- JobTracker - http://localhost:50030/