Configure Query Head Pooling
Use these procedures to enable query head pooling and set up its components. For an overview of how the feature works, see Query head pools.
To set up query head pooling in a basic configuration:
- Create at least one additional query head pool.
- Enable
http_proxyif you have HTTP clients. - Enable
clickproxif you have native TCP clients. - Enable the
query_head_pooling_enabledtunable. - Configure routing rules.
- Update client applications to pass the
databaseparameter.
Enable query head pooling⚓︎
Query head pooling is disabled by default. These tunables control it:
| Tunable | Description | Default |
|---|---|---|
query_head_pooling_enabled |
Enables per-pool routing rules in Traefik and pool-aware proxy configuration. Requires http_proxy.enabled to have any observable effect on HTTP routing. |
false |
http_proxy.enabled |
Enables the HTTP proxy. Required to route HTTP traffic through the proxy. | false |
query_head_native_routing_enabled |
Routes native TCP connections through ClickProx. | true |
For more detail on how these tunables interact, see Query head pools.
To route all default-pool HTTP traffic through the proxy, see HTTP proxy.
To support both HTTP and native TCP clients, enable both http_proxy and clickprox:
| Enable Query Head Pooling | |
|---|---|
Configure ClickProx⚓︎
Configure ClickProx with the clickprox tunable:
| ClickProx Configuration | |
|---|---|
| Field | Description |
|---|---|
enabled |
Enable or disable ClickProx |
port |
Port for incoming native TCP connections |
metrics_port |
Port for Prometheus metrics |
drain_timeout |
Seconds to wait for in-flight connections before shutting down |
Create query head pools⚓︎
Create query head pools by adding a pool definition to hydrolixcluster.yaml.
Set the service field to query-head:
| Query Head Pool | |
|---|---|
Configure routing rules⚓︎
Incoming connections and HTTP requests are routed to a query head pool based on the client's database parameter.
- The
query-headpool is always the default pool. Routing rules can select any pool, including the default. - Each routing rule can specify a
default_query_peerpool, used when the query doesn't specifyhdx_query_pool_name. - Each routing rule can also set a
priority. A lower number is higher priority.
Clients must use the database parameter
The query head pool routing feature only works if clients present the database parameter. See examples in route by database.
Update applications to include the database parameter with HTTP requests and native protocol connections. It's only used for query head pool selection.
Route by database⚓︎
| Route by Database | |
|---|---|
Select a query head pool using clickhouse-client by setting the --database parameter.
- The
--databaseparameter matches a known routing rule and theanalytics-query-headis used.
- The
--databaseparameter doesn't match any rules. The default query head pool is used.
Select a query head pool using curl by setting the database HTTP query parameter.
- The
--databaseparameter matches a known routing rule and theanalytics-query-headis used.
- The
--databaseparameter doesn't match any rules. The default query head pool is used.