Skip to content

Commit

Permalink
Docs: Add HTTPS configuration example
Browse files Browse the repository at this point in the history
  • Loading branch information
pan3793 committed Nov 21, 2023
1 parent 7b79661 commit 3ccdc48
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions docs/configurations/01_catalog_configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,30 @@ license: |
<!--begin-include-->
### Single Instance

Suppose you have one ClickHouse instance which installed on `10.0.0.1` and exposes HTTP on `8123`.
Suppose you have one ClickHouse instance which installed on `10.0.0.1` and exposes HTTP endpoint on `8123`.

Edit `$SPARK_HOME/conf/spark-defaults.conf`.

```
########################################
####################################################################################
## register a catalog named "clickhouse"
########################################
####################################################################################
spark.sql.catalog.clickhouse xenon.clickhouse.ClickHouseCatalog
################################################
####################################################################################
## basic configurations for "clickhouse" catalog
################################################
####################################################################################
spark.sql.catalog.clickhouse.host 10.0.0.1
spark.sql.catalog.clickhouse.protocol http
spark.sql.catalog.clickhouse.http_port 8123
spark.sql.catalog.clickhouse.user default
spark.sql.catalog.clickhouse.password
spark.sql.catalog.clickhouse.database default
###############################################################
####################################################################################
## custom options of clickhouse-client for "clickhouse" catalog
###############################################################
####################################################################################
spark.sql.catalog.clickhouse.option.ssl false
spark.sql.catalog.clickhouse.option.async false
spark.sql.catalog.clickhouse.option.client_name spark
```
Expand All @@ -49,29 +50,29 @@ Then you can access ClickHouse table `<ck_db>.<ck_table>` from Spark SQL by usin

For ClickHouse cluster, give an unique catalog name for each instances.

Suppose you have two ClickHouse instances, one installed on `10.0.0.1` and exposes HTTP on port `8123` named
clickhouse1, and another installed on `10.0.0.2` and exposes HTTP on port `8123` named clickhouse2.
Suppose you have two ClickHouse instances, one installed on `10.0.0.1` and exposes HTTPS endpoint on port `8443`
named clickhouse1, and another installed on `10.0.0.2` and exposes HTTPS endpoint on port `8443` named clickhouse2.

Edit `$SPARK_HOME/conf/spark-defaults.conf`.

```
spark.sql.catalog.clickhouse1 xenon.clickhouse.ClickHouseCatalog
spark.sql.catalog.clickhouse1.host 10.0.0.1
spark.sql.catalog.clickhouse1.protocol http
spark.sql.catalog.clickhouse1.http_port 8123
spark.sql.catalog.clickhouse1.protocol https
spark.sql.catalog.clickhouse1.http_port 8443
spark.sql.catalog.clickhouse1.user default
spark.sql.catalog.clickhouse1.password
spark.sql.catalog.clickhouse1.database default
spark.sql.catalog.clickhouse1.option.async false
spark.sql.catalog.clickhouse1.option.ssl true
spark.sql.catalog.clickhouse2 xenon.clickhouse.ClickHouseCatalog
spark.sql.catalog.clickhouse2.host 10.0.0.2
spark.sql.catalog.clickhouse2.protocol http
spark.sql.catalog.clickhouse2.http_port 8123
spark.sql.catalog.clickhouse2.protocol https
spark.sql.catalog.clickhouse2.http_port 8443
spark.sql.catalog.clickhouse2.user default
spark.sql.catalog.clickhouse2.password
spark.sql.catalog.clickhouse2.database default
spark.sql.catalog.clickhouse2.option.async false
spark.sql.catalog.clickhouse2.option.ssl true
```

Then you can access clickhouse1 table `<ck_db>.<ck_table>` from Spark SQL by `clickhouse1.<ck_db>.<ck_table>`,
Expand Down

0 comments on commit 3ccdc48

Please sign in to comment.