> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# connect_timeout_* 会话设置

> ClickHouse 自动生成的 connect_timeout_* 分组中的会话设置。

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>类型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>默认值</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          无需重启即可更改
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

这些设置可在 [system.settings](/docs/zh/reference/system-tables/settings) 中查看，并由 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="connect_timeout">
  ## connect\_timeout
</div>

<SettingsInfoBlock type="秒" default_value="10" />

当没有可用副本时的连接超时时间。

<div id="connect_timeout_with_failover_ms">
  ## connect\_timeout\_with\_failover\_ms
</div>

<SettingsInfoBlock type="毫秒" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "1000"},{"label": "由于使用 async 连接，默认连接超时时间已增加"}]}]} />

如果在集群定义中使用了 'shard' 和 'replica' 部分，则该参数表示 Distributed 表引擎连接远程服务器时的超时时间 (以毫秒为单位) 。
如果连接失败，会多次尝试连接不同的副本。

<div id="connect_timeout_with_failover_secure_ms">
  ## connect\_timeout\_with\_failover\_secure\_ms
</div>

<SettingsInfoBlock type="毫秒" default_value="1000" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "23.4"},{"label": "1000"},{"label": "由于 async 连接，提高默认安全连接超时时间"}]}]} />

用于选择第一个健康副本的连接超时时间 (适用于安全连接) 。
