Search code examples
hivehortonworks-data-platformcloudera-manager

Beeline not able to run the hivescript in the kerberized cluster


I've kerbrized the HDP 2.3 cluster and have a valid TGT in the cache.

I can run queries successfully through beeline console. For example following things go well.

$beeline
$!connect jdbc:hive2://<HiveServer2Host>:10000/default;principal=hive/<HiveServer2Host>@<KDC_Realm>; 
Connected to: Apache Hive (version 1.2.1.2.3.2.0-2950)
Driver: Hive JDBC (version 1.2.1.2.3.2.0-2950)
Transaction isolation: TRANSACTION_REPEATABLE_READ
1: jdbc:hive2://HiveServer2Host> select * from <table>;

I am trying to execute the same query (placed in the file: query.sql) using following which does not work

$> beeline -u jdbc:hive2://<HiveServer2Host>:10000/default;principal=hive/<HiveServer2Host>@<KDC_Realm>; -f query.sql
Error: Could not open client transport with JDBC Uri: jdbc:hive2://<HiveServer2Host>:10000/default: Peer indicated failure: Unsupported mechanism type PLAIN (state=08S01,code=0)

I am not sure why this issue. In both the cases I am using the same jdbc URL. Not sure if I am missing something.


Solution

  • It's enough to surround the connection string with ' like this:

    beeline -u 'jdbc:hive2://<HiveServer2Host>:10000/default;principal=hive/<HiveServer2Host>@<‌​KDC_Realm>' -f query.sql