Use Beeline to query Hive table

Example how to query with beeline:

Login with your userid on the linux server:

[userxyz]$ beeline
beeline> !connect jdbc:hive2://hive-server-hostname:10000/default;principal=hive/_HOST@XYZREALM.COM
Error: Could not open client transport with JDBC Uri: : GSS initiate failed (state=08S01,code=0)

This error is due to kinit not done. So do

$ kinit userxyz

beeline> !connect jdbc:hive2://hive-server-hostname:10000/default;principal=hive/_HOST@XYZREALM.COM

Connected to: Apache Hive (version 1.1.0-cdh5.16.1)
0: jdbc:hive2://hostname:1> select count(*) from default.xyztable;
| _c0 |
| 50 |
1 row selected (18.64 seconds)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.