我正在使用Cygwin在7位64位窗口上安装Hadoop。成功格式化Hadoop之后,我想使用以下命令启动它:start-dfs.sh。但报告为:
]tarting namenodes on [DATASCIENCES01
: Name or service not knownstname datasciences01
Starting datanodes
]tarting secondary namenodes [0.0.0.0
: Name or service not knownstname 0.0.0.0
]tarting journal nodes [
: Name or service not knownstname
2018-06-26 10:47:10,208 WARN util.Shell: Did not find winutils.exe: {}
java.io.FileNotFoundException: Could not locate Hadoop executable: C:\cygwin64\usr\local\hadoop-3.1.0\bin\winutils.exe -see https://wiki.apache.org/hadoop/WindowsProblems
at org.apache.hadoop.util.Shell.getQualifiedBinInner(Shell.java:620)
at org.apache.hadoop.util.Shell.getQualifiedBin(Shell.java:593)
at org.apache.hadoop.util.Shell.<clinit>(Shell.java:690)
at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:78)
at org.apache.hadoop.hdfs.tools.GetConf$Command.<clinit>(GetConf.java:86)
at org.apache.hadoop.hdfs.tools.GetConf.<clinit>(GetConf.java:136)
2018-06-26 10:47:10,540 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
我使用命令:bash -x ./start-dfs.sh尝试调试:
]tarting namenodes on [DATASCIENCES01
+ hadoop_uservar_su hdfs namenode /cygdrive/c/cygwin64/usr/local/hadoop-3.1.0/bin/hdfs --workers --config /usr/local/hadoop-3.1.0/etc/hadoop --hostnames $'DATASCIENCES01\r' --daemon start namenode
+ declare program=hdfs
+ declare command=namenode
+ shift 2
+ declare uprogram
+ declare ucommand
+ declare uvar
+ declare svar
+ hadoop_privilege_check
+ [[ 1063539 = 0 ]]
+ /cygdrive/c/cygwin64/usr/local/hadoop-3.1.0/bin/hdfs --workers --config /usr/local/hadoop-3.1.0/etc/hadoop --hostnames $'DATASCIENCES01\r' --daemon start namenode
: Name or service not knownstname datasciences01
我看到我的主机名被称为'DATASCIENCES01 \ r' 代替“ DATASCIENCES01” 。
我想\ r对应于Windows典型的行尾,因此我使用dos2unix来转换文件core-site.xml,其中引用了NameNode名称:
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop_data</value>
<description>directory for hadoop data</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://DATASCIENCES01:54311</value>
<description> data to be put on this URI</description>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://DATASCIENCES01:54311</value>
<description>Use HDFS as file storage engine</description>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
</configuration>
但是最后它不会更改此'\ r'。
我在此链接上找到了类似的主题:
When Hadoop 2.7 start on windows 7 64 bits: Name or service not knownstname localhost
但是仍然没有答案。
预先感谢