Hadoop单节点安装 - 格式错误 - 序言中不允许内容

Nik*_*Nik 2 xml hadoop

我正在尝试进行 hadoop 单节点安装。

我正在关注这篇文章以获取 hadoop 安装说明。我需要做的步骤之一是使用命令格式化 hadoop 文件系统

hduser@dbserver:~/hadoop/conf$ /home/hduser/hadoop/bin/hadoop namenode -format

hduser@dbserver:~/hadoop/conf$ /home/hduser/hadoop/bin/hadoop namenode -format
12/02/06 18:24:31 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = dbserver/127.0.1.1
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 0.20.203.0
STARTUP_MSG:   build = http://svn.apache.org/repos/asf/hadoop/common/branches/branch-    0.20-security-203 -r 1099333; compiled by 'oom' on Wed May  4 07:57:50 PDT 2011
 ************************************************************/
 [Fatal Error] core-site.xml:6:1: Content is not allowed in prolog.
 12/02/06 18:24:31 FATAL conf.Configuration: error parsing conf file:  org.xml.sax.SAXParseException: Content is not allowed in prolog.
 12/02/06 18:24:31 ERROR namenode.NameNode: java.lang.RuntimeException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1237)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1093)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1037)
at org.apache.hadoop.conf.Configuration.set(Configuration.java:438)
at org.apache.hadoop.hdfs.server.namenode.NameNode.setStartupOption(NameNode.java:1124)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1141)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1162)
 Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1142)
... 6 more

    12/02/06 18:24:31 INFO namenode.NameNode: SHUTDOWN_MSG: 
    /************************************************************
      SHUTDOWN_MSG: Shutting down NameNode at dbserver/127.0.1.1
    ************************************************************/
Run Code Online (Sandbox Code Playgroud)

尝试格式化时收到上述错误消息

欢迎任何解决此问题的建议:)。

core-site.xml 文件在这里供您参考@zensen

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

 <!-- Put site-specific property overrides in this file. -->

  n: conf/core-site.xml -->
  <property>
  <name>hadoop.tmp.dir</name>
  <value>/app/hadoop/tmp</value>
  <description>A base for other temporary directories.</description>
  </property>

    <property>
    <name>fs.default.name</name>
    <value>hdfs://localhost:54310</value>
    <description>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.</description>
   </property><configuration>
Run Code Online (Sandbox Code Playgroud)

~

Mat*_*zyk 5

嗯,这并不是真正的 Hadoop 问题。

org.xml.sax.SAXParseException: Content is not allowed in prolog.
Run Code Online (Sandbox Code Playgroud)

表示您的 XML 文件不正确。更准确地说,它在<?xml. core-site.xml前面有没有开头的人物<?xml?如果是这样,那么删除它们。请记住,这些可能不会在所有编辑器中显示(取决于编码)。