It allows you to generate real-time analytical data reports using SQL queries.
For more information, see the ClickHouse documentation.
Upsun supports ClickHouse with the following limitations:
- High availability of service isn’t supported.
- You can only configure single-node ClickHouse clusters.
Supported versions
Upsun plans on supporting long-term support ClickHouse versions in priority.Relationship reference
For each service defined via a relationship to your application, Upsun automatically generates corresponding environment variables within your application container, in the$<RELATIONSHIP-NAME>_<SERVICE-PROPERTY> format.
Here is example information available through the service environment variables themselves,
or through the PLATFORM_RELATIONSHIPS environment variable.
- Service environment variables
- `PLATFORM_RELATIONSHIPS` environment variable
You can obtain the complete list of available service environment variables in your app container by running
upsun ssh env.Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the service environment variables directly rather than hard coding any values.Usage example
1. Configure the service
To define the service, use theclickhouse type:
Note that changing the name of the service replaces it with a brand new service and all existing data is lost. Back up your data before changing the service.
2. Define the relationship
To define the relationship, use one of the following endpoints.clickhouse endpoint
The clickhouse endpoint allows you to use the Native Protocol port (also known as ClickHouse TCP protocol).
This protocol is used by ClickHouse apps and processes such as clickhouse-server, clickhouse-client, and native ClickHouse tools. It is also used for inter-server communication for distributed queries.
Use the following configuration:
- Using default endpoints
- Using explicit endpoints
You can define
SERVICE_NAME as you like.clickhouse-http endpoint
The clickhouse-http endpoint allows you to use the HTTP API Port for HTTP requests.
This protocol is used by JDBC, ODBC, and web interfaces.
Use the following configuration:
You can define SERVICE_NAME and <RELATIONSHIP_NAME> as you like, so long as it’s unique between all defined services and relationships
and matches in both the application and services configuration.
With this definition, the application container (<APP_NAME>:) now has access to the service via the corresponding service environment variables.
Example configuration
If you want to change theclickhouse endpoint to clickhouse-http, you need to use explicit endpoint definition as it defaults to clickhouse endpoint when using default endpoint (aka. as relationship definition).
Multiple databases
You can configure multiple databases, much like with PostgreSQL. To do so, you can use a configuration similar to the following:Exporting Data
ClickHouse data can be exported using the nativeclickhouse-client tool over an SSH tunnel.
- Open an SSH tunnel to your ClickHouse service:
Terminal
127.0.0.1:30000.
- Export a table or the result of a query to a file:
Terminal
CSVWithNames with any ClickHouse output format
such as Parquet, JSONEachRow, or Native depending on your needs.
- To export the full schema of your database:
Terminal
<CLICKHOUSE_USERNAME>, <CLICKHOUSE_PASSWORD>, <CLICKHOUSE_PATH>) are available
in the service environment variables. Run upsun ssh -- env | grep CLICKHOUSE to retrieve them.