Imran
Imran

Reputation: 355

Cannot connect to beeline hive2

Hadoop 2.7.3 & Hive 2.1.0

I am able to connect to beeline like this

!connect jdbc:hive2://

But when i type

!connect jdbc:hive2://hostname:10000/default org.apache.hive.jdbc.HiveDriver or !connect jdbc:hive2://hostname:10000/default

After giving the username and password it gives me an error

Error: Could not open connection to jdbc:hive2://:10000: java.net.ConnectException: Connection refused (state=08S01,code=0)

In CLI:

which: no hbase in (/user/local/maven/bin:/user/local/maven/bin:/user/local/maven/bin:/user/local/maven/bin:/user/local/maven/bin:/usr/local/rvm/gems/ruby-2.1.2/bin:/usr/local/rvm/gems/ruby-2.1.2@global/bin:/usr/local/rvm/rubies/ruby-2.1.2/bin:/usr/lib64/qt-3.3/bin:/user/local/maven/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/usr/local/hive/bin:/usr/bin:/usr/local/bin:/bin:/root/bin:/usr/java/jdk1.7.0_60/bin:/usr/local/hadoop/bin/:/usr/local/hadoop/bin:/usr/local/hadoop/sbin:/usr/bin:/usr/local/bin:/usr/java/jdk1.7.0_60/bin:/usr/java/jdk1.7.0_60/bin:/usr/local/hadoop/bin/:/usr/local/hadoop/bin:/usr/local/hadoop/sbin:/usr/bin:/usr/local/bin:/usr/java/jdk1.7.0_60/bin:/usr/java/jdk1.7.0_60/bin:/usr/local/hadoop/bin/:/usr/local/hadoop/bin:/usr/local/hadoop/sbin)
ls: cannot access /usr/local/hive/lib/hive-jdbc-*-standalone.jar: No such file or directory
Beeline version 2.1.0 by Apache Hive
beeline> !connect jdbc:hive2://10.1.1.60:10000/;transportMode=binary
Connecting to jdbc:hive2://10.1.1.60:1000/;transportMode=binary
Enter username for jdbc:hive2://10.1.1.60:10000/;transportMode=binary: APP
Enter password for jdbc:hive2://10.1.1.60:10000/;transportMode=binary: ****
16/10/25 18:07:11 [main]: WARN jdbc.HiveConnection: Failed to connect to 10.1.1.60:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://10.1.1.60:1000/;transportMode=binary: java.net.ConnectException: Connection refused (state=08S01,code=0)
beeline> 

Any suggestions??

The Properties in hive-site.xml i have set for hive 2 are:-

    <?xml version="1.0"?>
    <configuration>
    <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:derby:;databaseName=/usr/local/hive/metastore_db;create=true</value>
    <description>JDBC connect string for a JDBC metastore</description>
    </property>

    <property>
    <name>org.apache.derby.jdbc.EmbeddedDriver</name>
    <value>org.apache.derby.jdbc.ClientDriver</value>
    <description>Driver class name for a JDBC metastore</description>
    </property>

    <property>
    <name>hive.server2.thrift.min.worker.threads</name>
    <value>5</value>
    <description>Minimum number of worker threads</description>
    </property>

    <property>
    <name>hive.server2.thrift.max.worker.threads</name>
    <value>500</value>
    <description>Maximum number of worker threads</description>
    </property>

    <property>
    <name>hive.server2.thrift.port</name>
    <value>10000</value>
    <description>TCP port number to listen on</description>
    </property>

    <property>
    <name>hive.server2.thrift.bind.host</name>
    <value>hadoop-master</value>
    <description>TCP interface to bind to</description>
    </property>


    <property>
    <name>hive.server2.transport.mode</name>
    <value>binary</value>
    <description>Set to http to enable HTTP transport mode</description>
    </property>


    <property>
    <name>hive.server2.thrift.http.port</name>
    <value>10001</value>
    <description>HTTP port number to listen on</description>
    </property>

    <property>
    <name>hive.server2.thrift.http.max.worker.threads</name>
    <value>500</value>
    <description>TCP interface to bind to</description>
    </property>

    <property>
    <name>hive.server2.thrift.http.min.worker.threads</name>
    <value>5</value>
    <description>Minimum worker threads in the server pool</description>
    </property>

    <property>
     <name>hive.server2.authentication</name>
     <value>NOSASL</value>
    </property>

    <property>
    <name>hive.server2.thrift.http.path</name>
    <value>cliservice</value>
    <description>The service endpoint</description>
    </property>


    </configuration>

Any suggestions?

Upvotes: 1

Views: 14020

Answers (2)

m.semnani
m.semnani

Reputation: 797

  1. At First check if your hive server is listening on port 10000?

    netstat -an | grep 10000

    if not! go to /tmp/{username}/hive.log and see what is wrong!

  2. If hive server is up and running, then check the schema that you were created!

    schematool -validate -dbType -verbose

    if the schema has problems, then you should init the schema again.

  3. If everything is OK, then you should connect using:

    beeline -u jdbc:hive2://{IP or servername}:10000

Upvotes: 2

Stephen ODonnell
Stephen ODonnell

Reputation: 4466

From the error:

16/10/25 18:07:11 [main]: WARN jdbc.HiveConnection: Failed to connect to 10.1.1.60:1000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://10.1.1.60:1000/;transportMode=binary: java.net.ConnectException: Connection refused (state=08S01,code=0)

It looks like you are hitting port 1000 and not 10,000 - does it work if you connect to port 10000?

If it still doesn't work against port 10000, are you certain that Hiveserver2 is listening on that port? Can you run the following on the Hiveserver2 host and ensure that something is listening on the port:

netstat -an | grep 10000

Upvotes: 0

Related Questions