Hadoop2.6.0单机/伪分布式安装(3)

Hadoop 的配置文件位于 /home/hadoop/opt/hadoop-2.6.0/etc/hadoop/ 中,伪分布式需要修改2个配置文件 core-site.xml 和 hdfs-site.xml 。

修改配置文件 core-site.xml 

<configuration> <property> <name>hadoop.tmp.dir</name> <value>file:/home/hadoop/opt/hadoop-2.6.0/tmp</value> </property> <property> <name>fs.defaultFS</name> <value>hdfs://localhost:9000</value> </property> </configuration>

接着修改配置文件 hdfs-site.xml

<configuration> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/home/hadoop/opt/hadoop-2.6.0/tmp/dfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/home/hadoop/opt/hadoop-2.6.0/tmp/dfs/data</value> </property> </configuration>

配置完成后,执行 namenode 的格式化:

hadoop@ubuntu:~/opt/hadoop-2.6.0$ bin/hdfs namenode -format

最后几行如下:

15/05/13 08:50:15 INFO namenode.FSImage: Allocated new BlockPoolId: BP-707136192-127.0.1.1-1431532215593
15/05/13 08:50:15 INFO common.Storage: Storage directory /home/hadoop/opt/hadoop-2.6.0/tmp/dfs/name has been successfully formatted.
15/05/13 08:50:16 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
15/05/13 08:50:16 INFO util.ExitUtil: Exiting with status 0
15/05/13 08:50:16 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at ubuntu/127.0.1.1
************************************************************/

接着开启 NaneNode 和 DataNode 守护进程。

hadoop@ubuntu:~/opt/hadoop-2.6.0$ sbin/start-dfs.sh

出现下面的错误提示:

Starting namenodes on [localhost]
localhost: Error: JAVA_HOME is not set and could not be found.
localhost: Error: JAVA_HOME is not set and could not be found.
Starting secondary namenodes [0.0.0.0]

解决办法:

打开hdfs-site.xml文件,修改

export JAVA_HOME=/home/hadoop/opt/jdk1.8.0_45

问题解决~~~

Starting namenodes on [localhost]
localhost: starting namenode, logging to /home/hadoop/opt/hadoop-2.6.0/logs/hadoop-hadoop-namenode-ubuntu.out
localhost: starting datanode, logging to /home/hadoop/opt/hadoop-2.6.0/logs/hadoop-hadoop-datanode-ubuntu.out
Starting secondary namenodes [0.0.0.0]
The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established.
ECDSA key fingerprint is 1a:e1:fa:ce:18:2c:44:b7:0f:3b:38:fc:fd:05:8d:97.
Are you sure you want to continue connecting (yes/no)? yes
0.0.0.0: Warning: Permanently added '0.0.0.0' (ECDSA) to the list of known hosts.
0.0.0.0: starting secondarynamenode, logging to /home/hadoop/opt/hadoop-2.6.0/logs/hadoop-hadoop-secondarynamenode-ubuntu.out

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/0e077c5bf53c68701ec307d581bf7cb5.html