How to Connect Grafana to ClickHouse
Once Grafana has been installed with the ClickHouse plugins, dashboards and charts can be created that draw off of data in the CLickHouse server.
Connecting Grafana to ClickHouse
Creating a Dashboard and Chart from ClickHouse data requires the creation of a Grafana Data Source. This is a configuration that specifies the ClickHouse server hostname and other settings Grafana will use to connect.
These instructions assume that you have installed Grafana with the ClickHouse plugins. For more information, see How to Install Grafana and ClickHouse Plugins.
Create Grafana Data Source with the ClickHouse Plugin
To create a new Grafana Data Source connected to a ClickHouse server:
-
Connect to your Grafana server from a browser.
-
From the left navigation panel, select Settings -> Data sources.
-
Select Add Data Source.
-
From the list of data sources, select ClickHouse.
Localhost Sample Data Source
For organizations who want to test their Grafana ClickHouse plugin with their own internal ClickHouse server, the following settings would be used to connect to a ClickHouse server at host name localhost
, with no credentials and no encryption.
- Enter the following:
- Name: The name for the connection. This does not need to be the name of the ClickHouse server or database.
- URL: For
localhost
, we need to specify both the protocol and the port. In this case, it will behttp://localhost:8123
. - Auth: Only required if a ClickHouse username and password are specified. If there are no ClickHouse credentials to use, then leave this section disabled.
- Additional:
- Use Post method to send queries: True
- Default database: Select the database to be used without having to specify it in connections.
- Select Save & test.

If successful, then the Grafana server can connect to the ClickHouse server on localhost
.
Altinity.Cloud Sample Data Source
The following samples are based on a publicly available ClickHouse sample database provided by Altinity.Cloud. This database provides access to US airline flight data and sample logs, and can be access through the following credentials:
- Server: https://github.demo.trial.altinity.cloud
- Port: 8443
- Database: default
- Username: demo
- Password: demo
- Enter the following:
-
Name: The name for the connection. This does not need to be the name of the ClickHouse server or database.
-
URL: The URL is in the format
{HTTP/HTTPS}://{URL}:{port}
. If using Altinity.Cloud, this is provided through the Cluster Access Point.For example:
If the connection is on the specific IP
192.168.0.10
in your network on an unencrypted link then the URL would behttp://192.168.0.10:8123
.If using the Altinity.Cloud example above then the URL would be
https://github.demo.trial.altinity.cloud:8443
. The URL used for Grafana breaks down as follows:- connectiontype: HTTP or HTTPS
- url: The fully qualified domain name or IP address of the ClickHouse server.
- port: The port being used. By default, HTTP is port
8123
, HTTPS is port8443
.
-
Auth: Only required if a ClickHouse username and password are specified.
- Basic auth: True
- With Credentials: True
-
Basic Auth Details: Only required if Basic auth is set to
True
.- User: The ClickHouse username.
- Password: The ClickHouse user password.
-
Additional:
- Use Post method to send queries: True
- Default database: Select the database to be used without having to specify it in connections.
-
- Select Save & test.
If the Save & test is successful, then the data source is available for use.