1 Hive错误
[HiveServer2-Background-Pool: Thread-69-SendThread(quickstart.cloudera:2181)]: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refusedat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) 2021-11-29 20:30:04,000 INFO org.apache.zookeeper.ClientCnxn: [HiveServer2-Background-Pool: Thread-69-SendThread(quickstart.cloudera:2181)]: Opening socket connection to server quickstart.cloudera/192.168.99.136:2181. Will not attempt to authenticate using SASL (unknown error) 2021-11-29 20:30:04,000 WARN org.apache.zookeeper.ClientCnxn: [HiveServer2-Background- Pool: Thread-69-SendThread(quickstart.cloudera:2181)]: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refusedat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) 2021-11-29 20:30:05,102 INFO org.apache.zookeeper.ClientCnxn: [HiveServer2-Background-Pool: Thread-69-SendThread(quickstart.cloudera:2181)]: Opening socket connection to server quickstart.cloudera/192.168.99.136:2181. Will not attempt to authenticate using SASL (unknown error) 2021-11-29 20:30:05,102 WARN org.apache.zookeeper.ClientCnxn: [HiveServer2-Background- Pool: Thread-69-SendThread(quickstart.cloudera:2181)]: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refusedat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) 2021-11-29 20:30:05,344 ERROR org.apache.curator.ConnectionState: [HiveServer2-Background-Pool: Thread-58]: Connection timed out for connection string (quickstart.cloudera:2181) and timeout (15000) / elapsed (188021) org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLossat org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:197)at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:87)at org.apache.curator.CuratorZookeeperClient.getZooKeeper
反正大致看了一眼是zookeeper的问题.
2 解决
Hive从0.14开始,使用Zookeeper实现了HiveServer2的HA功能(ZooKeeper Service Discovery),Client端可以通过指定一个nameSpace来连接HiveServer2,而不是指定某一个host和port。本文学习和研究HiveServer2的高可用配置。使用的Hive版本为apache-hive-2.0.0-bin。看了下配置文件是HA的模式,所以是我的环境没有开启zookeeper,所以一直超时然后请求zookeeper.
最后轻松解决.
最后遇到问题时先看日志!