Distributed
The Distributed engine creates a distributed table across a ClickHouse cluster for horizontal scaling:
DistributedTable.ts
import { OlapTable, ClickHouseEngines } from '@514labs/moose-lib'; // Distributed table across clusterexport const distributedTable = new OlapTable<Record>("distributed_data", { engine: ClickHouseEngines.Distributed, cluster: "my_cluster", targetDatabase: "default", targetTable: "local_table", shardingKey: "cityHash64(id)" // Optional: how to distribute data});Distributed Table Requirements
- Requires a configured ClickHouse cluster with remote_servers configuration
- The local table must exist on all cluster nodes
- Distributed tables are virtual - data is stored in local tables
- Cannot use
orderByFields,partitionBy, orsampleByExpressionon distributed tables - The
clustername must match a cluster defined in your ClickHouse configuration
See Also
- ClickHouse Distributed — ClickHouse official documentation