Server Settings

Expose the keeper related metrics

## proxy[​](#proxy "Direct link to proxy")

Define proxy servers for HTTP and HTTPS requests, currently supported by S3 storage, S3 table functions, and URL functions.

There are three ways to define proxy servers:

- environment variables
- proxy lists
- remote proxy resolvers.

Bypassing proxy servers for specific hosts is also supported with the use of `no_proxy`.

**Environment variables**

The `http_proxy` and `https_proxy` environment variables allow you to specify a
proxy server for a given protocol. If you have it set on your system, it should work seamlessly.

This is the simplest approach if a given protocol has
only one proxy server and that proxy server doesn't change.

**Proxy lists**

This approach allows you to specify one or more
proxy servers for a protocol. If more than one proxy server is defined,
ClickHouse uses the different proxies on a round-robin basis, balancing the
load across the servers. This is the simplest approach if there is more than
one proxy server for a protocol and the list of proxy servers doesn't change.

**Configuration template**

```
<proxy>
    <http>
        <uri>http://proxy1</uri>
        <uri>http://proxy2:3128</uri>
    </http>
    <https>
        <uri>http://proxy1:3128</uri>
    </https>
</proxy>
```

Select a parent field in the tabs below to view their children:

- <proxy>- <http> and <https>

|  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- |
| Field Description|  |  |  |  | | --- | --- | --- | --- | | `<http>` A list of one or more HTTP proxies|  |  | | --- | --- | | `<https>` A list of one or more HTTPS proxies | | | | | |

|  |  |  |  |
| --- | --- | --- | --- |
| Field Description|  |  | | --- | --- | | `<uri>` The URI of the proxy | | | |

**Remote proxy resolvers**

It's possible that the proxy servers change dynamically. In that
case, you can define the endpoint of a resolver. ClickHouse sends
an empty GET request to that endpoint, the remote resolver should return the proxy host.
ClickHouse will use it to form the proxy URI using the following template: `\{proxy_scheme\}://\{proxy_host\}:{proxy_port}`

**Configuration template**

```
<proxy>
    <http>
        <resolver>
            <endpoint>http://resolver:8080/hostname</endpoint>
            <proxy_scheme>http</proxy_scheme>
            <proxy_port>80</proxy_port>
            <proxy_cache_time>10</proxy_cache_time>
        </resolver>
    </http>

    <https>
        <resolver>
            <endpoint>http://resolver:8080/hostname</endpoint>
            <proxy_scheme>http</proxy_scheme>
            <proxy_port>3128</proxy_port>
            <proxy_cache_time>10</proxy_cache_time>
        </resolver>
    </https>

</proxy>
```

Select a parent field in the tabs below to view their children:

- <proxy>- <http> and <https>- <resolver>

|  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- |
| Field Description|  |  |  |  | | --- | --- | --- | --- | | `<http>` A list of one or more resolvers\*|  |  | | --- | --- | | `<https>` A list of one or more resolvers\* | | | | | |

|  |  |  |  |
| --- | --- | --- | --- |
| Field Description|  |  | | --- | --- | | `<resolver>` The endpoint and other details for a resolver | | | |

Note

You can have multiple `<resolver>` elements, but only the first
`<resolver>` for a given protocol is used. Any other `<resolver>`
elements for that protocol are ignored. That means load balancing
(if needed) should be implemented by the remote resolver.

|  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Field Description|  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | | `<endpoint>` The URI of the proxy resolver|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `<proxy_scheme>` The protocol of the final proxy URI. This can be either `http` or `https`.| `<proxy_port>` The port number of the proxy resolver|  |  | | --- | --- | | `<proxy_cache_time>` The time in seconds that values from the resolver should be cached by ClickHouse. Setting this value to `0` causes ClickHouse to contact the resolver for every HTTP or HTTPS request. | | | | | | | | | |

**Precedence**

Proxy settings are determined in the following order:

|  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Order Setting|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | 1. Remote proxy resolvers|  |  |  |  | | --- | --- | --- | --- | | 2. Proxy lists|  |  | | --- | --- | | 3. Environment variables | | | | | | | |

ClickHouse will check the highest priority resolver type for the request protocol. If it is not defined,
it will check the next highest priority resolver type, until it reaches the environment resolver.
This also allows a mix of resolver types can be used.

## query\_cache[​](#query_cache "Direct link to query_cache")

[Query cache](/docs/operations/query-cache) configuration.

The following settings are available:

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Setting Description Default Value|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `max_entries` The maximum number of `SELECT` query results stored in the cache. `1024`| `max_entry_size_in_bytes` The maximum size in bytes `SELECT` query results may have to be saved in the cache. `1048576`| `max_entry_size_in_rows` The maximum number of rows `SELECT` query results may have to be saved in the cache. `30000000`| `max_size_in_bytes` The maximum cache size in bytes. `0` means the query cache is disabled. `1073741824` | | | | | | | | | | | | | | |

Note

- Changed settings take effect immediately.
- Data for the query cache is allocated in DRAM. If memory is scarce, make sure to set a small value for `max_size_in_bytes` or disable the query cache altogether.

**Example**

```
<query_cache>
    <max_size_in_bytes>1073741824</max_size_in_bytes>
    <max_entries>1024</max_entries>
    <max_entry_size_in_bytes>1048576</max_entry_size_in_bytes>
    <max_entry_size_in_rows>30000000</max_entry_size_in_rows>
</query_cache>
```

## query\_cache.max\_entries[​](#query_cache.max_entries "Direct link to query_cache.max_entries")

The maximum number of SELECT query results stored in the cache.

## query\_cache.max\_entry\_size\_in\_bytes[​](#query_cache.max_entry_size_in_bytes "Direct link to query_cache.max_entry_size_in_bytes")

The maximum size in bytes SELECT query results may have to be saved in the cache.

## query\_cache.max\_entry\_size\_in\_rows[​](#query_cache.max_entry_size_in_rows "Direct link to query_cache.max_entry_size_in_rows")

The maximum number of rows SELECT query results may have to be saved in the cache.

## query\_cache.max\_size\_in\_bytes[​](#query_cache.max_size_in_bytes "Direct link to query_cache.max_size_in_bytes")

The maximum cache size in bytes. 0 means the query cache is disabled.

## query\_condition\_cache\_policy[​](#query_condition_cache_policy "Direct link to query_condition_cache_policy")

Query condition cache policy name.

## query\_condition\_cache\_size[​](#query_condition_cache_size "Direct link to query_condition_cache_size")

Maximum size of the query condition cache.

Note

This setting can be modified at runtime and will take effect immediately.

## query\_condition\_cache\_size\_ratio[​](#query_condition_cache_size_ratio "Direct link to query_condition_cache_size_ratio")

The size of the protected queue (in case of SLRU policy) in the query condition cache relative to the cache's total size.

## query\_log[​](#query_log "Direct link to query_log")

Setting for logging queries received with the [log\_queries=1](/docs/operations/settings/settings) setting.

Queries are logged in the [system.query\_log](/docs/operations/system-tables/query_log) table, not in a separate file. You can change the name of the table in the `table` parameter (see below).

The following settings can be configured by sub-tags: