转载来自http://blog.csdn.net/lsttoy/article/details/53490144

这个问题困扰了我三天,各种查资料踩坑填坑的尝试,终于搞定了这个问题。

首先来品尝下喜悦!

[root@master bin]# beeline
ls: cannot access /home/hive/lib/hive-jdbc-*-standalone.jar: No such file or directory
Beeline version 2.1.0 by Apache Hive
beeline> !connect jdbc:hive2://114.215.xxx.xxx:10000/default
Connecting to jdbc:hive2://114.215.xxx.xxx:10000/default
Enter username for jdbc:hive2://114.215.xxx.xxx:10000/default: root
Enter 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_READ
0: 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/default
Connecting to jdbc:hive2://114.215.xxx.xxx:10000/default
Enter username for jdbc:hive2://114.215.xxx.xxx:10000/default: root
Enter 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:10000
Error: 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 Server
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]
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

【Hadoop】hiveserver2 不能启动端口 10000 开启服务的相关经验总结的更多相关文章

  1. Linux对外提供服务 网络操作 端口操作 1.开启服务监听端口 2.设置防火墙,放行访问端口的包 iptables&netfilter 四表五链和通堵策略

    主题: Linux服务器上软件提供服务 1.网络操作 2.端口操作 1.网络操作 本机必须能够ping通目标主机(本地虚拟机或者远程主机) 2.端口操作 1.开启服务监听端口 2.设置防火墙,放行访问 ...

  2. compute节点上开启服务openstack-nova-compute.service时,无法启动的解决方法

          本文前一部分为本人解决问题的过程,但最终没有解决:无奈在网上找方法时,看到有网友评论说:修改controller上的guest账号密码,再重启openstack-nova-compute. ...

  3. hive的hiveserver2模式启动不起来,发现Hadoop一直处于安全模式

    hive的hiveserver2模式启动不起来,发现Hadoop一直处于安全模式 命令介绍 命令hadoop fs –safemode get 查看安全模式状态 命令hadoop fs –safemo ...

  4. 【Azure微服务 Service Fabric 】Service Fabric中应用开启外部访问端口及微服务之间通过反向代理端口访问问题

    问题描述 1) 当成功的在Service Fabric集群中部署了应用后,如何来访问呢?如果是一个Web服务,它的URL又是什么呢? 2) 当Service Fabric集群中,服务之间如需要相互访问 ...

  5. Memcached监听多个端口_同一台Windows机器中启动多个Memcached服务

    下载Memcached服务器 假设你解压在"C:\Program Files\memcached\memcached.exe" 那么可以如下创建多个服务监听不同的端口啦 监听第一个 ...

  6. node服务开发环境判断和启动端口指定---process.env.NODE_ENV

    在node启动的时候我们需要在代码里面判断服务器运行环境 可以根据process.env.NODE_ENV来判断 一.开发环境的判断 1.安装 npm i -g cross-env 2.启动 cros ...

  7. Intellij IDEA中启动多个微服务--开启Run Dashboard管理

    1.找到workspace.xml 2.添加配置 <option name="configurationTypes"> <set> <option v ...

  8. Django 配置(一)开启服务

    注:这里使用的是命令行创建,当然也可以用 pycharm 自带的 django 项目创建更加简便. 安装django pip install django 创建项目 django-admin star ...

  9. 【转】启动、停止Windows服务的DOS命令

    需要用管理员身份运行 在图形界面中启动.停止服务很方便,但是操作系统有时候会出故障,此时不妨使用原始的DOS命令启动.停止服务,也许会收到意想不到的效果的! 方法/步骤 1 开始→所有程序. 2 附件 ...

随机推荐

  1. css目录

    想看css文章目录? 点击我

  2. Never Go Away

    Hey if you ever want to leave it allif you ever want to lose control leave it all escape so far away ...

  3. servlet实现验证码

    (博客内容来自:jsp使用servlet实现验证码,以下内容只是不才对原博客的摘抄以便以后翻阅使用) 一.原理: 验证码作为一个图片,在页面中为“画”出来的,它是如何画出来的呢? <生成图片&g ...

  4. Spring Cloud之Eureka自我保护环境搭建

    Eureka详解 服务消费者模式 获取服务 消费者启动的时候,使用服务别名,会发送一个rest请求到服务注册中心获取对应的服务信息,让后会缓存到本地jvm客户端中,同时客户端每隔30秒从服务器上更新一 ...

  5. Oracle创建函数

    --创建函数语法 create [or replace] function [schema.]function_name (函数参数列表) --参数有IN.OUT.IN OUT三种类型:IN代表需要输 ...

  6. Codeforces 358D Dima and Hares:dp【只考虑相邻元素】

    题目链接:http://codeforces.com/problemset/problem/358/D 题意: 有n个物品A[i]摆成一排,你要按照某一个顺序将它们全部取走. 其中,取走A[i]的收益 ...

  7. java:Eclipse插件springsource-tool-suite的下载和安装

    1.打开下载页面http://spring.io/tools/sts/all 找到这个,后补全部版本链接http://spring.io/tools/sts/legacy 插件压缩包下载安装: 链接下 ...

  8. Bootstrap-菜单,导航,按钮

    1.下拉菜单(基本用法) 在Bootstrap框架中的下拉菜单组件是一个独立的组件,根据不同的版本,它对应的文件: ☑  LESS版本:对应的源码文件为 dropdowns.less ☑  Sass版 ...

  9. VS2019(Windows+Mac)编辑文件模板

    macOS 找到设置中的如图条目 设置如下内容: ============================================================ Copyright (C) ...

  10. SSH Secure Shell 的使用

    一,安装Secure Shell ,之后会出现SSH Secure Shell client 和SSH Secure File Transfer client 两个快捷方式. 需要服务器的IP地址,用 ...