qing_D7BWs 发表于 2017-12-31 11:36:36

hadoop shell 报错

namenode启动的服务:10681 NameNode
11092 ResourceManager
11659 Jps
10983 DFSZKFailoverController
11455 HMaster

datanode启动的服务:
3973 HRegionServer
3795 NodeManager
1194 QuorumPeerMain
4153 Jps
3681 JournalNode
3601 DataNode

hadoop的版本2.7.3,但是执行命令 hadoop fs -cat /flume/data/FlumeData.1514611089359 时报错:
-cat: java.net.UnknownHostException: ns
Usage: hadoop fs -cat [-ignoreCrc] <src> ...

这是什么原因啊?

nextuser 发表于 2017-12-31 15:53:12

在hosts里面看看是否有ns。

qing_D7BWs 发表于 2017-12-31 17:49:31

nextuser 发表于 2017-12-31 15:53
在hosts里面看看是否有ns。

没有,我清过hosts,这个要怎么配置?

nextuser 发表于 2017-12-31 18:43:13

qing_D7BWs 发表于 2017-12-31 17:49
没有,我清过hosts,这个要怎么配置?

你的cores-site.xml,内容贴出来。可能你的hdfs://hostname:端口。这里写错了

qing_D7BWs 发表于 2018-1-2 22:36:18

nextuser 发表于 2017-12-31 18:43
你的cores-site.xml,内容贴出来。可能你的hdfs://hostname:端口。这里写错了

core-site.xml配置:
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://ns/</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/data/hadoop/tmp</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>node6:2181,node7:2181,node8:2181</value>
</property>
<property>
<name>ha.health-monitor.rpc-timeout.ms</name>
<value>300000</value>
</property>
</configuration>

hdfs-site.xml配置:
<configuration>
<property>
<name>dfs.nameservices</name>
<value>ns</value>
</property>
<property>
<name>dfs.ha.namenodes.ns</name>
<value>nn1,nn2</value>
</property>
<property>
<name>dfs.namenode.rpc-address.ns.nn1</name>
<value>node4:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.ns.nn1</name>
<value>node4:50070</value>
</property>
<property>
<name>dfs.namenode.rpc-address.ns.nn2</name>
<value>node5:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.ns.nn2</name>
<value>node5:50070</value>
</property>
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://node6:8485;node7:8485;node8:8485/ns</value>
</property>
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/data/hadoop/journaldata</value>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.client.failover.proxy.provider.ns1</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/home/hadoop/.ssh/id_rsa</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.connect-timeout</name>
<value>30000</value>
</property>
<property>
<name>dfs.datanode.max.xcievers</name>
<value>4096</value>
</property>
</configuration>

qing_D7BWs 发表于 2018-1-2 23:08:23

nextuser 发表于 2017-12-31 18:43
你的cores-site.xml,内容贴出来。可能你的hdfs://hostname:端口。这里写错了

确实是这个配置的问题,我看了一下文档,原话是这样:
The name of the default file system.A URI whose
scheme and authority determine the FileSystem implementation.The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class.The uri's authority is used to
determine the host, port, etc. for a filesystem.

这个配置项是决定了hdfs的主机,端口。但是我有一个疑问,如果hdfs的主机和端口在这里写死了,那么高可用怎么配置,如果这里配置的主机宕机了,那么hdfs shell岂不是也没用了。
页: [1]
查看完整版本: hadoop shell 报错