Clickhouse

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.

Getting Started

# In `perSystem.process-compose.<name>`
{
  services.clickhouse."clickhouse-1".enable = true;
}

Tips & Tricks

Change the HTTP default port

Clickhouse has HTTP Interface that is enabled by default on port 8123. To change the default port, use the extraConfig option:

{
  services.clickhouse."clickhouse-1" = {
    enable = true;
    extraConfig = {
      http_port = 9050
    };
  };
}

Initial database schema

To load a database schema, you can use the initialDatabases option:

{
  services.clickhouse."clickhouse-1" = {
    enable = true;
    initialDatabases = [
      {
        name = "sample_db";
        schemas = [ ./test.sql ];
      }
      # or just create the database:
      {
        name = "sample_db_without_schema";
      }
    ];
  };
}
Links to this page
  • Supported services
  • Data directory

    dataDir of a service is where the service persists its state. Resetting the state will not only give the service a fresh start but in some cases, like Clickhouse or other database services, it loads the updated schema/database-init-scripts. To reset the state of an instance of a service, x, where x is declared in your configuration like services.<name>.x, follow:

  • Contributing

    It is important to add documentation along with any new services you are contributing. Create a new file ./doc/<service-name>.md (see Clickhouse for example) and add the service to the list in Supported services.