Mode d’emploi
- Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
- Consultez le document original pour les outils, identifiants et environnements requis.
- Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/altinity/altinity-skills --skill altinity-expert-clickhouse-kafkaAvant de commencer
- L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
- Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.
Kafka engine health
Answers "are the Kafka consumers polling, committing and keeping up, and is anything starving them?" from system.kafka_consumers, system.metric_log, system.query_views_log and system.text_log. Run altinity-expert-clickhouse-connection first if the connection mode, cluster and time window are not yet established.
Query packs
checks.sql— 7 checks: consumption health per consumer (kafka-01), average rows per commit (kafka-02), rebalances and assignments (kafka-03), consumers versus message broker pool size (kafka-04), pool utilization over 12 hours (kafka-05, needssystem.metric_log), slow materialized views on Kafka tables (kafka-06, needssystem.query_views_log), Kafka messages in the log (kafka-07, needssystem.text_log).advanced_checks.sql— 4 checks: consumer exception drill-down for one table (needs{db}and{kafka_table}), total lag per table, lag per partition, broker connection health. The last three parserdkafka_stat. The file also contains a three-statement consumption-speed recipe marked@skip-matrix: it creates a temporary table, sleeps, then compares snapshots, so all three statements must run in ONEclickhouse-clientsession. It cannot run over MCP or as separate--querycalls.troubleshooting.md— common Kafka errors and configuration fixes (ACL errors, poll interval, dead letter queue, offset rewind, parallel consumption tuning).references/rack-awareness.md— cross-AZ andclient.rackinvestigation; load it when the question involves AWS MSK,KAFKA_CLIENT_RACK, cross-AZ cost, VPC endpoints, or a Kafka cluster migration.reference.md— background (Kafka engine and librdkafka settings); read only when you need to explain a recommendation.
How to run the query packs
- Read each pack file from this skill's directory (the skill loader prints the directory path).
- Run statements one at a time, never a whole file. Statements end with
;and start with a-- @check <id> <title>header; keep the id with its result. - Honor
-- @requires: skip the statement when the named table is missing, whenkeeperis required and the server has no Keeper/ZooKeeper, or when the version condition is not met. List skipped ids with the reason. - Keep
{cluster}as written when a cluster macro exists; otherwise apply the connection skill's rewrite rule. Any other{placeholder}is a template variable: substitute a real value first or skip the statement. - On an error, record the check id and the first line of the error, then continue. Only for
UNKNOWN_IDENTIFIER, runDESCRIBE TABLE system.<table>and drop the missing column. - A
severitycolumn is the verdict for that row. Copy it; do not re-grade.
Interpretation rules
- A consumer is stuck when
last_exception_time >= last_poll_timeorlast_exception_time >= last_commit_time: it is failing rather than progressing. Otherwise treat it as healthy even if lag exists. exceptionsis a tuple of arrays with matching indices.exceptions.time[-1]andexceptions.text[-1]are the most recent error; quote both.kafka_consumers > mb_pool_size(kafka-04) is thread starvation: consumers wait for a free thread. Fix by raisingbackground_message_broker_schedule_pool_size(default 16). Size it as the total of all Kafka, RabbitMQ and NATS consumers plus 25 percent.- Materialized view average duration above 30 seconds (kafka-06) risks exceeding
max.poll.interval.ms, which gets the consumer kicked from the group. Errored view executions are usually the rebalance interrupting a batch mid-flight, not an independent bug. - The most common cause of a slow view on a Kafka table is several
JSONExtractcalls re-parsing the same JSON blob. The fix is one-passJSONExtract(json, 'Tuple(...)')plustupleElement(); seetroubleshooting.mdin this directory. - Pool utilization over 12 hours (kafka-05): values sustained near the pool size mean capacity pressure; spikes that line up with lag mean temporary overload; a flat zero means the consumers are not running at all, which is a different finding from lag.
rdkafka_statis empty unless<statistics_interval_ms>is set in the Kafka engine config. If it is empty, report the three lag and broker checks as skipped for a missing prerequisite, not as OK.client.rackalone changes nothing: the brokers must runRackAwareReplicaSelector, which is not the default. Verify the broker-side selector before recommending any rack setting.- In librdkafka broker counters,
txandrxare request and response counts whiletxbytesandrxbytesare bytes. Attribute per-broker and cross-AZ traffic from the byte counters only.
Report format
- Header: connection mode, cluster or "single node", ClickHouse version, time window.
- Findings: table with columns
check,severity,object,evidence,recommendation; one row per finding, Critical first. Evidence quotes the numbers from the result rows. - OK checks: one line listing the check ids that returned no problem rows.
- Skipped and failed checks: id and reason or first error line. Never omit this section.
- Next steps: skills to load next and immediate actions.
Next skills
- Materialized view inserts are the bottleneck, or insert latency dominates → load skill
altinity-expert-clickhouse-ingestion - High merge memory or a part backlog on the destination table → load skill
altinity-expert-clickhouse-merges - The view query itself is slow independent of Kafka → load skill
altinity-expert-clickhouse-reporting - The destination table design or the view chain looks wrong → load skill
altinity-expert-clickhouse-schema - Cross-AZ cost remains after the Kafka checks, or the traffic uses ClickHouse interserver ports → load skill
altinity-expert-clickhouse-replication - Message broker pool saturation needs a longer trend than 12 hours → load skill
altinity-expert-clickhouse-metrics





