clickhousectl-cloud-deploy

작성자: clickhouse

사용자가 ClickHouse를 클라우드에 배포하거나, 프로덕션 환경으로 전환하거나, ClickHouse Cloud를 사용하거나, 관리형 ClickHouse 서비스를 호스팅하거나, 로컬에서 마이그레이션하려는 경우 사용합니다.

npx skills add https://github.com/clickhouse/agent-skills --skill clickhousectl-cloud-deploy

Deploy to ClickHouse Cloud

This skill walks through deploying to ClickHouse Cloud using clickhousectl. It covers account setup, CLI authentication, service creation, schema migration, and connecting your application. Follow these steps in order.

When to Apply

Use this skill when the user wants to:

  • Deploy their ClickHouse application to production
  • Host ClickHouse as a managed cloud service
  • Migrate from a local ClickHouse setup to ClickHouse Cloud
  • Create a ClickHouse Cloud service
  • Set up ClickHouse Cloud for the first time

Step 1: Sign up for ClickHouse Cloud

Before using any cloud commands, the user needs a ClickHouse Cloud account.

Ask the user: "Do you already have a ClickHouse Cloud account?"

If they do not have an account, explain:

ClickHouse Cloud is a fully managed service that runs ClickHouse for you — no infrastructure to maintain, automatic scaling, backups, and upgrades included. There's a free trial so you can get started without a credit card.

To create an account, go to: https://clickhouse.cloud

Sign up with your email, Google, or GitHub account. Once you're in the console, let me know and we'll continue with the next step.

Wait for the user to confirm they have signed up or already have an account before proceeding.


Step 2: Authenticate the CLI

First, ensure clickhousectl is installed. Check with:

which clickhousectl

If not found, install it:

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

Authenticate clickhousectl with a ClickHouse Cloud API key.

Create an API key

Guide the user through creating one in the ClickHouse Cloud console:

  1. Click the gear icon (Settings) in the left sidebar
  2. Go to API Keys
  3. Click Create API Key
  4. Give it a name (e.g., "clickhousectl")
  5. Select the Admin role for the key. Admin is needed because cloud service query auto-provisions a per-service query endpoint API key on first use, which requires permission to create keys. Developer-scoped keys can manage services but may not be able to complete the auto-provisioning step.
  6. Click Generate API Key
  7. Copy both the Key ID and the Key Secret — the secret is only shown once

Authenticate clickhousectl with the key

Ask the user to open a new terminal tab in the same working directory and run the login command there with their Key ID and Secret — this keeps the secret out of the chat session. Tell them to come back and let you know once it's done.

clickhousectl cloud login --api-key <key> --api-secret <secret>

Both --api-key and --api-secret are required — if the user only has one, tell them both are needed.


To verify authentication works:

clickhousectl cloud org list

This should return the user's organization.


Step 3: Create a cloud service

Create a new ClickHouse Cloud service:

clickhousectl cloud service create --name <service-name>

From the output, add the HTTPS host and port to .env as CLICKHOUSE_HOST and CLICKHOUSE_PORT. Make sure .env is gitignored.

Then poll until the service state is running:

clickhousectl cloud service get <service-id>

Step 4: Migrate schemas

If the user has local table definitions (e.g., from using the clickhousectl-local-dev skill), migrate them to the cloud service.

Use cloud service query to run SQL against the cloud service over HTTP. Just pass the service name (or --id).

Read the local schema files from clickhouse/tables/ and apply each one to the cloud service:

clickhousectl cloud service query --name <service-name> \
  --queries-file clickhouse/tables/<table>.sql

Apply them in dependency order — tables referenced by materialized views should be created first.

Also apply materialized views if they exist:

clickhousectl cloud service query --name <service-name> \
  --queries-file clickhouse/materialized_views/<view>.sql

To target a specific database, pass --database <name>.


Step 5: Verify the deployment

Connect to the cloud service and confirm tables exist:

clickhousectl cloud service query --name <service-name> --query "SHOW TABLES"

Run a test query to confirm the schema is correct:

clickhousectl cloud service query --name <service-name> --query "DESCRIBE TABLE <table-name>"

Step 6: Create a dedicated user for the application

The default user has full admin rights and should not be used by the application. Create a dedicated user scoped to the schema deployed in Step 4.

Generate a strong random password and append the credentials to .env before creating the user, so the password is persisted even if a subsequent step fails:

PASSWORD=$(openssl rand -base64 32)
echo "CLICKHOUSE_USER=app_user" >> .env
echo "CLICKHOUSE_PASSWORD=$PASSWORD" >> .env

Then create the user and grant the minimum permissions the app needs. Replace <database> with the database the schema lives in (often default):

clickhousectl cloud service query --name <service-name> --query \
  "CREATE USER app_user IDENTIFIED BY '$PASSWORD'"

clickhousectl cloud service query --name <service-name> --query \
  "GRANT SELECT, INSERT ON <database>.* TO app_user"

Adjust the grants to fit the app:

  • Read-only app → drop INSERT
  • Needs to create/drop its own tables → also grant CREATE TABLE, DROP TABLE on the database (but prefer running migrations as the admin user instead)
  • Multiple databases → repeat the GRANT per database, or scope per table with ON <database>.<table>

Verify the user exists and has the expected grants:

clickhousectl cloud service query --name <service-name> --query "SHOW GRANTS FOR app_user"

ClickHouse cannot reveal the password later, so if .env is lost, the user must reset the password via ALTER USER app_user IDENTIFIED BY '<new>'.


The application can now use the credentials in .env to connect 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-local-dev
clickhouse
사용자가 ClickHouse로 애플리케이션을 구축하거나, 로컬 ClickHouse 개발 환경을 설정하거나, 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