CentOS7 Java 连接Hive 提示:Could not open client transport with JDBC Uri:

错误信息:

Exception in thread "main" java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://192.168.60.204:10000/default: java.net.ConnectException: Connection refused: connect
     at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:215)
     at org.apache.hive.jdbc.HiveConnection.(HiveConnection.java:163)
     at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
     at java.sql.DriverManager.getConnection(DriverManager.java:571)
     at java.sql.DriverManager.getConnection(DriverManager.java:215)
     at HelloHive.main(HelloHive.java:17)
Caused by: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
     at org.apache.thrift.transport.TSocket.open(TSocket.java:187)
     at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:266)
     at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37)
     at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:190)
     ... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
     at java.net.DualStackPlainSocketImpl.connect0(Native Method)
     at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
     at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
     at java.net.Socket.connect(Socket.java:579)
     at org.apache.thrift.transport.TSocket.open(TSocket.java:182)
     ... 8 more

解决方案:

1. 我先检查hive server2是否启动: 

netstat -anp |grep 10000 

2、检查Hive 的配置文件(hive-site.xml)

 
       
       hive.server2.thrift.port 
      10000 
    
    
       hive.server2.thrift.bind.host
       master 
       
     
    

3、ping 通Hive 服务器

ping 192.168.60.204


 

你可能感兴趣的:(hadoop)