Starting, Stopping, and Using HiveServer2
HiveServer2 is an improved version of HiveServer that supports Kerberos authentication and multi-client concurrency. Cloudera recommends HiveServer2.
If you are running the metastore in Remote mode, you must start the Hive metastore before you start HiveServer2. HiveServer2 tries to communicate with the metastore as part of its initialization bootstrap. If it is unable to do this, it fails with an error.
To start HiveServer2:
$ sudo service hive-server2 start
To stop HiveServer2:
$ sudo service hive-server2 stop
To confirm that HiveServer2 is working, start the beeline CLI and use it to execute a SHOW TABLES query on the HiveServer2 process:
$ /usr/lib/hive/bin/beeline beeline> !connect jdbc:hive2://localhost:10000 username password org.apache.hive.jdbc.HiveDriver 0: jdbc:hive2://localhost:10000> SHOW TABLES; show tables; +-----------+ | tab_name | +-----------+ +-----------+ No rows selected (0.238 seconds) 0: jdbc:hive2://localhost:10000>
Using the Beeline CLI
Beeline is a new CLI (command-line interface) for HiveServer2. It is based on the SQLLine CLI written by Marc Prud'hommeaux.
Use the following commands to start beeline and connect to a running HiveServer2 process. In this example the HiveServer2 process is running on localhost at port 10000:
$ beeline beeline> !connect jdbc:hive2://localhost:10000 username password org.apache.hive.jdbc.HiveDriver 0: jdbc:hive2://localhost:10000>
If you using HiveServer2 on a cluster that does not have Kerberos security enabled, then the password is arbitrary in the command for starting Beeline.
If you are using HiveServer2 on a cluster that does have Kerberos security enabled, please refer to the CDH 4 Security Guide.
At present the best source for documentation on Beeline is the original SQLLine documentation.
|<< Hive and HDFS Trash||Starting HiveServer1 and the Hive Console >>|