Apache Zeppelin: Impala interpreter with user impersonation
Apache Zeppelin is a web-based notebook platform that enables interactive data analytics with interactive data visualizations and notebook sharing.
We can integrate Impala using JDBC Interpreter.
Interpreter Configuration
Go to the Interpreter screen and click +Create to create a new interpreter
Interpreter Name: impala
Interpreter group: jdbc
Change the following properties
default.driver com.cloudera.impala.jdbc4.Driver
default.url jdbc:impala://IMPALA_HOST:21050;
Download Impala JDBC Driver from Cloudera Website and copy it to /zeppelin/path/interpreter/jdbc/ folder
wget https://downloads.cloudera.com/connectors/impala_jdbc_2.6.3.1004.zip
unzip impala_jdbc_2.6.3.1004.zip
cd ClouderaImpalaJDBC-2.6.3.1004/
unzip ClouderaImpalaJDBC4-2.6.3.1004.zip
cp ImpalaJDBC4.jar /zeppelin/path/interpreter/jdbc/
Copy the dependency jars from instance itself
cp /opt/cloudera/parcels/CDH/lib/hadoop/client/*.jar /zeppelin/path/interpreter/jdbc/
Kerberos Configuration
If the cluster is kerberized add the following properties for impala interpreter
default.url jdbc:impala://IMPALA_HOST:21050;AuthMech=1;KrbRealm=REALM_DOMAIN;KrbHostFQDN=IMPALA_HOST;KrbServiceName=impala
zeppelin.jdbc.auth.type KERBEROS
zeppelin.jdbc.keytab.location /path/to/keytab zeppelin.jdbc.principal principal_name
User Impersonation
User impersonation is must for authorizing users to run queries based on Sentry rules. To enable user impersonation add the user who can impersonate other users in authorized_proxy_user_config. For Cloudera setup Hue user can be used.
Add the following properties for impala interpreter
zeppelin.jdbc.auth.kerberos.proxy.enable true
default.proxy.user.property DelegationUID
Interpolation
In the latest zeppelin version we can use the Z context variables in SQL query like
select * from patents_list where priority_country = ‘{country_code}’
To enable it add the following property
zeppelin.jdbc.interpolation true
Thank you for reading!
For any questions contact me @limesaltsoda