背景
Hive是Hadoop生态区中为数不多支持SQL的一个SQLengine,但支持的程度不是100%,比如,建模时要用到的limit offset,查看了Hive的手册,里面是不支持的。
问题
1.在使用Hive的期间,遇到最多的,也是之前一直没有解决的,耗时最长的,就是使用beeline远程链接的问题了。
现象
./bin/beeline -u jdbc:hive2://162.18.1.10:10000
Connecting to jdbc:hive2://162.18.1.10:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://162.18.1.10:10000: java.net.ConnectException: 接続を拒否されました (state=08S01,code=0)
Beeline version 1.2.1 by Apache Hive
0: jdbc:hive2://162.18.1.10:10000 (closed)>
之前初步调查了一下,只是为了使用,简单调查了一下,最简单的就是使用如下命令:
./bin/beeline -u jdbc:hive2://
但如果Hive的客户端跟服务器是分开,或者是远程去连接Hive服务,比如zeppelin之类的,就需要特别的指定IP了。上面的解决策就不行了。
当指定如上所示的,就会出错,如果直接使用
./bin/beeline
进入到beeline的客户端,需要连接hive服务,使用如下命令:
!connect jdbc:hive2://162.18.1.10:10000
需要指定用户名跟密码。
为此,需要如下设置信息:
追加用户自己设定的属性值:conf/hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><configuration>
<!-- WARNING!!! This file is auto generated for documentation purposes ONLY! -->
<!-- WARNING!!! Any changes you make to this file will be ignored by Hive. -->
<!-- WARNING!!! You must make your changes in hive-site.xml instead. -->
<!-- Hive Execution Parameters -->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>ername to use against metastoredatabase</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description>password to use against metastoredatabase</description>
</property>
</configuration>
重启Hive服务。
再次尝试,使用
./bin/beeline -u jdbc:hive2://162.18.1.10:10000
或者