For anyone looking for sharding, I’m leaving the clickhouse cluster github as a reference.
Table creation query example)
CREATE TABLE sentrylab.groupassignee_local_rep ON CLUSTER ‘company_cluster’ (
offset
UInt64,
record_deleted
UInt8,
project_id
UInt64,
group_id
UInt64,
date_added
Nullable(DateTime),
user_id
Nullable(UInt64),
team_id
Nullable(UInt64)
) ENGINE = ReplicatedReplacingMergeTree(’/clickhouse/tables/{cluster}/{shard}/groupassignee_local’, ‘{replica}’, offset)
ORDER BY
(project_id, group_id) SETTINGS index_granularity = 8192
CREATE TABLE sentrylab.groupassignee_local ON CLUSTER ‘company_cluster’ AS sentrylab.groupassignee_local_rep
ENGINE = Distributed(‘company_cluster’, sentrylab, groupassignee_local_rep, project_id);
INSERT INTO sentrylab.groupassignee_local SELECT * FROM sentry.groupassignee_local