> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corelayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ClickHouse Integration

> Connect your ClickHouse database to Corelayer to enable intelligent querying and debugging with your analytics data.

## Prerequisites

* A ClickHouse instance (self-hosted or ClickHouse Cloud)
* Permission to create users and grant table access in your ClickHouse instance

## Step-by-Step Setup

### 1. Navigate to Integrations

In your Corelayer dashboard, go to the **Integrations** page.

### 2. Add ClickHouse Integration

Click the **Add Integration** button and select **ClickHouse** from the list of available integrations.

### 3. Create a Dedicated ClickHouse User

For security, create a dedicated read-only user for Corelayer. Run the following SQL in your ClickHouse instance:

```sql theme={null}
CREATE USER corelayer IDENTIFIED BY '<your-secure-password>';
```

### 4. Enter Connection Details

Provide the following connection details:

* **Host** — Your ClickHouse server hostname
* **Port** — The connection port (default: 8443 for HTTPS, 9440 for native TLS)
* **Protocol** — HTTP or Native protocol
* **Username** — The dedicated user you created (e.g., `corelayer`)
* **Password** — The password for the user

### 5. Test Connection

Click **Test Connection** to verify that Corelayer can connect to your ClickHouse instance.

### 6. Select Tables

Once connected, Corelayer will discover your databases and tables:

* Browse the list of available databases and tables
* Select the tables you want Corelayer to have access to
* Click **Update Selection**

### 7. Grant Table Access

After selecting tables, grant read access to the Corelayer user. Corelayer will provide the SQL commands:

```sql theme={null}
GRANT SELECT ON <database>.<table> TO corelayer;
```

Run these commands in your ClickHouse instance for each selected table.

### 8. Add ClickHouse Tables to Your Service Maps

When configuring your Corelayer Service Maps, select which ClickHouse tables are relevant to each service.

## What Corelayer Can Do With ClickHouse

Once connected, Corelayer will:

* Query your selected tables to gather context during debugging
* Analyze data patterns to identify anomalies related to reported issues
* Correlate database data with logs and errors from other integrations

## Managing Your Integration

### Disconnecting

To disconnect your ClickHouse integration:

1. Navigate to Settings > Integrations
2. Find your ClickHouse integration and click **Uninstall**
3. Confirm the uninstallation
4. Optionally, drop the dedicated Corelayer user from your ClickHouse instance

## Troubleshooting

### Integration Not Working?

* Verify the connection details (host, port, protocol) are correct
* Ensure the ClickHouse user has been created and the password is correct
* Check that `SELECT` permissions have been granted on the selected tables
* Confirm your ClickHouse instance is accessible from the network
* Verify TLS/SSL settings if using encrypted connections

Need help? [Contact support](mailto:support@corelayer.com) for assistance with your ClickHouse integration.
