hive客户端启动 Error Failed to open new session

运行环境 | centos 6.6 | VMware Workstation Pro|hive-1.2.2|HADOOP 2.8.5

hive客户端连接hive服务端报错
Connecting to jdbc:hive2://master:10000
Error: Failed to open new session: java.lang.RuntimeException: java.lang.RuntimeException

服务端启动:

1
nohup ./hiveserver2 1>/root/hiveout.log 2>&1  &

客户端连接:

1
./beeline -u jdbc:hive2://master:10000

启动后报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Connecting to jdbc:hive2://master:10000
Error: Failed to open new session: java.lang.RuntimeException: java.lang.RuntimeException: org.apache.hadoop.security.AccessControlException: Permission denied: user=anonymous, access=EXECUTE, inode="/tmp":root:supergroup:drwx------
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:318)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkTraverse(FSPermissionChecker.java:279)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:206)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:189)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkTraverse(FSPermissionChecker.java:507)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkTraverse(FSDirectory.java:1612)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkTraverse(FSDirectory.java:1630)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.resolvePath(FSDirectory.java:551)
at org.apache.hadoop.hdfs.server.namenode.FSDirStatAndListingOp.getFileInfo(FSDirStatAndListingOp.java:110)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(FSNamesystem.java:3000)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(NameNodeRpcServer.java:1107)
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(ClientNamenodeProtocolServerSideTranslatorPB.java:873)
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:447)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:989)
at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:850)
at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:793)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1844)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2489) (state=,code=0)
Beeline version 1.2.2 by Apache Hive

在Hadoop core-site.xml 文件中加入(添加完需要重启服务):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<property>
<name>hadoop.http.staticuser.user</name>
<value>root</value>
</property>

<property>
<name>dfs.permissions.enabled</name>
<value>false</value>
</property>

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

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

<property>
<name>dfs.replication</name>
<value>2</value>
</property>

在 hive-site.xml 中加入:

1
2
3
4
<property>
<name>hive.scratch.dir.permission</name>
<value>777</value>
</property>

再次启动 报错:

1
2
3
4
Connecting to jdbc:hive2://master:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://master:10000: java.net.ConnectException: Connection refused (Connection refused) (state=08S01,code=0)
Beeline version 1.2.2 by Apache Hive
0: jdbc:hive2://master:10000 (closed)> show databases;

对 hdfs /tmp添加 777 权限

1
hdfs dfs -chmod -R 777 /tmp/

再次启动成功

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@slave0 bin]# ./beeline -u jdbc:hive2://master:10000
Connecting to jdbc:hive2://master:10000
Connected to: Apache Hive (version 1.2.2)
Driver: Hive JDBC (version 1.2.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.2 by Apache Hive
0: jdbc:hive2://master:10000> show databases;
+----------------+--+
| database_name |
+----------------+--+
| default |
| test_db |
+----------------+--+
2 rows selected (9.603 seconds)


本文结束感谢您的阅读,本文原创–支持原创
有问题请联系我--strivedeer@163.com