ClickHouse HTTP
Each cluster runs the ClickHouse HTTP query interface on port 8088. Use tunable disable_traefik_clickhouse_http_port
to turn off the server.
Authentication
The ClickHouse HTTP query interfaces support both JWT bearer token-based and username/password-based query authentication.
Get the bearer token, which is good for the next 24 hours, to authenticate future API calls. This command assumes you've set the $HDX_HOSTNAME, $HDX_USER and $HDX_PASSWORD environment variables:
export HDX_TOKEN=$(
curl -v -X POST -H "Content-Type: application/json" \
https://$HDX_HOSTNAME/config/v1/login/ \
-d "{
\"username\":\"$HDX_USER\",
\"password\":\"$HDX_PASSWORD\"
}" | jq -r ".auth_token.access_token"
)
Learn more on the Enable Query Authentication, User Authentication, and Configure IP Access pages.
ClickHouse HTTP query example
$ printf "%s\n" "SELECT COUNT(*) FROM hydro.logs WHERE timestamp > NOW() - INTERVAL 1 HOUR;" \
| curl --data-binary @- \
--header "Authorization: Bearer $JWT" \
https://{myhost}.hydrolix.live:8088/
2136727
Updated 9 days ago