services-flake/doc/clickhouse.md

55 lines
1.1 KiB
Markdown
Raw Normal View History

2024-01-24 18:24:26 +03:00
# Clickhouse
2024-01-24 19:46:17 +03:00
ClickHouse is an open-source column-oriented DBMS (columnar database management system) for online analytical processing (OLAP) that allows users to generate analytical reports using SQL queries in real-time.
2024-01-24 18:24:26 +03:00
## Getting Started
```nix
# In `perSystem.process-compose.<name>`
{
services.clickhouse."clickhouse-1".enable = true;
}
```
{#tips}
2024-01-24 18:24:26 +03:00
## Tips & Tricks
{#change-port}
2024-01-24 18:24:26 +03:00
### Change the HTTP default port
Clickhouse has [HTTP Interface](https://clickhouse.com/docs/en/interfaces/http) that is enabled by default on port 8123. To change the default port, use the `extraConfig` option:
```nix
{
services.clickhouse."clickhouse-1" = {
enable = true;
extraConfig = {
http_port = 9050
};
2024-01-24 18:24:26 +03:00
};
}
```
{#initial-database}
### Initial database schema
To load a database schema, you can use the `initialDatabases` option:
```nix
{
services.clickhouse."clickhouse-1" = {
enable = true;
initialDatabases = [
{
name = "sample_db";
schemas = [ ./test.sql ];
}
# or just create the database:
{
name = "sample_db_without_schema";
}
];
};
}
```