问题
配置完hadoop各种文件,包括core-site.xml等后,准备启动hadoop:start-dfs.sh
,提示错误,如下:
[Fatal Error] core-site.xml:2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
19/03/12 10:38:00 FATAL conf.Configuration: error parsing conf core-site.xml
org.xml.sax.SAXParseException; systemId: file:/usr/local/hadoop/etc/hadoop/core-site.xml; lineNumber: 2; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.
原因
提示的意思是core-site.xml的第2行第六列出错,但感觉我没改动第2行啥啊。
回去看下,我在编辑的时候,在这个文件的第一行不小心增加了一个空行,难道是这个错误?
解决办法
重新编辑core-site.xml,去掉第一行空行。再运行start-dfs.sh
,成功。
总结
不要轻易改变hadoop配置文件的一个空行,甚至一个空格。
之前在设置PATH变量的时候,就是因为 = 号前后多了一个空格,然后就导致提示错误。
hadoop对空行和空格的容忍度真心低。