1.下载一个hive版本,cdh4.5的配套版本hive-0.10.0-cdh4.5.0。
2.修改hive/conf下hive-site.xml文件,无则创建hive-site.xml,在底部添加如下内容:
Exception in thread "main" java.lang.RuntimeException: org.xml.sax.SAXParseException; systemId: file:/opt/cdh4.5/hive-0.10.0-cdh4.5.0/conf/hive-site.xml; lineNumber: 6; columnNumber: 2; The markup in the document following the root element must be well-formed.
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2207)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2064)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1972)
at org.apache.hadoop.conf.Configuration.get(Configuration.java:1034)
at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1065)
at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1016)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:635)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:613)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.util.RunJar.main(RunJar.java:208)
Caused by: org.xml.sax.SAXParseException; systemId: file:/opt/cdh4.5/hive-0.10.0-cdh4.5.0/conf/hive-site.xml; lineNumber: 6; columnNumber: 2; The markup in the document following the root element must be well-formed.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:150)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2042)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2030)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2098)
... 12 more
2.修改hive/conf下hive-site.xml文件,无则创建hive-site.xml,在底部添加如下内容:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.querylog.location</name>
<value>/hadoop/hive/logs</value>
</property>
<property>
<name>hive.aux.jars.path</name>
<value>file:///opt/cdh4.5/hive-0.10.0-cdh4.5.0/lib/hive-hbase-handler-0.10.0-cdh4.5.0.jar,file:///opt/cdh4.5/hive-0.10.0-cdh4.5.0/lib/hbase-0.94.6-cdh4.5.0.jar,file:///opt/cdh4.5/hive-0.10.0-cdh4.5.0/lib/zookeeper-3.4.5-cdh4.5.0.jar</value>
</property>
</configuration>
3.启动hive集群正常情况结果如下:
[root@master bin]# hive -hiveconf hbase.zookeeper.quorum=slave
Logging initialized using configuration in jar:file:/opt/cdh4.5/hive-0.10.0-cdh4.5.0/lib/hive-common-0.10.0-cdh4.5.0.jar!/hive-log4j.properties
Hive history file=/hadoop/hive/logs/hive_job_log_5cb84500-a21f-43c8-adb7-05ed6031ad25_1332797293.txt
hive>
搭建过程报错如下:原因:标签没有配对,可能是格式问题,仔细查看。
[Fatal Error] hive-site.xml:6:2: The markup in the document following the root element must be well-formed.Exception in thread "main" java.lang.RuntimeException: org.xml.sax.SAXParseException; systemId: file:/opt/cdh4.5/hive-0.10.0-cdh4.5.0/conf/hive-site.xml; lineNumber: 6; columnNumber: 2; The markup in the document following the root element must be well-formed.
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2207)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2064)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1972)
at org.apache.hadoop.conf.Configuration.get(Configuration.java:1034)
at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1065)
at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1016)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:635)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:613)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.util.RunJar.main(RunJar.java:208)
Caused by: org.xml.sax.SAXParseException; systemId: file:/opt/cdh4.5/hive-0.10.0-cdh4.5.0/conf/hive-site.xml; lineNumber: 6; columnNumber: 2; The markup in the document following the root element must be well-formed.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:150)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2042)
at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2030)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2098)
... 12 more