clickhouse-install-auth
Install @clickhouse/client and configure authentication to ClickHouse Cloud or self-hosted. Use when setting up a new ClickHouse project, configuring connection strings, or initializing the official Node.js client. Trigger: "install clickhouse", "setup clickhouse client", "clickhouse auth", "connect to clickhouse", "clickhouse credentials".
- License 许可
- MIT
- 最近更新
- 2026-07-13
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- clickhouse-install-auth
- tags
- [ "saas", "database", "analytics", "clickhouse", "olap" ]
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Install @clickhouse/client and configure authentication to ClickHouse Cloud or self-hosted. Use when setting up a new ClickHouse project, configuring connection strings, or initializing the official Node.js client. Trigger: "install clickhouse", "setup clickhouse client", "clickhouse auth", "connect to clickhouse", "clickhouse credentials".
- allowed-tools
- Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Bash(pip:*), Grep
- compatible-with
- claude-code
03 SKILL.md 正文
ClickHouse Install & Auth
Overview
Set up the official ClickHouse client for Node.js or Python and configure authentication to ClickHouse Cloud or a self-hosted instance.
Prerequisites
- Node.js 18+ or Python 3.8+
- A running ClickHouse instance (Cloud or self-hosted)
- Connection credentials (host, port, user, password)
Instructions
Step 1: Install the Official Client
# Node.js — official client (HTTP-based, supports streaming)
npm install @clickhouse/client
# Python — official client
pip install clickhouse-connect
Step 2: Configure Environment Variables
# .env (NEVER commit — add to .gitignore)
CLICKHOUSE_HOST=https://abc123.us-east-1.aws.clickhouse.cloud:8443
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=your-password-here
# Self-hosted (HTTP interface on port 8123, native on 9000)
# CLICKHOUSE_HOST=http://localhost:8123
Step 3: Create the Client (Node.js)
import { createClient } from '@clickhouse/client';
// ClickHouse Cloud
const client = createClient({
url: process.env.CLICKHOUSE_HOST, // https://<host>:8443
username: process.env.CLICKHOUSE_USER, // default
password: process.env.CLICKHOUSE_PASSWORD,
// ClickHouse Cloud requires TLS — the client handles it via https:// URL
});
// Self-hosted (no TLS)
const localClient = createClient({
url: 'http://localhost:8123',
username: 'default',
password: '',
});
Step 4: Verify Connection
async function verifyConnection() {
// Ping returns true if the server is reachable
const alive = await client.ping();
console.log('ClickHouse ping:', alive.success); // true
// Run a test query
const rs = await client.query({
query: 'SELECT version() AS ver, uptime() AS uptime_sec',
format: 'JSONEachRow',
});
const rows = await rs.json<{ ver: string; uptime_sec: number }>();
console.log('Server version:', rows[0].ver);
console.log('Uptime (sec):', rows[0].uptime_sec);
}
verifyConnection().catch(console.error);
Step 5: Python Alternative
import clickhouse_connect
client = clickhouse_connect.get_client(
host='abc123.us-east-1.aws.clickhouse.cloud',
port=8443,
username='default',
password='your-password-here',
secure=True,
)
result = client.query('SELECT version(), uptime()')
print(f"Version: {result.result_rows[0][0]}")
Connection Options Reference
| Option | Default | Description |
|---|---|---|
url |
http://localhost:8123 |
Full URL including protocol and port |
username |
default |
ClickHouse user |
password |
'' |
User password |
database |
default |
Default database for queries |
request_timeout |
30000 |
Query timeout in ms |
compression.request |
false |
Compress request bodies (gzip) |
compression.response |
true |
Decompress responses |
max_open_connections |
10 |
HTTP keep-alive pool size |
clickhouse_settings |
{} |
Server-side settings per session |
ClickHouse Cloud vs Self-Hosted
| Feature | Cloud | Self-Hosted |
|---|---|---|
| Port | 8443 (HTTPS) | 8123 (HTTP) / 8443 (HTTPS) |
| TLS | Required | Optional |
| Engine | SharedMergeTree | MergeTree family |
| Auth | User/password, Cloud API keys | User/password, LDAP, Kerberos |
Error Handling
| Error | Cause | Solution |
|---|---|---|
ECONNREFUSED |
Server not running | Check host/port, verify ClickHouse is up |
Authentication failed |
Wrong user/password | Verify credentials in ClickHouse users.xml or Cloud console |
CERTIFICATE_VERIFY_FAILED |
TLS mismatch | Use https:// for Cloud, check CA certs for self-hosted |
TIMEOUT |
Network/firewall | Check IP allowlists in Cloud console, firewall rules |
Database not found |
Wrong database name | Run SHOW DATABASES to list available databases |
Resources
- Official Node.js Client
- Official Python Client
- ClickHouse Cloud Quick Start
- HTTP Interface Reference
Next Steps
Proceed to clickhouse-hello-world for your first table and query.
04 同仓库更多 Skills
zustand-store-creator
Create zustand store creator operations. Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like "zustand store creator", "zustand creator", "zustand".
zero-trust-config-helper
Configure with zero trust config helper operations. Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like "zero trust config helper", "zero helper", "zero".
zapier-integration-helper
Assist with zapier integration helper operations. Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like "zapier integration helper", "zapier helper", "zapier".
yaml-config-validator
Validate yaml config validator operations. Auto-activating skill for DevOps Basics. Triggers on: yaml config validator, yaml config validator Part of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like "yaml config validator", "yaml validator", "yaml".
xvary-stock-research
Thesis-driven equity analysis from public SEC EDGAR and market data; /analyze, /score, /compare workflows with bundled Python tools (Claude Code, Cursor, Codex).
xss-vulnerability-scanner
Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals. Triggers on: xss vulnerability scanner, xss vulnerability scanner Part of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like "xss vulnerability scanner", "xss scanner", "xss".