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. 1-JavaScript变量

    对于JS的变量这个环节,其实主要要了解一下JS数据类型的存储方法 JS有两种不同的数据类型:基本类型(原始类型),引用类型(对象类型). 1.栈 (stack) 和 堆 (heap) 栈 (stack ...

  2. Vue.use()源码分析且执行后干什么了

    直接开始分析源码 // Vue源码文件路径:src/core/global-api/use.js import { toArray } from '../util/index' //initUse函数 ...

  3. js中的BOM和DOM常用事件方法

    笔记: window对象 ● window.innerHeight - 浏览器窗口的内部高度 ● window.innerWidth - 浏览器窗口的内部宽度 ● window.open() - 打开 ...

  4. K2 BPM_采购端到端解决方案,激活合规采购新动能_十年专注业务流程管理系统

    「方案背景」企业管理标准化演进之路 企业的成长离不开标准化,企业的可持续发展更离不开标准化.随着市场竞争的日趋激烈,标准化已经成为企业参与市场竞争的战略性手段,也成为企业可持续发展的重要手段.聚焦到采 ...

  5. K2 BPM_康熙别烦恼(下篇)——审批矩阵_工作流引擎

    康熙别烦恼(上篇)——分级授权 End 公司介绍:上海斯歌信息技术有限公司,聚焦企业所关注的管理挑战和压力,提供BPM平台及相关解决方案为主.2005年正式进入大中华地区,总部设在上海,并在北京.深圳 ...

  6. OpenStack kilo版(2) keystone部署

    部署在controller节点 配置数据库 MariaDB [(none)]> CREATE DATABASE keystone; Query OK, 1 row affected (0.00 ...

  7. nginx 之高级模块

    secure_link_module 模块 作用: 制定并允许检查请求的链接的真实性以及保护资源免遭未经授权的访问 限制链接生效周期 配置语法 Syntax:secure_link expressio ...

  8. Android笔记(十) Android中的布局——表格布局

    TableLayout运行我们使用表格的方式来排列控件,它的本质依然是线性布局.表格布局采用行.列的形式来管理控件,TableLayout并不需要明确的声明包含多少行多少列,而是通过添加TableRo ...

  9. 【OF框架】在Visual Studio中启用Docker支持,编译生成,并在容器运行项目

    准备 本地已经安装Docker 一.添加Docker支持 第一步:查看本地Docker服务状态 第二步:项目添加Docker支持 第三步:选择Linux容器 第四步:点击启动 第五步:确认Docker ...

  10. springboot整合freemarker模板引擎后在页面获取basePath绝对路径

    在项目中引用静态资源文件或者进行ajax请求时我们有时候会使用 ${basePath} ,其实这就是一种获取绝对路径的方式: 那么在springboot项目中要怎么配置才能使用 basePaht呢? ...