clickhousectl-local-dev

작성자: clickhouse

사용자가 ClickHouse로 애플리케이션을 구축하거나, 로컬 ClickHouse 개발 환경을 설정하거나, ClickHouse를 설치하거나, 로컬 서버를 생성하려는 경우에 사용합니다.

npx skills add https://github.com/clickhouse/agent-skills --skill clickhousectl-local-dev

Local ClickHouse Development Setup

This skill walks through setting up a complete local ClickHouse development environment using clickhousectl. Follow these steps in order.

When to Apply

Use this skill when the user wants to:

  • Build an application that needs an analytical database or ClickHouse specifically
  • Set up a local ClickHouse instance for development
  • Install ClickHouse on their machine
  • Create tables and start querying ClickHouse locally
  • Prototype or experiment with ClickHouse

Step 1: Install clickhousectl

Check if clickhousectl is already available:

which clickhousectl

If not found, install it:

curl -fsSL https://clickhouse.com/cli | sh

This installs clickhousectl to ~/.local/bin/clickhousectl and creates a chctl alias.

If the command is still not found after install: The user may need to add ~/.local/bin to their PATH or open a new terminal session. Suggest:

export PATH="$HOME/.local/bin:$PATH"

Once installed, clickhousectl skills can be used to install the latest ClickHouse Agent Skills.


Step 2: Install ClickHouse and set the default

Install the latest ClickHouse version and set it as the system default:

clickhousectl local use latest

This installs ClickHouse, sets it as the default version used by clickhousectl local commands, and symlinks ~/.local/bin/clickhouse to the binary, putting clickhouse on your PATH (meaning you can invoke clickhouse directly, e.g. clickhouse client if needed).

You can use other version specifiers like stable, 26.4, 26.4.2.10 when needed.


Step 3: Initialize the project

From the user's project root directory:

clickhousectl local init

This creates a standard folder structure:

clickhouse/
  tables/                 # CREATE TABLE statements
  materialized_views/     # Materialized view definitions
  queries/                # Saved queries
  seed/                   # Seed data / INSERT statements

Note: This step is optional. If the user already has their own folder structure for SQL files, skip this and adapt the later steps to use their paths.


Step 4: Start a local server

clickhousectl local server start --name <name>

This starts a ClickHouse server in the background.

To check running servers and see their exposed ports:

clickhousectl local server list

Step 5: Create the schema

Based on the user's application requirements, write CREATE TABLE SQL files.

Write each table definition to its own file in clickhouse/tables/:

# Example: clickhouse/tables/events.sql
CREATE TABLE IF NOT EXISTS events (
    timestamp DateTime,
    user_id UInt32,
    event_type LowCardinality(String),
    properties String
)
ENGINE = MergeTree()
ORDER BY (event_type, timestamp)

When designing schemas, if the clickhouse-best-practices skill is available, consult it for guidance on ORDER BY column selection, data types, and partitioning.

Apply the schema to the running server:

clickhousectl local client --name <name> --queries-file clickhouse/tables/events.sql

Step 6: Seed data (optional)

If the user needs sample data for development, write INSERT statements to clickhouse/seed/:

# Example: clickhouse/seed/events.sql
INSERT INTO events (timestamp, user_id, event_type, properties) VALUES
    ('2024-01-01 00:00:00', 1, 'page_view', '{"page": "/home"}'),
    ('2024-01-01 00:01:00', 2, 'click', '{"button": "signup"}');

Apply seed data:

clickhousectl local client --name <name> --queries-file clickhouse/seed/events.sql

Step 7: Verify the setup

Confirm tables were created:

clickhousectl local client --name <name> --query "SHOW TABLES"

Run a test query:

clickhousectl local client --name <name> --query "SELECT count() FROM events"

If the user wants to use a managed ClickHouse service, use the clickhousectl-cloud-deploy skill to help the user deploy to ClickHouse Cloud.

clickhouse의 다른 스킬

chdb-sql
clickhouse
Python에서 직접 ClickHouse SQL을 실행하세요 — 서버가 필요 없습니다. 로컬 파일, 원격 데이터베이스, 클라우드 스토리지를 완전한 ClickHouse SQL 기능으로 쿼리할 수 있습니다.
official
chdb-datastore
clickhouse
DataStore는 지연 실행 방식의 ClickHouse 기반 pandas 대체제입니다. 기존 pandas 코드를 변경 없이 그대로 사용할 수 있지만, 연산은 최적화된 SQL로 컴파일되어 결과가 필요할 때(예: print(), len(), 반복)에만 실행됩니다.
official
clickhouse-architecture-advisor
clickhouse
ClickHouse 아키텍처를 설계하거나, 수집 또는 모델링 패턴 중에서 선택하거나, 모범 사례를 워크로드별 시스템으로 변환할 때 반드시 사용해야 합니다…
official
clickhouse-best-practices
clickhouse
28개의 ClickHouse 모범 사례 규칙으로, 스키마 설계, 쿼리 최적화, 데이터 수집 전략별로 구성되어 있습니다. 기본 키 및 데이터 유형 선택(변경 불가능한 설계 결정), JOIN 및 쿼리 최적화, 삽입 배치 및 변형 회피 등 세 가지 핵심 영역을 다룹니다. 영향도에 따라 우선순위가 매겨진 28개의 규칙을 포함하며, ClickHouse의 컬럼 기반 스토리지 및 희소 인덱스 메커니즘으로 인해 스키마 설계 및 쿼리 최적화 규칙은 CRITICAL로 표시됩니다. 구조화된 검토 절차를 제공합니다...
official
clickhousectl-cloud-deploy
clickhouse
사용자가 ClickHouse를 클라우드에 배포하거나, 프로덕션 환경으로 전환하거나, ClickHouse Cloud를 사용하거나, 관리형 ClickHouse 서비스를 호스팅하거나, 로컬에서 마이그레이션하려는 경우 사용합니다.
official
setup
clickhouse
이 플러그인에 포함된 ClickHouse MCP 서버 연결 설정을 사용자에게 안내합니다. 사용자가 플러그인을 처음 설치하거나 문제가 있을 때 사용합니다.
official
clickhouse-js-node-coding
clickhouse
참조: https://clickhouse.com/docs/integrations/javascript
official
clickhouse-js-node-troubleshooting
clickhouse
참조: https://clickhouse.com/docs/integrations/javascript
official