> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# s3_* 会话设置

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

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["版本", "默认值", "注释"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        版本历史
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

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](/zh/reference/system-tables/settings) 中查看，并由 [源文件](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="s3_check_objects_after_upload">
  ## s3\_check\_objects\_after\_upload
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

通过 head 请求检查每个上传到 S3 的对象，确保上传成功

<div id="s3_connect_timeout_ms">
  ## s3\_connect\_timeout\_ms
</div>

<SettingsInfoBlock type="UInt64" default_value="1000" />

S3 磁盘中主机的连接超时时间。

<div id="s3_create_new_file_on_insert">
  ## s3\_create\_new\_file\_on\_insert
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

启用或禁用在 S3 引擎表中每次插入时创建新文件。如果启用，则每次插入都会使用该 key 创建一个新的 S3 对象，类似于以下模式：

initial: `data.Parquet.gz` -> `data.1.Parquet.gz` -> `data.2.Parquet.gz`，依此类推。

可能的值：

* 0 — `INSERT` 查询会创建一个新文件；如果文件已存在且未设置 s3\_truncate\_on\_insert，则会失败。
* 1 — 如果未设置 s3\_truncate\_on\_insert，`INSERT` 查询会在每次插入时使用后缀 (从第二个文件开始) 创建一个新文件。

更多详情请参见[此处](/zh/integrations/connectors/data-ingestion/AWS/integrating-s3-with-clickhouse#inserting-data)。

<div id="s3_disable_checksum">
  ## s3\_disable\_checksum
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

向 S3 发送文件时不计算校验和。这样可以避免对文件进行过多处理，从而加快写入操作。总体而言，这样做基本是安全的，因为 MergeTree 表的数据本身就会由 ClickHouse 计算校验和；而且当通过 HTTPS 访问 S3 时，TLS 层在网络传输过程中已经提供了完整性保护。不过，在 S3 上额外计算校验和仍能提供纵深防御。

<div id="s3_ignore_file_doesnt_exist">
  ## s3\_ignore\_file\_doesnt\_exist
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

读取某些对象键时，如果文件不存在，则忽略该情况。

可能的值：

* 1 — `SELECT` 返回空结果。
* 0 — `SELECT` 抛出异常。

<div id="s3_list_object_keys_size">
  ## s3\_list\_object\_keys\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="1000" />

ListObject 请求一次批次中可返回的最大文件数

<div id="s3_min_upload_part_size">
  ## s3\_min\_upload\_part\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="16777216" />

向 S3 执行分段上传时，单个上传分段的最小大小。

<div id="s3_path_filter_limit">
  ## s3\_path\_filter\_limit
</div>

<SettingsInfoBlock type="UInt64" default_value="1000" />

可从查询过滤器中提取并用于文件迭代的 `_path` 值的最大数量，而不是通过 glob 列举文件。
0 表示禁用。

<div id="s3_request_timeout_ms">
  ## s3\_request\_timeout\_ms
</div>

<SettingsInfoBlock type="UInt64" default_value="30000" />

向 S3 发送和从 S3 接收数据时的空闲超时时间。如果单次 TCP 读取或写入调用阻塞超过该时长，则会失败。

<div id="s3_skip_empty_files">
  ## s3\_skip\_empty\_files
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

启用或禁用在 [S3](/zh/reference/engines/table-engines/integrations/s3) 引擎表中跳过空文件。

可能的值：

* 0 — 如果空文件与请求的格式不兼容，`SELECT` 会抛出异常。
* 1 — 对于空文件，`SELECT` 返回空结果。

<div id="s3_slow_all_threads_after_network_error">
  ## s3\_slow\_all\_threads\_after\_network\_error
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

当设置为 `true` 时，如果某个 `s3` 请求遇到可重试的网络错误 (例如套接字超时) ，则所有向同一 Backup 端点发起 S3 请求的线程都会被放慢。
当设置为 `false` 时，每个线程都会独立处理 S3 请求的退避，不受其他线程影响。

<div id="s3_strict_upload_part_size">
  ## s3\_strict\_upload\_part\_size
</div>

<SettingsInfoBlock type="UInt64" default_value="0" />

向 S3 进行分段上传时，每个分段的精确大小 (某些实现不支持可变大小的分段) 。

<div id="s3_throw_on_zero_files_match">
  ## s3\_throw\_on\_zero\_files\_match
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

当 ListObjects 请求未匹配到任何文件时，抛出错误

<div id="s3_truncate_on_insert">
  ## s3\_truncate\_on\_insert
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

启用或禁用在 S3 引擎表中插入前执行截断操作。若禁用，则当 S3 对象已存在时，尝试插入会抛出异常。

可能的值：

* 0 — `INSERT` 查询会创建新文件；如果文件已存在且未设置 s3\_create\_new\_file\_on\_insert，则会失败。
* 1 — `INSERT` 查询会用新数据替换文件中的现有内容。

更多详情请参见[这里](/zh/integrations/connectors/data-ingestion/AWS/integrating-s3-with-clickhouse#inserting-data)。

<div id="s3_uri_style">
  ## s3\_uri\_style
</div>

<SettingsInfoBlock type="S3UriStyle" default_value="auto" />

强制设置 S3 端点样式。可能的值：auto、virtual\_hosted、path。

<div id="s3_use_adaptive_timeouts">
  ## s3\_use\_adaptive\_timeouts
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

当设置为 `true` 时，所有 S3 请求 的前两次尝试都会使用较短的发送和接收超时时间。
当设置为 `false` 时，所有尝试都会使用相同的超时时间。
