我正在建立一个Hadoop 2.6.0单节点集群.我按照hadoop-common/SingleCluster文档进行操作.我继续努力Ubuntu 14.04.到目前为止,我已成功运行独立操作.
我在尝试执行伪分布式操作时遇到错误.我设法启动NameNode守护进程和DataNode守护进程.jps oputut:
martakarass@marta-komputer:/usr/local/hadoop$ jps
4963 SecondaryNameNode
4785 DataNode
8400 Jps
martakarass@marta-komputer:/usr/local/hadoop$
Run Code Online (Sandbox Code Playgroud)
但是当我尝试执行MapReduce作业所需的HDFS目录时,我收到以下错误:
martakarass@marta-komputer:/usr/local/hadoop$ bin/hdfs dfs -mkdir /user
15/05/01 20:36:00 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
mkdir: Failed on local exception: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type.; Host Details : local host is: "marta-komputer/127.0.0.1"; destination host is: "localhost":9000;
martakarass@marta-komputer:/usr/local/hadoop$
Run Code Online (Sandbox Code Playgroud)
(我相信我现在可以忽略这个WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform...警告.)
说到Hadoop配置文件,我只更改了文档中提到的文件.我有:
etc/hadoop/core-site.xml:
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
Run Code Online (Sandbox Code Playgroud)
etc/hadoop/hdfs-site.xml:
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我设法连接到localhost:
martakarass@marta-komputer:~$ ssh localhost
martakarass@localhost's password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-45-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Fri May 1 20:28:58 2015 from localhost
Run Code Online (Sandbox Code Playgroud)
我格式化了文件系统:
martakarass@marta-komputer:/usr/local/hadoop$ bin/hdfs namenode -format
15/05/01 20:30:21 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = marta-komputer/127.0.0.1
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 2.6.0
(...)
15/05/01 20:30:24 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at marta-komputer/127.0.0.1
************************************************************/
Run Code Online (Sandbox Code Playgroud)
/ etc/hosts:
127.0.0.1 localhost
127.0.0.1 marta-komputer
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Run Code Online (Sandbox Code Playgroud)
etc/hostname:
marta-komputer
Run Code Online (Sandbox Code Playgroud)
删除 127.0.0.1 localhost并/etc/hosts
更改您core-site.xml喜欢的内容:
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://marta-komputer:9000</value>
</property>
</configuration>
Run Code Online (Sandbox Code Playgroud)
你可以忽略WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform...警告