Saturday, May 26, 2018

Workaround using Hive+Sentry without Kerberos/LDAP

[donghua@cdh01 ~]$ beeline -u jdbc:hive2://cdh01:10000/testdb
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
scan complete in 3ms
Connecting to jdbc:hive2://cdh01:10000/testdb
Connected to: Apache Hive (version 1.1.0-cdh5.14.2)
Driver: Hive JDBC (version 1.1.0-cdh5.14.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.1.0-cdh5.14.2 by Apache Hive
0: jdbc:hive2://cdh01:10000/testdb> select current_user();
Error: Error while compiling statement: FAILED: InvalidConfigurationException hive.server2.authentication can't be none in non-testing mode (state=42000,code=40000)
0: jdbc:hive2://cdh01:10000/testdb>

[HiveServer2-Handler-Pool: Thread-58]: FAILED: InvalidConfigurationException hive.server2.authentication can't be none in non-testing mode
org.apache.sentry.binding.hive.conf.InvalidConfigurationException: hive.server2.authentication can't be none in non-testing mode
    at org.apache.sentry.binding.hive.authz.HiveAuthzBinding.validateHiveServer2Config(HiveAuthzBinding.java:180)
    at org.apache.sentry.binding.hive.authz.HiveAuthzBinding.validateHiveConfig(HiveAuthzBinding.java:148)
    at org.apache.sentry.binding.hive.authz.HiveAuthzBinding.<init>(HiveAuthzBinding.java:84)
    at org.apache.sentry.binding.hive.authz.HiveAuthzBinding.<init>(HiveAuthzBinding.java:80)
    at org.apache.sentry.binding.hive.HiveAuthzBindingHook.<init>(HiveAuthzBindingHook.java:121)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.apache.hadoop.hive.ql.hooks.HooksLoader.getHooks(HooksLoader.java:100)
    at org.apache.hadoop.hive.ql.hooks.HooksLoader.getHooks(HooksLoader.java:64)

imageimage


[donghua@cdh01 ~]$ beeline -n donghua -u jdbc:hive2://cdh01:10000/testdb
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
scan complete in 2ms
Connecting to jdbc:hive2://cdh01:10000/testdb
Connected to: Apache Hive (version 1.1.0-cdh5.14.2)
Driver: Hive JDBC (version 1.1.0-cdh5.14.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.1.0-cdh5.14.2 by Apache Hive
0: jdbc:hive2://cdh01:10000/testdb> select current_user();
INFO  : Compiling command(queryId=hive_20180526200404_ef3e8dd5-4281-4338-b85d-386db2122937): select current_user()
INFO  : Semantic Analysis Completed
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:_c0, type:string, comment:null)], properties:null)
INFO  : Completed compiling command(queryId=hive_20180526200404_ef3e8dd5-4281-4338-b85d-386db2122937); Time taken: 0.132 seconds
INFO  : Executing command(queryId=hive_20180526200404_ef3e8dd5-4281-4338-b85d-386db2122937): select current_user()
INFO  : Completed executing command(queryId=hive_20180526200404_ef3e8dd5-4281-4338-b85d-386db2122937); Time taken: 0.0 seconds
INFO  : OK
+-------+--+
|  _c0  |
+-------+--+
| hive  |
+-------+--+
1 row selected (0.261 seconds)