伪分布式Hadoop配置安装

1. 安装Hadoop到/home/xsj/hadoop:
$ tar -zxvf hadoop-0.20.2.tar.gz
 
2. 创建目录:
$ mkdir /home/xsj/hadoop/hadoop-0.20.2/hadooptmp
$ mkdir /home/xsj/hadoop/hadoop-0.20.2/hdfs/data
$ mkdir /home/xsj/hadoop/hadoop-0.20.2/hdfs/name
$ mkdir /home/xsj/hadoop/hadoop-0.20.2/mapred/local
$ mkdir /home/xsj/hadoop/hadoop-0.20.2/mapred/system
 
3. 修改~/hadoop/hadoop-0.20.2/conf/下的配置文件:
(1)hadoop-env.sh:
export JAVA_HOME=/usr/local/java/jdk1.6.0_32
 
(2)core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
 
<property>
<name>hadoop.tmp.dir</name>
<value>/home/xsj/hadoop/hadoop-0.20.2/hadooptmp</value>
</property>
</configuration>
 
(3)hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
 
<property>
<name>dfs.name.dir</name>
<value>/home/xsj/hadoop/hadoop-0.20.2/hdfs/name</value>
</property>
 
<property>
<name>dfs.data.dir</name>
<value>/home/xsj/hadoop/hadoop-0.20.2/hdfs/data</value>
</property>
</configuration>
 
(4)mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
</property>
 
<property>
<name>mapred.local.dir</name>
<value>/home/xsj/hadoop/hadoop-0.20.2/mapred/local</value>
</property>
 
<property>
<name>mapred.system.dir</name>
<value>/home/xsj/hadoop/hadoop-0.20.2/mapred/system</value>
</property>
</configuration>
 
(5)masters
localhost
 
(6)slaves
localhost
 
4. 格式化HDFS文件系统:
$ ./bin/hadoop namenode -format
 
5. 启动Hadoop:
$ ./bin/start-all.sh
 
6. 验证Hadoop是否安装成功:
打开浏览器,分别输入网址:
http://localhost:50030 (MapReduce的Web页面)
http://localhost:50070 (HDFS的Web页面)
 
7. 关闭Hadoop:
$ ./bin/stop-all.sh
 
8. 特别注意:
(1)不要以root身份运行Hadoop,否则会涉及到Java虚拟机的-jvm选项问题,导致Hadoop启动失败。
 
(2)每次重启Hadoop之前,务必先删除hadooptmp文件夹,防止因hadoop的错误退出导致的启动namenode和jobtracker失败。
 
(3)单机伪分布式部署启动失败可以尝试格式化HDFS文件系统。
 
(4)有用的命令:$ jps

你可能感兴趣的:(hadoop,伪分布式Hadoop配置安装)