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

> 包含有关配置文件中可用集群及其所定义服务器信息的系统表。

# system.clusters

<div id="description">
  ## 描述
</div>

包含配置文件中可用集群及其服务器的信息。

<div id="Columns">
  ## 列
</div>

* `cluster` ([String](/zh/reference/data-types)) — 集群名称。
* `shard_num` ([UInt32](/zh/reference/data-types)) — 集群中分片的编号，从 1 开始。
* `shard_name` ([String](/zh/reference/data-types)) — 集群中分片的名称。
* `shard_weight` ([UInt32](/zh/reference/data-types)) — 写入数据时该分片的相对权重。
* `internal_replication` ([UInt8](/zh/reference/data-types)) — 用于指示该主机是否属于某个可自行复制数据的节点组的标志。
* `replica_num` ([UInt32](/zh/reference/data-types)) — 分片中副本的编号，从 1 开始。
* `host_name` ([String](/zh/reference/data-types)) — 配置中指定的主机名。
* `host_address` ([String](/zh/reference/data-types)) — 从 DNS 获取的主机 IP 地址。
* `port` ([UInt16](/zh/reference/data-types)) — 用于连接服务器的端口。
* `is_local` ([UInt8](/zh/reference/data-types)) — 用于指示该主机是否为本地主机的标志。
* `user` ([String](/zh/reference/data-types)) — 用于连接服务器的用户名。
* `default_database` ([String](/zh/reference/data-types)) — 默认数据库名称。
* `errors_count` ([UInt32](/zh/reference/data-types)) — 该主机连接副本失败的次数。
* `slowdowns_count` ([UInt32](/zh/reference/data-types)) — 使用对冲请求建立连接时，因连接变慢而切换副本的次数。
* `estimated_recovery_time` ([UInt32](/zh/reference/data-types)) — 距离副本错误计数清零并恢复为正常状态的剩余秒数。
* `database_shard_name` ([String](/zh/reference/data-types)) — `Replicated` 数据库分片的名称 (适用于属于 `Replicated` 数据库的集群) 。
* `database_replica_name` ([String](/zh/reference/data-types)) — `Replicated` 数据库副本的名称 (适用于属于 `Replicated` 数据库的集群) 。
* `is_shared_catalog_cluster` ([UInt8](/zh/reference/data-types)) — 指示该集群是否属于 Shared Catalog 的 Bool 值。
* `is_active` ([Nullable(UInt8)](/zh/reference/data-types)) — `Replicated` 数据库副本的状态 (适用于属于 `Replicated` 数据库的集群) ：1 表示'副本在线'，0 表示'副本离线'，NULL 表示'未知'。
* `unsynced_after_recovery` ([Nullable(UInt8)](/zh/reference/data-types)) — 指示 `Replicated` 数据库副本在创建或恢复后，其复制延迟是否超过 max\_replication\_lag\_to\_enqueue。
* `replication_lag` ([Nullable(UInt32)](/zh/reference/data-types)) — `Replicated` 数据库副本的复制延迟 (适用于属于 `Replicated` 数据库的集群) 。
* `recovery_time` ([Nullable(UInt64)](/zh/reference/data-types)) — `Replicated` 数据库副本的恢复时间 (适用于属于 `Replicated` 数据库的集群) ，单位为毫秒。

<div id="example">
  ## 示例
</div>

```sql title="Query" theme={null}
SELECT * FROM system.clusters LIMIT 2 FORMAT Vertical;
```

```text title="Response" theme={null}
Row 1:
──────
cluster:                 test_cluster_two_shards
shard_num:               1
shard_name:              shard_01
shard_weight:            1
replica_num:             1
host_name:               127.0.0.1
host_address:            127.0.0.1
port:                    9000
is_local:                1
user:                    default
default_database:
errors_count:            0
slowdowns_count:         0
estimated_recovery_time: 0
database_shard_name:
database_replica_name:
is_active:               NULL

Row 2:
──────
cluster:                 test_cluster_two_shards
shard_num:               2
shard_name:              shard_02
shard_weight:            1
replica_num:             1
host_name:               127.0.0.2
host_address:            127.0.0.2
port:                    9000
is_local:                0
user:                    default
default_database:
errors_count:            0
slowdowns_count:         0
estimated_recovery_time: 0
database_shard_name:
database_replica_name:
is_active:               NULL
```

<div id="see-also">
  ## 另请参阅
</div>

* [Distributed 表引擎](/zh/reference/engines/table-engines/special/distributed)
* [distributed\_replica\_error\_cap 设置](/zh/reference/settings/session-settings#distributed_replica_error_cap)
* [distributed\_replica\_error\_half\_life 设置](/zh/reference/settings/session-settings#distributed_replica_error_half_life)
