Hive CLI and Beeline both can be used to interact with Hive execution engine. But there are few differences between Hive CLI and Beeline. he primary difference between the two involves how the clients connect to Hive. The Hive CLI connects directly to the Hive Driver and requires that Hive be installed on the same machine as the client. However, Beeline connects to HiveServer2 and does not require the installation of Hive libraries on the same machine as the client. Beeline is a thin client that also uses the Hive JDBC driver but instead executes queries through HiveServer2, which allows multiple concurrent client connections and supports authentication.
To connect to any hive server we just need to type the command hive in the shell. It directly takes us to the hive prompt and we can execute the commands.
To connect to beeline we need to use beeline command along with connection string. Below is a sample format of beeline connection command:
beeline -u <url> -n <username> -p <password>
beeline -u "jdbc:hive2://url"
Note: Connection URL must be enclosed in quotes.
Beeline Modes of Operation
|The Beeline client and the Hive installation both reside on the same host machine. No TCP connectivity is required. Hive CLI also supports this mode.
|Use remote mode to support multiple, concurrent clients executing queries against the same remote Hive installation. Remote transport mode supports authentication with LDAP and Kerberos. It also supports encryption with SSL. TCP connectivity is required.
Let us know what else we can cover on our blog related to Data Engineering.
Please comment your thoughts about this post.