一、修改配置文件:
conf/core-site.xml:
conf/hdfs-site.xml:
conf/mapred-site.xml:
二、配置ssh密钥
第一条命令:生成ssh的密钥
第二条命令:添加公钥到ssh许可文件中。这样就可以不用在每次ssh连接的时候输入密码了
三、执行
1、格式化一个hdsf文件系统
2、启动hadoop daemons:
3、在浏览器上查看NameNode和JobTracker
NameNode - [url]http://localhost:50070/[/url]
JobTracker - [url]http://localhost:50030/[/url]
[b][补充][/b]
在os x系统下,由于目录结构问题可能会导致namenode启动失败(异常信息为:org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /private/tmp/hadoop-xx/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible)。
需要在hdfs-site.xml添加配置
并重新格式化namenode
参考地址:[url]http://hadoop.apache.org/docs/r1.1.1/single_node_setup.html[/url]
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>
二、配置ssh密钥
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
第一条命令:生成ssh的密钥
第二条命令:添加公钥到ssh许可文件中。这样就可以不用在每次ssh连接的时候输入密码了
三、执行
1、格式化一个hdsf文件系统
bin/hadoop namenode -format
2、启动hadoop daemons:
bin/start-all.sh
3、在浏览器上查看NameNode和JobTracker
NameNode - [url]http://localhost:50070/[/url]
JobTracker - [url]http://localhost:50030/[/url]
[b][补充][/b]
在os x系统下,由于目录结构问题可能会导致namenode启动失败(异常信息为:org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /private/tmp/hadoop-xx/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible)。
需要在hdfs-site.xml添加配置
<property>
<name>dfs.name.dir</name>
<value>/Users/xx/hadoop/name/</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/Users/xx/hadoop/data/</value>
</property>
并重新格式化namenode
bin/hadoop namenode -format
参考地址:[url]http://hadoop.apache.org/docs/r1.1.1/single_node_setup.html[/url]