我正在将Cloudera Docker容器与Beeline CLI一起使用。 我正在尝试通过以下方式访问metastore数据库:
!connect jdbc:hive2://localhost:10000/metastore hive cloudera org.apache.hive.jdbc.HiveDriver
但不是成功的连接,而是引发响应:
Error: Could not establish connection to jdbc:hive2://localhost:10000/metastore: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=metastore}) (state=08S01, code=0)
这是我的hive-site.xml文件:
`<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>`
`<configuration>`
`<!-- Hive Configuration can either be stored in this file or in the hadoop configuration files -->
<!-- that are implied by Hadoop setup variables. -->
<!-- Aside from Hadoop setup variables - this file is provided as a convenience so that Hive -->
<!-- users do not have to edit hadoop configuration files (that may be managed as a centralized -->
<!-- resource).` -->
`<!-- Hive Execution Parameters -->`
`<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://127.0.0.1/metastore?createDatabaseIfNotExist=true</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>
</property>`
`<property>
<name>hadoop.proxyuser.hiveuser.hosts</name>
<value>*</value>
</property>`
`<property>
<name>hadoop.proxyuser.hiveuser.groups</name>
<value>*</value>
</property>`
`<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>cloudera</value>
</property>`
`<property>
<name>hive.metastore.warehouse.dir</name>
<value>/usr/hive/warehouse</value>
</property>`
`<property>
<name>hive.hwi.war.file</name>
<value>/usr/lib/hive/lib/hive-hwi-0.8.1-cdh4.0.0.jar</value>
<description>This is the WAR file with the jsp content for Hive Web Interface</description>
</property>`
`<property>
<name>datanucleus.fixedDatastore</name>
<value>true</value>
</property>`
`<property>
<name>datanucleus.autoCreateSchema</name>
<value>false</value>
</property>`
`<property>
<name>hive.zookeeper.client.port</name>
<value>2222</value>
<description>
The port at which the clients will connect
</description>
</property>`
`<property>
<name>hive.support.concurrency</name>
<description>Enable Hive's Table Lock Manager Service</description>
<value>true</value>
</property>`
`<property>
<name>hive.zookeeper.quorum</name>
<description>Zookeper quorum used by Hive's Table Lock Manager</description>
<value>zk1.myco.com, zk2.myco.com, zk3.myco.com</value>
</property>`
`<property>
<name>hive.metastore.uris</name>
<value>thrift://127.0.0.1:9083</value>
<description>IP address (or fully-qualified domain name) and port of the metastore host</description>
</property>
</configuration>`
我已经尝试使用jdbc:thrift://localhost:10000/*
和jdbc:hive2://localhost:9083/*
和jdbc:thrift://localhost:9083/*
。
最后一个抛出NullPointerException
,第一个和第二个拒绝与java.net.SocketException
连接。
我也尝试用不同的方式初始化metastore数据库
/usr/lib/hive/scripts/metastore/upgrade/mysql/hive-schema-n.n.n.mysql.sql
脚本,包括0.10.0、1.1.0(这是我的蜂巢版本)
使用--privileged=true
选项运行容器。
服务mysqld
,hive-metastore
和hive-server2
在默认端口上启动。