Beeline commands – Hadoop – Kerberos and LDAP

By | September 3, 2014
Few Beeline examples
For Kerberos Users:
Ex: Lets say below is our server details:
Hive server2: host1.example.com
REALMNAME: PUNEETHA.COM
Kerberos user: puneetha
Database name: default

We can connect to hive server2 in beeline as below:


$beeline
beeline> !connect jdbc:hive2://host1.example.com:10000/default;principal=hive/host1@PUNEETHA.COM 
Connecting to jdbc:hive2://host1:10000/default;principal=hive/host1@PUNEETHA.COM
Enter username for jdbc:hive2://host1:10000/default;principal=hive/host1@PUNEETHA.COM: puneetha
Enter password for jdbc:hive2://host1:10000/default;principal=hive/host1@PUNEETHA.COM: ***********

For LDAP Users
Ex: Lets say below is our server details:
Hive server2: host1.example.com
user: dummyuser
Database name: default


$beeline
beeline> !connect jdbc:hive2://<server-ip>:10000/default
Connecting to jdbc:hive2://host1.example.com:10000/default
Enter username for jdbc:hive2://host1.example.com:10000/default: dummyuser
Enter password for jdbc:hive2://host1.example.com:10000/default: ***********

One shot command looks like this:


$beeline -u jdbc:hive2://<server-ip>:10000/databaseName  -n <your-id> -p <your-password> --outputformat=csv -f input_query.sql > query_results.out

Few parameters:
--outputformat=csv
--headerInterval=400
--showHeader=false
--maxColumnWidth=20



Comment below if you find this blog useful.

Leave a Reply

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