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.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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
19/06/17 06:29:13 [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.0 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.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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=0)
Beeline version 2.1.0 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.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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=0)
Beeline version 2.1.0 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:8020                                        standby
slave1:8020                                        active
root@master:/# hdfs haadmin -getAllServiceState
master:8020                                        active
19/06/17 08:49:08 INFO ipc.Client: Retrying connect to server: slave1/172.17.0.3:8020. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=1, sleepTime=1000 MILLISECONDS)
slave1:8020                                        Failed to connect: Call From master/172.17.0.2 to slave1:8020 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.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data1/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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.0)
Driver: Hive JDBC (version 2.1.0)
19/06/17 08:49:16 [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.0 by Apache Hive
0: 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

转载于:https://www.cnblogs.com/yjt1993/p/11039723.html

hive 使用beelin连接报错相关推荐

  1. hive中beeline连接报错 User: root is not allowed to impersonate root:已解决

    第一种:hive中beeline连接报错 Error: Could not open client transport with JDBC Uri: jdbc:hive2://node-4:10000 ...

  2. hive连接报错:Unauthorized connection for super-user: root from IP 192.168.216.128:14:13

    hive连接报错:Unauthorized connection for super-user: root from IP 192.168.216.128:14:13 解决方法: hadoop的cor ...

  3. Navicat客户端PostgreSQL连接报错:Could not connect to server:Connection refused(0x00002740/10061)

    Navicat客户端PostgreSQL连接报错:Could not connect to server:Connection refused(0x00002740/10061) 遇到这样的问题应该怎 ...

  4. pl/sql dev连接报错Access violation at address 67614F04 in module 'oranls11.dll'

    这个可能是因为你的客户端安装了多个Oracle 软件导致, 还有一种可能是本地Oracle版本过低,连接的Oracle数据库版本过高. 这里排除第二种可能. 解决办法:  打开你的PL/SQL Dev ...

  5. 解决win7 64位操作系统下安装PL/SQL后连接报错问题: make sure you have the 32 bits oracle client installed

    解决win7 64位操作系统下安装PL/SQL后连接报错问题: make sure you have the 32 bits oracle client installed 参考文章: (1)解决wi ...

  6. pymysql模块操作数据库及连接报错解决方法

    pymysql模块操作数据库及连接报错解决方法 参考文章: (1)pymysql模块操作数据库及连接报错解决方法 (2)https://www.cnblogs.com/zgngg/p/10607859 ...

  7. oracle10g库连接报错

    oracle10g库连接报错 posted on 2014-01-01 20:08 秦瑞It行程实录 阅读(...) 评论(...) 编辑 收藏 转载于:https://www.cnblogs.com ...

  8. xshell进行ssh链接报错“所选的用户密钥未在远程主机上注册”处理

    xshell进行ssh链接报错"所选的用户密钥未在远程主机上注册"处理 一.报错情况 二.控制台登录主机 三.解决步骤 1.重新生成公私钥 2./root/.ssh/authori ...

  9. ftp连接报错:Windows无法访问此文件夹

    在zedboard上运行Linux系统,通过网线与PC端连接. 默认ftp地址是:192.168.1.10 通过FTP服务器访问该地址,报错:"ftp连接报错:Windows无法访问此文件夹 ...

最新文章

  1. 这几个行业会从物联网革命中获得最大利益
  2. JDK8 集合排序 xxxList.stream.sorted(...)
  3. 腾讯视频中如何把视频进行收藏
  4. 信息学奥赛一本通 1154:亲和数
  5. linux下静默安装weblogic 12
  6. 试题11 蒜头君的随机数(排序和去重)
  7. django 1366, “Incorrect string value: for column ‘‘ at row
  8. codematic2连接mysql失败_动软代码生成器Codematic
  9. 用C语言实现C++ 继承与多态
  10. python爬虫详细-Python爬虫|Python爬虫入门(一):爬虫基本结构简单实例
  11. 基于FPGA的2FSK调制解调器
  12. [Unity3d] [图文]【寻路】 Waypoint 与 NavMesh 比较(转)
  13. 高通625系列-MSM8953 (Cortex-A53架构)
  14. OpenCV可以识别文字吗?
  15. 服务器无线组网,物联网无线组网介绍
  16. mysql数据库误删后能恢复吗_MySQL 数据库误删除后的数据恢复
  17. python分析股票主力_python-个股聪明钱因子追踪
  18. Derek Wilson:三重缓冲,为什么我们爱它
  19. 网络安全工程师就业前景
  20. 2014华为机试,计算给定和牌麻将的番数

热门文章

  1. html5诊断报告,放射科诊断报告模板.docx
  2. win11电脑中文用户名修改成英文用户名
  3. Windows10系统批量获取所有用户名称、修改所有用户名称
  4. Kivy教程之 08 倒计时App实现timer调用(教程含源码)
  5. java爬虫工具xpath提取_爬虫 xpath (数据提取)
  6. SQL中的DML、DDL、DCL分别是什么意思
  7. 第五届“飞思卡尔”智能车竞赛分赛区赛后总结
  8. 跑腿小程序系统,同城闪送、帮买帮送
  9. (域名、主机名、服务名、端口号)名字与地址的转换 (gethostbyname、getservbyname、getaddrinfo、getnameinfo等)
  10. “云”溪笔谈 | VR——看得见的未来