...
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.
Warning |
---|
In remote mode HiveServer2 only accepts valid Thrift calls – even in HTTP mode, the message body contains Thrift payloads. |
...
You can also specify the connection parameters on commandlinecommand line. This means you can find the command with the connection string from your unix UNIX shell history.
No Format |
---|
% 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 |
Info | ||
---|---|---|
| ||
If you'd like to connect via NOSASL mode, you must specify the authentication mode explicitly: % bin/beeline |
...
Beeline Commands
Command | Description |
---|---|
!<SQLLine command> | List of SQLLine commands available at http://sqlline.sourceforge.net/. Example: |
...
Use ";
" (semicolon) to terminate commands. Comments in scripts can be specified using the "--
" prefix.
Command | Description |
---|---|
reset | Resets the configuration to the default values. |
set <key>=<value> | Sets the value of a particular configuration variable (key). |
set | Prints a list of configuration variables that are overridden by the user or Hive. |
set -v | Prints all Hadoop and Hive configuration variables. |
add FILE[S] <filepath> <filepath>* | Adds one or more files, jars, or archives to the list of resources in the distributed cache. See Hive Resources for more information. |
add FILE[S] <ivyurl> <ivyurl>* add JAR[S] <ivyurl> <ivyurl>* add ARCHIVE[S] <ivyurl> <ivyurl>* | As of Hive 1.2.0, adds one or more files, jars or archives to the list of resources in the distributed cache using an Ivy URL of the form ivy://group:module:version?query_string. See Hive Resources for more information. |
list FILE[S] | Lists the resources already added to the distributed cache. See Hive Resources for more information. (As of Hive 0.14.0: HIVE-7592). |
list FILE[S] <filepath>* | Checks whether the given resources are already added to the distributed cache or not. See Hive Resources for more information. |
delete FILE[S] <filepath>* | Removes the resource(s) from the distributed cache. |
delete FILE[S] <ivyurl> <ivyurl>* delete JAR[S] <ivyurl> <ivyurl>* delete ARCHIVE[S] <ivyurl> <ivyurl>* | As of Hive 1.2.0, removes the resource(s) which were added using the <ivyurl> from the distributed cache. See Hive Resources for more information. |
reload | As of Hive 0.14.0, makes HiveServer2 aware of any jar changes in the path specified by the configuration parameter hive.reloadable.aux.jars.path (without needing to restart HiveServer2). The changes can be adding, removing, or updating jar files. |
dfs <dfs command> | Executes a dfs command. |
<query string> | Executes a Hive query and prints results to standard output. |
...
Beeline Command Options
The Beeline CLI supports these command line options:
...
For versions earlier than 0.14, see the version note above.
Connection URL When Zookeeper Service discovery is enabled
...
The <zookeeper quorum> is same as the value of hive.zookeeper.quorum configuration parameter in hive-site.xml/hivserver2-site.xml used by hiveserver2.
Named connection URLs
As of Hive 2.1 via
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
Reconnecting
Traditionally, "!reconnect" has worked to refresh a connection that has already been established. It is not able to do a fresh connect after "!close" has been run. As of Hive 2.1 via
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
Using JDBC
You can use JDBC to access data stored in a relational database or other tabular format.
...
For versions earlier than 0.14, see the version note above.