1、在当前服务器启动hiveserver2服务,远程客户端通过beeline连接

报错信息如下:

root@master:~# beeline  -u jdbc:hive2//master:10000
ls: cannot access /data1/hadoop/hive/lib/hive-jdbc-*-standalone.jar: No such file or directory
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/data1/hadoop/hive/lib/log4j-slf4j-impl-2.4..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..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]
scan complete in 1ms
// :: [main]: ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: org/ehcache/sizeof/impl/sizeof-agent.jar (No such file or directory)
scan complete in 762ms #这里提示找不到文件或者目录
No known driver to handle "jdbc:hive2//master:10000"
Beeline version 2.1. by Apache Hive
beeline>

其实这个问题是由于jdbc协议地址写错造成的,在hive2之后少了个“:” 
改成以下这个形式即可:

# beeline  -u jdbc:hive2://master:10000  (这是在命令行直接输入)
或者
先输入beeline
然后输入:
!connect jdbc:hive2://master:10000

2、用户不被允许

# beeline -u jdbc:hive2://master:10000 -n root
ls: cannot access /data1/hadoop/hive/lib/hive-jdbc-*-standalone.jar: No such file or directory
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/data1/hadoop/hive/lib/log4j-slf4j-impl-2.4..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..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]
Connecting to jdbc:hive2://master:10000
Error: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate root (state=,code=)
Beeline version 2.1. by Apache Hive
beeline>

(1)修改core-site.xml文件,加入如下选项:

<property>
<name>hadoop.proxyuser.root.hosts</name> #配置成*的意义,表示任意节点使用 hadoop 集群的代理用户 root 都能访问 hdfs 集群
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.root.groups</name> #表示代理用户的组所属
<value>*</value>
</property>

上述的proxyuser后面的root即是报错时User后面的用户,如:User: root is not allowed to

如果报错为:User: yjt is not allowed to,那么修改如下:

hadoop.proxyuser.yjt.hosts
hadoop.proxyuser.yjt.groups

这样改的原因:
主要原因是hadoop引入了一个安全伪装机制,使得hadoop 不允许上层系统直接将实际用户传递到hadoop层,而是将实际用户传递给一个超级代理,由此代理在hadoop上执行操作,避免任意客户端随意操作hadoop,如下图:

图上的超级代理是“Oozie”,你自己的超级代理是上面设置的proxyuser后面的“xxx”。
而hadoop内部还是延用linux对应的用户和权限。即你用哪个linux用户启动hadoop,对应的用户也就成为hadoop的内部用户
(2)在hdfs-sitx.xml文件添加:

<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>

上诉配置完以后,重新启动hadoop集群,其实只要hdfs就可以了。

接着执行如下命令:

/# beeline -u jdbc:hive2://master:10000 -n root
ls: cannot access /data1/hadoop/hive/lib/hive-jdbc-*-standalone.jar: No such file or directory
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/data1/hadoop/hive/lib/log4j-slf4j-impl-2.4..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..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]
Connecting to jdbc:hive2://master:10000
Error: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate root (state=,code=)
Beeline version 2.1. by Apache Hive
beeline>

what???,不对???

如果上诉配置正确,集群也已经重启,还是报这样的错误,那么查看一下启动hiveserver2的机器是否启动了namenode节点?

(1)如果没有启动namenode节点,那么查看你配置的用户(这里是root用户)是否有对应的操作hdfs目录的权限(权限控制可能会导致该错误)

(2)如果该节点启动了namenode,那么使用 hdfs haadmin -getAllServiceState 检查该节点的namenode的状态是否是standby。如果是,kill掉,让该节点的namenode变成active。

我碰到的问题就是上诉2,也就是namenode节点是standby。

kill掉以后,再试试

root@master:/# hdfs haadmin -getAllServiceState
master: standby
slave1: active
root@master:/# hdfs haadmin -getAllServiceState
master: active
// :: INFO ipc.Client: Retrying connect to server: slave1/172.17.0.3:. Already tried time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=, sleepTime= MILLISECONDS)
slave1: Failed to connect: Call From master/172.17.0.2 to slave1: failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
root@master:/# beeline -u jdbc:hive2://master:10000 -n root
ls: cannot access /data1/hadoop/hive/lib/hive-jdbc-*-standalone.jar: No such file or directory
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/data1/hadoop/hive/lib/log4j-slf4j-impl-2.4..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7..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]
Connecting to jdbc:hive2://master:10000
Connected to: Apache Hive (version 2.1.)
Driver: Hive JDBC (version 2.1.)
// :: [main]: WARN jdbc.HiveConnection: Request to set autoCommit to false; Hive does not support autoCommit=false.
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 2.1. by Apache Hive
: jdbc:hive2://master:10000>

0: jdbc:hive2://master:10000> show databases;
OK
+----------------+--+
| database_name |
+----------------+--+
| default |
| myhive |
+----------------+--+

 

发现正常连接了。

借鉴:https://blog.csdn.net/qq_16633405/article/details/82190440

hive 使用beelin连接报错的更多相关文章

  1. 解决oracle服务器重启之后连接报错的问题

    DB服务器重启之后再连接报错如下: 原因是重启之后listener.ora被还原成初始文件,sid被清空. 解决步骤: 1.查看监听服务和数据库服务: 由此找到listener.ora文件的路径:D: ...

  2. 监听报错 TNS-00525: Insufficient privilege for operation 11gR2 + 连接报错ORA-12537: TNS:connection closed

    1.TNS-00525: Insufficient privilege for operation Started with pid= Listening on: (DESCRIPTION=(ADDR ...

  3. Oracle SQL Developer连接报错(ORA-12505)

    Oracle SQL Developer连接报错(ORA-12505) 之前我的Oracle数据库出现问题,费大波周折终于弄好了,今天又创建了一个DBA管理员的连接方式出现问题,本人现在把解决方案分享 ...

  4. 启动tomcat直接报错:org.apache.tomcat.util.digester.Digester startElement

    今天很奇怪,自己手动搭建了一个ssm(spring+springmvc+mybatis)的项目,然后添加到tomcat下,启动直接报错: 2017-3-19 9:24:47 org.apache.to ...

  5. Jmeter录制脚本过程及Could not create script recorder报错、您的连接不是私密连接报错

    转载自    https://www.cnblogs.com/wwho/p/7173172.html Jmeter录制脚本过程及Could not create script recorder报错.您 ...

  6. Oracle 12c SQL Developer连接报错(ORA-12505)

    Oracle 12c SQL Developer连接报错(ORA-12505) 连接时报错码:Listener refused the connection with following error: ...

  7. 二、Jmeter录制脚本过程及Could not create script recorder报错、您的连接不是私密连接报错

    两个报错:Could not create script recorder报错和您的连接不是私密连接报错 1.录制过程 * 打开jmeter * 点击Templated,选择Recoding模版 * ...

  8. ssh连接报错Write failed: Broken pipe Resource temporarily unavailable

    问题描述 使用root连接服务器正常,切换普通用户连接报错 具体报错如下:Write failed: Broken pipe 或者:failed to execute /bin/bash: Resou ...

  9. Mysql远程连接报错:SQL Error (1130): Host '192.168.61.128' is not allowed to connect to this MySQL server

    Mysql远程连接报错:SQL Error (1130): Host '192.168.0.18' is not allowed to connect to this MySQL server     ...

随机推荐

  1. 什么是HTTPS协议

    一 HTTPS协议一直是web开发,无论前后端都不可或缺的重要知识点,然而由于历史原因,这个协议和知识点枯燥而繁多,如果看书和文字十分难懂苦涩.但又不得不掌握,怎么办呢? 正好,从朋友小灰那里得到一片 ...

  2. 基于【 责任链模式】二 || 网关zuul过滤器封装

    一.基于责任链模式封装网关拦截 上一篇文章中已经使用建造者模式对网关拦截进行封装,存在一个问题,在连接器build中,每一个拦截都要进行true判断,代码看起来冗余,下面使用责任链模式封装 1.基于责 ...

  3. css 居中 父子元素

    居中:是子元素相对于在父元素里面居中.父子宽度都固定. A:水平居中: ①给子元素设置一个宽度后.在给其水平方向的margin设置auto,子元素会在父元素水平方向的剩余空间,左右两边平均分配,也就左 ...

  4. 利用 CAKeyframeAnimation实现任意轨迹移动

      自定义 View,实现以下方法即可 - (void)drawRect:(CGRect)rect { // Drawing code // 初始化UIBezierPath UIBezierPath ...

  5. 部署vue项目到阿里云服务器(Ubuntu16.04 64位)

    上传文件 1.通过Xftp将vue项目文件上传至云服务器:由于node_modules这个依赖包体积较大,上传较慢,上传时跳过,在云服务器上重新进行npm install安装依赖包即可: 2.也可通过 ...

  6. SPI简述

    SPI是器件的比较常用的通信协议. SPI总共有四根线: SS:片选线,每个设备都和主机MCU有一条单独片选线相连,片选线拉低意味主机输出,也就是说一个主机可以和多个从机相连,只需要有足够多的片选线. ...

  7. prometheus监控(小试牛刀)

    prometheus监控(小试牛刀) 环境:全部服务都是基于docker运行 本文略微草率,好文章在这里,特别好如下: https://www.cnblogs.com/tchua/p/11120228 ...

  8. Python函数Day1

    一.函数的初识 函数的定义:函数最主要的目的是封装一个功能,一个函数就是一个功能 定义函数的格式: def 函数名(): 函数体 def my_len(): count = 0 s1 = 'hahah ...

  9. C++——异常处理

    前言 大型和十分复杂的程序往往会产生一些很难查找的甚至是无法避免的运行时错误.当发生运行时错误时,不能简单地结束程序运行,而是退回到任务的起点,指出错误,并由用户决定下一步工作.面向对象的异常处理(e ...

  10. Linux命令——ulimit

    参考:https://www.cnblogs.com/kongzhongqijing/p/5784293.html