PROVE IT !!If you know it then PROVE IT !! Skill Proficiency Test

Beeline – Command Line Shell


The Beeline shell works in both embedded mode as well as remote mode. In the embedded mode, it runs an embedded Hive (similar to Hive CLI) whereas remote mode is for connecting to a separate HiveServer2 process over Thrift. Starting in Hive 0.14, when Beeline is used with HiveServer2, it also prints the log messages from HiveServer2 for queries it executes to STDERR. Remote HiveServer2 mode is recommended for production use, as it is more secure and doesn’t require direct HDFS/metastore access to be granted for users.

HiveServer2 supports a command shell Beeline that works with HiveServer2. It’s a JDBC client that is based on the SQLLine CLI ( There’s detailed documentation of SQLLine which is applicable to Beeline as well.

In remote mode HiveServer2 only accepts valid Thrift calls – even in HTTP mode, the message body contains Thrift payloads.

Beeline Example

% bin/beeline 
Hive version 0.11.0-SNAPSHOT by Apache
beeline> !connect jdbc:hive2://localhost:10000 scott tiger
!connect jdbc:hive2://localhost:10000 scott tiger 
Connecting to jdbc:hive2://localhost:10000
Connected to: Hive (version 0.10.0)
Driver: Hive (version 0.10.0-SNAPSHOT)
0: jdbc:hive2://localhost:10000> show tables;
show tables;
|     tab_name      |
| primitives        |
| src               |
| src1              |
| src_json          |
| src_sequencefile  |
| src_thrift        |
| srcbucket         |
| srcbucket2        |
| srcpart           |
9 rows selected (1.079 seconds)

You can also specify the connection parameters on command line. This means you can find the command with the connection string from your UNIX shell history.

% beeline -u jdbc:hive2://localhost:10000/default -n scott -w password_file
Hive version 0.11.0-SNAPSHOT by Apache

Connecting to jdbc:hive2://localhost:10000/default

Beeline with NoSASL connection

If you’d like to connect via NOSASL mode, you must specify the authentication mode explicitly:

% bin/beeline beeline> !connect jdbc:hive2://<host>:<port>/<db>;auth=noSasl hiveuser pass

Add a Comment

Your email address will not be published. Required fields are marked *