Skip to content

Commit

Permalink
[ZEPPELIN-5694] Support apache kyuubi (apache#4392)
Browse files Browse the repository at this point in the history
* [ZEPPELIN-5694] Support apache kyuubi

* SUPPORT KERBEROS MODE
  • Loading branch information
huage1994 authored and proceane committed Feb 16, 2023
1 parent 47008de commit 97b2af5
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 2 deletions.
100 changes: 99 additions & 1 deletion docs/interpreter/jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ The last step is **Dependency Setting**. Since Zeppelin only includes `PostgreSQ

<img src="{{BASE_PATH}}/assets/themes/zeppelin/img/docs-img/edit_dependencies.png" width="600px" />

That's it. You can find more JDBC connection setting examples([Mysql](#mysql), [MariaDB](#mariadb), [Redshift](#redshift), [Apache Hive](#apache-hive), [Presto/Trino](#prestotrino), [Impala](#impala), [Apache Phoenix](#apache-phoenix), and [Apache Tajo](#apache-tajo)) in [this section](#examples).
That's it. You can find more JDBC connection setting examples([Mysql](#mysql), [MariaDB](#mariadb), [Redshift](#redshift), [Apache Hive](#apache-hive), [Presto/Trino](#prestotrino), [Impala](#impala), [Apache Kyuubi (Incubating)](#apache-kyuubi-(incubating)), [Apache Phoenix](#apache-phoenix), and [Apache Tajo](#apache-tajo)) in [this section](#examples).

## JDBC Interpreter Datasource Pool Configuration
The Jdbc interpreter uses the connection pool technology, and supports users to do some personal configuration of the connection pool. For example, we can configure `default.validationQuery='select 1'` and `default.testOnBorrow=true` in the Interpreter configuration to avoid the "Invalid SessionHandle" runtime error caused by Session timeout when connecting to HiveServer2 through JDBC interpreter.
Expand Down Expand Up @@ -827,6 +827,104 @@ Dependencies
</tr>
</table>

### Apache Kyuubi (Incubating)

Zeppelin connect to `Kyuubi` to run sql via `KyuubiHiveDriver`. There are 2 cases of connecting with Kyuubi:

* Connect to Kyuubi without KERBEROS
* Connect to Kyuubi with KERBEROS

Each case requires different settings.

##### Connect to Kyuubi without KERBEROS

In this scenario, you need to make the following settings at least. Kyuubi engine run as user of `default.user`.

Properties

<table class="table-configuration">
<tr>
<th>Name</th>
<th>Value</th>
</tr>
<tr>
<td>default.driver</td>
<td>org.apache.kyuubi.jdbc.KyuubiHiveDriver</td>
</tr>
<tr>
<td>default.url</td>
<td>jdbc:hive2://kyuubi-server:10009</td>
</tr>
</table>

Dependencies

<table class="table-configuration">
<tr>
<th>Artifact</th>
<th>Excludes</th>
</tr>
<tr>
<td>org.apache.kyuubi:kyuubi-hive-jdbc-shaded:1.5.2-incubating</td>
<td></td>
</tr>
<tr>
<td>org.apache.hive:hive-jdbc:3.1.2</td>
<td></td>
</tr>
</table>


##### Connect to Kyuubi with KERBEROS

In this scenario, you need to make the following settings at least. Kyuubi engine run as user of client principal (`zeppelin.jdbc.principal`).

Properties

<table class="table-configuration">
<tr>
<th>Name</th>
<th>Value</th>
</tr>
<tr>
<td>default.driver</td>
<td>org.apache.kyuubi.jdbc.KyuubiHiveDriver</td>
</tr>
<tr>
<td>default.url</td>
<td>jdbc:hive2://kyuubi-server:10009/default;principal={kyuubi_principal}</td>
</tr>
<tr>
<td>zeppelin.jdbc.auth.type</td>
<td>KERBEROS</td>
</tr>
<tr>
<td>zeppelin.jdbc.keytab.location</td>
<td>keytab of client</td>
</tr>
<tr>
<td>zeppelin.jdbc.principal</td>
<td>principal of client</td>
</tr>
</table>

Dependencies

<table class="table-configuration">
<tr>
<th>Artifact</th>
<th>Excludes</th>
</tr>
<tr>
<td>org.apache.kyuubi:kyuubi-hive-jdbc-shaded:1.5.2-incubating</td>
<td></td>
</tr>
<tr>
<td>org.apache.hive:hive-jdbc:3.1.2</td>
<td></td>
</tr>
</table>

### Apache Phoenix

Phoenix supports `thick` and `thin` connection types:
Expand Down
1 change: 1 addition & 0 deletions docs/quickstart/sql_with_zeppelin.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The following guides explain how to use Apache Zeppelin that enables you to writ
* [Apache Hive](../interpreter/jdbc.html#apache-hive)
* [Presto/Trino](../interpreter/jdbc.html#prestotrino)
* [Impala](../interpreter/jdbc.html#impala)
* [Apache Kyuubi (Incubating)](../interpreter/jdbc.html#apache-kyuubi-incubating)
* [Apache Phoenix](../interpreter/jdbc.html#apache-phoenix)
* [Apache Drill](../interpreter/jdbc.html#apache-drill)
* [Apache Tajo](../interpreter/jdbc.html#apache-tajo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,10 @@ private InterpreterResult executeSql(String dbPrefix, String sql,

// start hive monitor thread if it is hive jdbc
String jdbcURL = getJDBCConfiguration(user).getPropertyMap(dbPrefix).getProperty(URL_KEY);
if (jdbcURL != null && jdbcURL.startsWith("jdbc:hive2://")) {
String driver =
getJDBCConfiguration(user).getPropertyMap(dbPrefix).getProperty(DRIVER_KEY);
if (jdbcURL != null && jdbcURL.startsWith("jdbc:hive2://")
&& driver != null && driver.equals("org.apache.hive.jdbc.HiveDriver")) {
HiveUtils.startHiveMonitorThread(statement, context,
Boolean.parseBoolean(getProperty("hive.log.display", "true")), this);
}
Expand Down

0 comments on commit 97b2af5

Please sign in to comment.