hive

1/ 连接hive 失败 ?

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/opt/hive/apache-hive-2.3.5-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/data/bigData/hadoop-2.9.2/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://hadoop01.fandong.com:10000

20/01/02 10:08:06 [main]: WARN jdbc.HiveConnection: Failed to connect to hadoop01.fandong.com:10000

Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status.

Error: Could not open client transport with JDBC Uri: jdbc:hive2://hadoop01.fandong.com:10000: java.net.ConnectException: 拒绝连接 (Connection refused) (state=08S01,code=0)

Beeline version 2.3.5 by Apache Hive

----

到hive的log中查看问题原因:

[root@hadoop01 root]# pwd
/tmp/root
[root@hadoop01 root]# ls -l hive.log 
-rw-r--r-- 1 root root 28471203 1月   2 10:14 hive.log
[root@hadoop01 root]# tail -100f hive.log 

--异常信息:

 

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:827)

at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447)

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237)

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)

at java.sql.DriverManager.getConnection(DriverManager.java:664)

at java.sql.DriverManager.getConnection(DriverManager.java:208)

at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)

at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)

... 81 more

Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

 

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)

at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)

at com.mysql.cj.NativeSession.connect(NativeSession.java:150)

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:947)

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:817)

... 88 more

Caused by: java.net.UnknownHostException: hadoop03.fandong.com

at java.net.InetAddress.getAllByName0(InetAddress.java:1280)

at java.net.InetAddress.getAllByName(InetAddress.java:1192)

at java.net.InetAddress.getAllByName(InetAddress.java:1126)

at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:132)

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)

... 91 more

 

2020-01-02T10:16:23,100  INFO [main] metastore.HiveMetaStore: 0: Opening raw store with implementation class:org.apache.hadoop.hive.metastore.ObjectStore

2020-01-02T10:16:23,100  INFO [main] metastore.ObjectStore: ObjectStore, initialize called

 

---解决办法:

1、查看hive 的版本是否OK

use hive;
select * from hive.VERSION;
UPDATE hive.VERSION SET SCHEMA_VERSION ='2.3.0' WHERE VER_ID=1

发现版本OK。

2、在监测日志发现: 是有与未配置mysql host 解析问题,真实欲哭无泪啊。

vi  /etc/hosts

192.168.1.123 hadoop03.fandong.com

3/ 启动成功

[root@hadoop01 bin]# ./beeline -u jdbc:hive2://hadoop01.fandong.com:10000
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hive/apache-hive-2.3.5-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data/bigData/hadoop-2.9.2/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://hadoop01.fandong.com:10000
Connected to: Apache Hive (version 2.3.5)
Driver: Hive JDBC (version 2.3.5)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 2.3.5 by Apache Hive

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值