我正在用cygwin在window7 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'。
我在这个链接上发现了一个类似的主题:
当hadoop2.7在windows7上启动时64位:name or service not knownstname localhost
但仍然没有答案。
提前谢谢
暂无答案!
目前还没有任何答案,快来回答吧!