【HIVE】hiveserver2 不能启动端口 10000 开启服务的相关经验总结

来源:互联网 发布:淘宝卖家欺骗消费者 编辑:程序博客网 时间:2024/05/18 01:44

原创文章,转载请标注来自http://blog.csdn.net/lsttoy/article/details/53490144。
这个问题困扰了我三天,各种查资料踩坑填坑的尝试,终于搞定了这个问题。

首先来品尝下喜悦!

[root@master bin]# beelinels: cannot access /home/hive/lib/hive-jdbc-*-standalone.jar: No such file or directoryBeeline version 2.1.0 by Apache Hivebeeline> !connect jdbc:hive2://114.215.xxx.xxx:10000/defaultConnecting to jdbc:hive2://114.215.xxx.xxx:10000/defaultEnter username for jdbc:hive2://114.215.xxx.xxx:10000/default: rootEnter password for jdbc:hive2://114.215.xxx.xxx:10000/default: ************SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/home/hadoop/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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.apache.logging.slf4j.Log4jLoggerFactory]Connected to: Apache Hive (version 2.1.0)Driver: Hive JDBC (version 2.1.0)16/12/06 17:08:41 [main]: WARN jdbc.HiveConnection: Request to set autoCommit to false; Hive does not support autoCommit=false.Transaction isolation: TRANSACTION_REPEATABLE_READ0: jdbc:hive2://114.215.xxx.xxx:10000/default> 

OK,言归正传。从头梳理面临了多少问题。
如果还没有安装hive的同学可以参见我之前的博文教程。

《【Hadoop】hadoop2.7.3安装hive 2.1.0》


第一个问题
报错内容如下:

org.apache.hadoop.ipc.RemoteException: User: root is not allowed to impersonate root

这点就比较恶心了,一般来说,可能只是在hadoop中配置的代理用户不一样,如hadoop is not allowed to impersonate root 或者 root is not allowed to impersonate hive 啥的,但是根据网络上调整后尝试的方法,即对应value上面调整为hadoop 和localhost,没有作用。
我本人的设置为:
这里第三个字段我是root,因为试验环境,我全部用的root,避免权限问题。你可以根据自己的来设置。

     <property>        <name>hadoop.proxyuser.root.hosts</name>        <value>*</value>     </property>     <property>        <name>hadoop.proxyuser.root.groups</name>        <value>*</value>     </property>  

第二个问题
报错内容如下:

beeline> !connect jdbc:hive2://114.215.xxx.xxx:10000/defaultConnecting to jdbc:hive2://114.215.xxx.xxx:10000/defaultEnter username for jdbc:hive2://114.215.xxx.xxx:10000/default: rootEnter password for jdbc:hive2://114.215.xxx.xxx:10000/default: ************16/12/05 14:25:23 [main]: WARN jdbc.HiveConnection: Failed to connect to 114.215.xxx.xxx:10000Error: Could not open client transport with JDBC Uri: jdbc:hive2://114.215.xxx.xxx:10000/default: java.net.ConnectException: Connection refused (state=08S01,code=0)

这里链接拒绝,说明以下几个问题
第一个,至少你连接是成功的,不然不会出现让你验证username和password的问题。
第二个,你的链接有问题。有可能是你现在连接的并不是hive2,而是启动的服务hiveserver。这个和hiveserver2有很大的版本区别,具体可以百度。
第三个,当链接的是hive2,但是还是拒绝的时候,可能问题出在你配置上面,如下:

  <property>    <name>hive.server2.transport.mode</name>    <value>binary</value>    <description>      Expects one of [binary, http].      Transport mode of HiveServer2.    </description>  </property>

切记,当你这里设置为http的时候,此时服务器只提供端口10001的服务,即HTTP方式访问。
这时候10000端口是不开启的!
本人就是在这个地方卡了好几天。因此你要用java通过jdbc访问,一定要选择binary。

第三个问题
报错内容如下:

[root@master ~]# Starting Hive Metastore ServerSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/home/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/home/hadoop/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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.apache.logging.slf4j.Log4jLoggerFactory]org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.0.0.0:9083.

这里表示你可能存在两个问题:
其一,9083端口的metastore服务已经在使用中,你要停止,可以通过查询PID然后kill来进行重新启动。(如果你选择的是后台启动的话hive –service metastore &)
其二,你的设置文件中hive-site.xml中,注意metastore的设置。
我这里给出我一部分的设置,其他的你可以百度自己查询。

 <property>    <name>hive.metastore.local</name>    <value>false</value>    <description>controls whether to connect to remote metastore server or open a new metastore server in Hive Client JVM</description>  </property>  <property>    <name>hive.metastore.uris</name>    <value>thrift://114.215.xxx.xxx:9083</value>    <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>  </property>

另外,几个默认配置为0.0.0.0的地方不要轻易改动。除非你明确的知道修改的目的,否则请默认设置。

  <property>    <name>hive.hwi.listen.host</name>    <value>0.0.0.0</value>    <description>This is the host address the Hive Web Interface will listen on</description>  </property> <property>    <name>hive.server2.webui.host</name>    <value>0.0.0.0</value>    <description>The host address the HiveServer2 WebUI will listen on</description>  </property>

尤其是hive.server2.webui.host 不要随意改动。


如果遇到上述三个问题之外,还是无法链接上10000端口的话,记得用以下步骤。

一,先开启 metastore

hive --service metastore &

二,先开启 hiveserver2

 hive --service hiveserver2 &

三,可以通过命令netstat -ntulp |grep 10000
可以看到结果
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 27799/java

0 0
原创粉丝点击