过了许久重启了一下hive,输入hive成功进去了,但当我show databasesl时却却显示如下错误:
hive.log日志默认位置位于:/tmp/root/hive.log
查看日志错误信息如下:
我的hive-site.xml如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- hive元数据的存储位置 -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://centos7-3:3306/hivemetadata?createDatabaseIfNotExist=true&useSSL=false</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<!-- 指定驱动程序 -->
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<!-- 连接数据库的用户名 -->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>username to use against metastore database</description>
</property>
<!-- 连接数据库的口令 -->
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>12345678</value>
<description>password to use against metastore database</description>
</property>
<!-- 数据默认的存储位置(HDFS) -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<!-- 在命令行中,显示当前操作的数据库 -->
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
<description>Whether to include the current database in the Hive prompt.</description>
</property>
<!-- 在命令行中,显示数据的表头 -->
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<!-- 操作小规模数据时,使用本地模式,提高效率 -->
<property>
<name>hive.exec.mode.local.auto</name>
<value>true</value>
<description>Let Hive determine whether to run in local mode automatically</description>
</property>
<!--指定metastore地址,之前添加过可以不⽤添加 -->
<property>
<name>hive.metastore.uris</name>
<value>thrift://centos7-1:9083,thrift://centos7-3:9083</value>
</property>
<property>
<name>hive.metastore.client.socket.timeout</name>
<value>3600</value>
</property>
<property>
<name>datanucleus.schema.autoCreateAll</name>
<value>true</value>
</property>
</configuration>
问题解决:
只要先启动元数据服务,就不会出现这个错误了
bin/hive --service metastore &
bin/hive
成功!