Connect to an External ClickHouse Database
LangSmith uses ClickHouse as the primary data store for traces and feedback. By default, LangSmith Self-Hosted will use an internal ClickHouse database that is bundled with the LangSmith instance.
However, you can configure LangSmith to use an external ClickHouse database. By configuring an external ClickHouse database, you can manage backups, scaling, and other operational tasks for your database. Unfortunately, many cloud providers do not offer managed ClickHouse services at this time. Instead, you can run ClickHouse in a few ways:
- LangSmith Managed ClickHouse Cloud(Reach out to us at sales@langchain.dev for more information)
- Provision an instance in ClickHouse Cloud
- Provision a ClickHouse Cloud instance via Marketplace
- On a VM in your cloud provider
Requirements
- A provisioned ClickHouse Instance that your LangSmith instance will have network access to.
- A user with admin access to the ClickHouse database. This user will be used to create the necessary tables, indexes, and views
- Note: We only officially support ClickHouse versions >= 23. We also only support standalone ClickHouse (not clustered or replicated) or ClickHouse Cloud.
Parameters
You will need to provide several parameters to your LangSmith installation to configure an external ClickHouse database. These parameters include:
- Host
- HTTP Port
- Native Port
- Database
- Username
- Password
Configuration
With these parameters in hand, you can configure your LangSmith instance to use the provisioned ClickHouse database. You can do this by modifying the config.yaml
file for your LangSmith Helm Chart installation or the .env
file for your Docker installation.
- Helm
- Docker
clickhouse:
external:
enabled: true
host: "host"
port: "http port"
nativePort: "native port"
user: "default"
password: "password"
database: "default"
tls: false
# In your .env file
CLICKHOUSE_HOST=langchain-clickhouse # Change to your Clickhouse host if using external Clickhouse. Otherwise, leave it as is
CLICKHOUSE_USER=default # Change to your Clickhouse user if needed
CLICKHOUSE_DB=default # Change to your Clickhouse database if needed
CLICKHOUSE_PORT=8123 # Change to your Clickhouse port if needed
CLICKHOUSE_TLS=false # Change to true if you are using TLS to connect to Clickhouse. Otherwise, leave it as is
CLICKHOUSE_PASSWORD=password # Change to your Clickhouse password if needed
CLICKHOUSE_NATIVE_PORT=9000 # Change to your Clickhouse native port if needed
Once configured, you should be able to reinstall your LangSmith instance. If everything is configured correctly, your LangSmith instance should now be using your external ClickHouse database.