-
Notifications
You must be signed in to change notification settings - Fork 0
feat: highly available clickhouse deployment #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: highly available clickhouse deployment #27
Conversation
The previous clickhouse deployment was setup to run as a single node cluster preventing us from having a highly available deployment. The database schema has been adjusted to create a replicated database so that Clickhouse will automatically replicate schema changes and data between replicas. This schema change is a breaking change so the environments will be re-created. I've also adjusted the ordering of audit logs to use the timestamp as a secondary sort column so we can maintain strict ordering of audit logs. There's still benefits in maintaining the hourly bucketing so Clickhouse can skip over entire hours of data through indexes. The apiserver has been updated to use the new ordering. The migration script will now wait for all replicas in the cluster to come up before executing migrations.
Need operational visibility into Clickhouse Keeper so we can monitor the component and understand replication delay between cluster replicas.
Were using a replicated database now. Need to account for some replicas reporting the same metrics.
These pod disruption budgets ensure the clickhouse system is able to maintain quorum by only letting a single replica of the database and the keeper instance be offline at any given time.
|
Had an incident happen in production over the weekend after we deployed this change. To help mitigate the same issue in the future, I added resource requirements, topology spread constraints, and pod disruption budgets for the workloads to ensure they're hardened for production. I also had to replace the table engine with the ReplicatedReplacingMergeTree table engine so that data is replicated across replicas. I misunderstood the Clickhouse documentation originally and thought that using a replicated database engine was enough to configure replication of DDL schema changes and the underlying data. Also adjusted the audit log pipeline dashboard to account for replication being enabled now. |
The previous clickhouse deployment was setup to run as a single node cluster preventing us from having a highly available deployment.
The database schema has been adjusted to create a replicated database so that Clickhouse will automatically replicate schema changes and data between replicas.
Important
This schema change is a breaking change so the environments will be re-created.
I've also adjusted the ordering of audit logs to use the timestamp as a secondary sort column so we can maintain strict ordering of audit logs. There's still benefits in maintaining the hourly bucketing so Clickhouse can skip over entire hours of data through indexes. The apiserver has been updated to use the new ordering.
The migration script will now wait for all replicas in the cluster to come up before executing migrations.
Relates to datum-cloud/enhancements#536