Prerequisites
- A ClickHouse server reachable from CloudThinker over its HTTP interface (
8443with TLS,8123without). ClickHouse Cloud, self-hosted, operator-run, and managed clusters all work; the native TCP port (9000) is not used. - Admin access to create a dedicated user.
Setup
1
Create a dedicated user and grant read access
Connect as an admin, create the CloudThinker user, and grant For table sizes, part counts, and query investigation, also grant
SELECT on the databases the agent should see plus SHOW:SELECT on system.tables, system.columns, system.parts, and system.query_log.2
Pin the user to read-only (recommended)
The connection defaults to read-only, but a settings profile makes the restriction hold at the server, independent of any client:Skip this step if you plan to turn Write access on. The profile uses
READONLY, so neither the user nor CloudThinker’s switch can lift it.3
Configure network access
- ClickHouse Cloud: add CloudThinker to the service IP access list, under the service’s Settings → Security.
- Self-hosted: allow inbound
8443(or8123) from CloudThinker in your firewall or security group.
4
Add the connection in CloudThinker
Go to Connections → ClickHouse and enter the host, port, username, and password, set Use TLS, and leave Write access on
Read-only unless the agent needs to change data.Click Connect. CloudThinker runs a single SELECT version() as that user, and the Connected message names the ClickHouse version, the username, and the default database when you set one. Anything else comes back as a specific reason — see Troubleshooting.Connection details
Required permissions
The grants in Setup step 1 cover read-only analysis;system.query_log is what turns “this dashboard is slow” into a ranked list of the queries responsible. Only if you enable write access, additionally grant:
*.*. A grant the user does not hold is the boundary the Write access switch cannot cross.
Agent capabilities
Once connected, Tony can:Verify the connection
Example prompts
Write access
The connection ships read-only, and two switches open it up one step at a time.
Three things to weigh before turning write access on:
Blockedprotects the table, not the rows. It does not rejectALTER TABLE ... DELETE,DROP PARTITION, orDROP COLUMN, each of which removes data while leaving the table in place. TreatFull accessas “the agent can destroy data”.- ClickHouse has no transactions. Mutations and drops cannot be rolled back, so recovery means restoring from a backup.
- Grants are the stronger control. The switches only decide whether CloudThinker sends
readonly=1; they never grant a privilege the ClickHouse user does not hold.
Troubleshooting
ClickHouse rejected the username or password
ClickHouse rejected the username or password
Confirm the user exists (
SHOW USERS;) and retype the password rather than pasting it — a pasted value carrying a line break is rejected before CloudThinker contacts the server. ClickHouse Cloud disables password auth for some SSO-provisioned users; create a dedicated database user instead of reusing a console login.ClickHouse has no database named …
ClickHouse has no database named …
The name in Default database is not a database ClickHouse found. Names are case-sensitive — check the spelling, or leave the field blank to use the server default.
ClickHouse rejected the request path, or is unreachable
ClickHouse rejected the request path, or is unreachable
Confirm Port and Use TLS agree:
8443 with TLS, 8123 without — the native TCP port 9000 is not the HTTP interface. Check that Host carries no https:// prefix and no :port suffix. On ClickHouse Cloud, add CloudThinker to the service IP access list; self-hosted, confirm <listen_host> includes the exposed interface and the firewall allows the port.ClickHouse did not answer in time
ClickHouse did not answer in time
On ClickHouse Cloud this is usually automatic idling: an inactive service suspends and connections time out until it restarts. Wake the service, then connect again. A 5xx answer means the server is running but not serving queries — check the cluster’s own health.
Cannot execute query in readonly mode
Cannot execute query in readonly mode
The connection is read-only, which is the default. If the agent should write, set Write access to
Full access and reconnect. If it still fails, the restriction is server-side: check whether the user carries a readonly settings profile (SHOW CREATE USER cloudthinker;) and holds the write grants the query needs.DROP is refused even with write access on
DROP is refused even with write access on
DROP and TRUNCATE sit behind their own switch. Set Allow DROP and TRUNCATE to Allowed; it appears only once Write access is Full access.Empty table list
Empty table list
The user needs
SHOW TABLES and SELECT on the database, not only on individual tables. Grant SELECT ON system.tables so metadata queries return rows.Security
- Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
- Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
- Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
- Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
- Grants over switches — the privileges on the ClickHouse user are the durable boundary; the Write access switch decides whether CloudThinker asks for a write, the grant decides whether ClickHouse allows one.
- Server-side read-only — for a connection that must never write, add the settings profile in step 2;
READONLYmakes it un-liftable from the client side.
Related
Tony Agent
Database-focused optimization agent
PostgreSQL Connection
Similar setup for PostgreSQL databases