How to connect to Hadoop Hive using Beeline?
Apache Beeline is a hive command line client that can be used to connect to Hive server and execute HiveSQL,etc. Beeline uses JDBC to connect.Sample beeline command to connect to hive server is shown below:
localhost> beeline
beeline> !connect jdbc:hive2://localhost:10000
scan complete in 8ms
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: admin
Enter password for jdbc:hive2://localhost:10000:
Connected to: Apache Hive (version 0.12.0-cdh5.1.2)
Driver: Hive JDBC (version 0.12.0-cdh5.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://localhost:1000> show databases;
+----------------+
| database_name |
+----------------+
| sample |
| default |
| employee |
| operational |
| test_hive_db |
+----------------+
5 rows selected (0.52 seconds)
jdbc:hive2://localhost:1000> use test_hive_db;
jdbc:hive2://localhost:1000>select * from employee;
Check the link below to load files to hive:
http://dwbitechguru.blogspot.ca/2014/11/how-to-load-local-data-file-into-apache_25.html
To truncate apache hive tables and delete files from hdfs:
http://dwbitechguru.blogspot.ca/2014/11/how-to-truncatedelete-apache-hive-table.html
More details about beeline is in the below link:
https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients
No comments:
Post a Comment