当我有hive-site.xml时,hive shell没有打开

时间:2015-02-16 07:20:19

标签: hive

我在我的VM播放器中安装了ubuntu 14和hadoop 2.6.0以及Hive 0.14.0。 在我的Hive / conf中没有Hive-site.xml,所以我创建了一个新文件。 但是当我打开Hive shell时我遇到了错误。如果我删除了hive-site.xml文件,我可以打开shell。为什么是这样?我该怎么办? Hive错误如下:

> hduser@ubuntu:/usr/lib/hive/apache-hive-0.14.0-bin/bin$ hive
15/02/15 22:51:00 WARN conf.HiveConf: DEPRECATED: Configuration property hive.metastore.local no longer has any effect. Make sure to provide a valid value for hive.metastore.uris if you are connecting to a remote metastore.
15/02/15 22:51:00 WARN conf.HiveConf: HiveConf of name hive.metastore.local does not exist

Logging initialized using configuration in jar:file:/usr/lib/hive/apache-hive-0.14.0-bin/lib/hive-common-0.14.0.jar!/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/lib/hive/apache-hive-0.14.0-bin/lib/hive-jdbc-0.14.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:444)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:672)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
    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:606)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
    at org.apache.hadoop.fs.Path.initialize(Path.java:206)
    at org.apache.hadoop.fs.Path.<init>(Path.java:172)
    at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:487)
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:430)
    ... 8 more
Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
    at java.net.URI.checkPath(URI.java:1804)
    at java.net.URI.<init>(URI.java:752)
    at org.apache.hadoop.fs.Path.initialize(Path.java:203)

任何帮助都会很棒!

7 个答案:

答案 0 :(得分:14)

您需要将以下配置添加到hive-site.xml

<property>
    <name>hive.querylog.location</name>
    <value>$HIVE_HOME/iotmp</value>
    <description>Location of Hive run time structured log file</description>
  </property>

  <property>
    <name>hive.exec.local.scratchdir</name>
    <value>$HIVE_HOME/iotmp</value>
    <description>Local scratch space for Hive jobs</description>
  </property>

  <property>
    <name>hive.downloaded.resources.dir</name>
    <value>$HIVE_HOME/iotmp</value>
    <description>Temporary local directory for added resources in the remote file system.</description>
  </property>

记得用你的hive目录替换$ HIVE_HOME

答案 1 :(得分:7)

将以下内容放在hive-site.xml的开头

<configuration>
  <property>
    <name>system:java.io.tmpdir</name>
    <value>/tmp/hive/java</value>
  </property>
  <property>
    <name>system:user.name</name>
    <value>${user.name}</value>
  </property>

另见this问题

答案 2 :(得分:4)

首先,您需要将hive-default.xml.template的配置文件复制到创建的hive-site.xml

Hive Admin Configuration manual中所述  设置以下配置

<property>
   <name>hive.querylog.location</name>
   <value>/tmp/hive</value>
   <description>Location of Hive run time structured log file</description>
</property>

<property>
   <name>hive.exec.local.scratchdir</name>
   <value>/tmp/hive</value>
   <description>Local scratch space for Hive jobs</description>
</property>

<property>
   <name>hive.downloaded.resources.dir</name>
   <value>/tmp/hive</value>
   <description>Temporary local directory for added resources in the remote file system.</description>
</property>

我开始使用蜂巢和直线。

答案 3 :(得分:2)

如果您使用Hive-1.0.0然后在HIVE_HOME中创建以log命名的新目录,那么转到hive-site.xml找到 $ {system:java.io.tmpdir} 并替换为log目录路径 例如。 /家庭/ hduser /蜂巢/日志/........

答案 4 :(得分:1)

安装最新的Hadoop 2.x.y和Hive 1.x.y:

如果你有Hive Start问题:

编辑:

$ HIVE_HOME / CONF /蜂巢-site.xml中

<property>
  <name>hive.exec.local.scratchdir</name>
    <value>$HIVE_HOME/iotmp</value>
    <description>Local scratch space for Hive jobs</description>
</property>



<property>
   <name>hive.querylog.location</name>
    <value>$HIVE_HOME/iotmp</value>
    <description>Location of Hive run time structured log file</description>
 </property>



 <property>
   <name>hive.downloaded.resources.dir</name>
    <value>$HIVE_HOME/iotmp</value>
    <description>Temporary local directory for added resources in the remote file system.</description>
 </property>

答案 5 :(得分:0)

相对路径URISyntaxException异常在您之前必须指定相对路径。 在尝试启动HMaster时我也遇到了类似的问题,错误是因为我在hbase-site.xml中使用hdfs的相对路径来获取hbase.rootdir属性 纠正根目录路径能够正常启动Hmaster

导致异常的路径:hdfs:// localhost:8020

正确路径:hdfs:// localhost:8020 / hbase

答案 6 :(得分:0)

只是将以下设置添加到hive-site.xml

[hadoop@djt01 conf]$ vi hive-site.xml
< property>
    < name>hive.querylog.location< /name>
    < value>/home/hadoop/app/hive/iotmp< /value>
    < description>Location of Hive run time structured log file< /description>
< /property>

< property>
    < name>hive.exec.local.scratchdir< /name>
    < value>/home/hadoop/app/hive/iotmp< /value>
    < description>Local scratch space for Hive jobs< /description>
< /property>

< property>
    < name>hive.downloaded.resources.dir< /name>
    < value>/home/hadoop/app/hive/iotmp< /value>
    < description>Temporary local directory for added resources in the remote file system.< /description>
< /property>

save&amp; restart hive

  [hadoop@djt01 hive]$ hive
    hive> show databases;
    OK
    default
    Time taken: 3.684 seconds, Fetched: 1 row(s)
    hive>