> For the complete documentation index, see [llms.txt](https://documentation.alluxio.io/ee-ai-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.alluxio.io/ee-ai-cn/administration/managing-worker.md).

# Worker 配置

本指南涵盖 Alluxio 单个 Worker 的配置：存储后端、容量规划、资源限制、JVM 调优和网络绑定。关于集群级别的操作以及哈希环相关的 Worker 生命周期操作（添加、移除、重启和身份持久化），请参阅[集群与成员管理](https://documentation.alluxio.io/ee-ai-cn/administration/managing-alluxio.md)。

## 1. Worker 存储

每个 Worker 将缓存数据保存在本地的 [page store](https://documentation.alluxio.io/pages/uw7Vlrzw6022oCfnpoka#id-5.-worker-cun-chu-page-store) 中。本节介绍存储后端选型、容量规划和磁盘布局。

### 配置 Page Store 位置

{% tabs %}
{% tab title="Kubernetes (Operator)" %}
Operator 支持两种 page store 后端。

**默认（hostPath）：** Worker 将缓存写入节点文件系统的 `/mnt/alluxio/pagestore`。

```yaml
spec:
  worker:
    pagestore:
      # 默认 hostPath: /mnt/alluxio/pagestore，指向节点的本地文件系统
      size: 100Gi
      reservedSize: 10Gi
```

**PVC 方式：** 若需 Worker 缓存跨 pod 重启或重调度后仍然保留，为 page store 指定一个 PersistentVolumeClaim (PVC)。

```yaml
spec:
  worker:
    pagestore:
      type: persistentVolumeClaim
      storageClass: ""    # 默认为 "standard"；空字符串表示静态绑定
      size: 100Gi
      reservedSize: 10Gi
```

{% endtab %}

{% tab title="Docker / Bare-Metal" %}
通过 Alluxio 属性设置 page store 目录和大小。Docker 部署通过 `ALLUXIO_JAVA_OPTS` 传入，并把宿主机目录作为 volume 挂载，使缓存在容器重建后仍然保留：

```shell
docker run ... \
  -v /data/alluxio-cache:/data/alluxio-cache \
  -e ALLUXIO_JAVA_OPTS=" \
    -Dalluxio.worker.page.store.dirs=/data/alluxio-cache \
    -Dalluxio.worker.page.store.sizes=<CACHE_SIZE>" \
  alluxio/alluxio-enterprise worker
```

裸机部署在 `conf/alluxio-site.properties` 里设置同样的属性：

```properties
alluxio.worker.page.store.dirs=/data/alluxio-cache
alluxio.worker.page.store.sizes=<CACHE_SIZE>
```

{% endtab %}
{% endtabs %}

#### 检查磁盘布局

部署前请完成这两项检查。它们可以限制磁盘故障的影响。

* **让 metastore 使用独立的文件系统。** metastore 目录是 `alluxio.dora.worker.metastore.rocksdb.dir`（默认 `${alluxio.work.dir}/metastore`）。metastore 磁盘故障会让 Worker 停止。如果 metastore 与某个 page store 目录共用一个文件系统，page store 磁盘故障也会让 Worker 停止。
* **不要把 page store 放在根文件系统上。** 如果数据卷没有挂载，路径就落在系统盘上。如果这块盘大于配置的缓存，Worker 无法发现这个问题。缓存随后会写满系统盘。

要检查这两项，请在每个 Worker 节点上运行以下命令。在 Kubernetes 上，要在节点上运行，而不是在 Pod 中运行。

```shell
df --output=source,target /
df --output=source,target <metastore-dir>
df --output=source,target <each page store dir>
# Expected: the metastore source is different from each page store source,
# and no page store source is the same as the source of /
```

### Page Store 容量规划

* `size`：单个 Worker 的缓存容量。不得超过 Worker 节点上的可用磁盘。
* `reservedSize`：为内部操作预留的空间（临时 page 写入、元数据缓存）。设为 `size` 的 10% 左右，通常 10–100 GiB。
* 确保 `size + reservedSize ≤ 可用磁盘空间`。

云厂商宣传的磁盘大小是 GB（十进制），而 Kubernetes 的 `Gi` 是二进制 GiB。标称 "1000 GB" 的 EBS 卷实际可用约 931 GiB。将 `size` 设为实际可用空间（`df -h <page-store-path>` 查看）的 \~90%，为文件系统开销和 `reservedSize` 留出余量。`size` 过大会导致 Worker 启动失败：`quota (NNN) exceeds the total disk space`。

### 多盘配置

对于有多块数据盘的节点，将 page store 配置为跨所有磁盘——这样可以将 page I/O 分摊到多块盘，提升总吞吐。使用逗号分隔的路径和大小：

```yaml
spec:
  worker:
    pagestore:
      hostPath: /mnt/disk1/alluxio/pagestore,/mnt/disk2/alluxio/pagestore
      size: 800Gi,800Gi
      reservedSize: 100Gi
```

每个目录必须对应一块独立的物理盘——多个 page store 目录位于同一块盘上不会带来收益。

另一种方式是在操作系统层用 RAID 0 将多块盘组成一个逻辑卷，然后只配置单个 `hostPath`。这种方式 Alluxio 配置更简单，但绑定了所有磁盘的生命周期——任意一块盘坏掉整个阵列都会丢失。

每块磁盘一个目录时，一块磁盘故障只影响它自己的目录。[磁盘健康检查](https://documentation.alluxio.io/ee-ai-cn/administration/disk-health.md)会停用该目录，Worker 使用其他目录。

### 异构 Worker

本节所述的 `workerGroups` 机制仅适用于 Kubernetes Operator。在 Docker 或裸机部署中，异构 Worker 通过为每个 Worker 单独配置 `alluxio-site.properties`（指定该节点的 page store 路径和大小）实现。

当集群中的 Worker 磁盘规格不同（例如一组有单块 1 TB 盘，另一组有两块 800 GB 盘），使用 `workerGroups` 为每组定义不同的配置。

**步骤 1：分组并标记节点：**

```shell
# 标记单盘节点
kubectl label nodes <node-name> apps.alluxio.com/disks=1
# 标记双盘节点
kubectl label nodes <node-name> apps.alluxio.com/disks=2
```

**步骤 2：定义 worker groups 并启用容量感知哈希环。**

对于异构集群，应同时将 `alluxio.user.worker.selection.policy.consistent.hash.provider.impl` 设置为 `CAPACITY`，这样存储容量更大的 Worker 会分到相应更大比例的数据。关于该属性的详细说明，参见 [针对异构 Worker 进行优化](https://documentation.alluxio.io/ee-ai-cn/administration/managing-alluxio.md#zhen-dui-yi-gou-worker-jin-xing-you-hua)。

```yaml
apiVersion: k8s-operator.alluxio.com/v1
kind: AlluxioCluster
spec:
  properties:
    alluxio.user.worker.selection.policy.consistent.hash.provider.impl: CAPACITY

  # 所有 worker 的通用配置
  worker:
    resources:
      limits:
        memory: 40Gi
      requests:
        memory: 36Gi
    jvmOptions: ["-Xmx20g", "-Xms20g", "-XX:MaxDirectMemorySize=16g"]

  # 为每组 worker 定义独立配置
  workerGroups:
  - worker:
      count: 10
      nodeSelector:
        apps.alluxio.com/disks: 1
      pagestore:
        hostPath: /mnt/disk1/alluxio/pagestore
        size: 1Ti
        reservedSize: 100Gi
  - worker:
      count: 12
      nodeSelector:
        apps.alluxio.com/disks: 2
      pagestore:
        hostPath: /mnt/disk1/alluxio/pagestore,/mnt/disk2/alluxio/pagestore
        size: 800Gi,800Gi
        reservedSize: 100Gi
```

{% hint style="info" %}
虽然这提供了灵活性，但确保每个 worker group 内部配置一致至关重要。配置错误可能导致意料之外的错误。
{% endhint %}

## 2. 资源与 JVM 调优

{% tabs %}
{% tab title="Kubernetes (Operator)" %}
在 `alluxio-cluster.yaml` 中按组件配置资源限制和 JVM 选项：

```yaml
apiVersion: k8s-operator.alluxio.com/v1
kind: AlluxioCluster
spec:
  worker:
    count: 2
    resources:
      # 生产环境 Worker 建议将 requests 设为与 limits 相同，使 Pod 进入
      # Guaranteed QoS 级别，在节点资源紧张时被驱逐的优先级最低。
      limits:
        cpu: "12"
        memory: "36Gi"
      requests:
        cpu: "12"
        memory: "36Gi"
    jvmOptions:
      - "-Xmx22g"
      - "-Xms22g"
      - "-XX:MaxDirectMemorySize=10g"
  coordinator:
    resources:
      # Coordinator 也建议进入 Guaranteed QoS 级别——将 requests 设为与 limits 相同。
      limits:
        cpu: "12"
        memory: "36Gi"
      requests:
        cpu: "12"
        memory: "36Gi"
    jvmOptions:
      - "-Xmx4g"
      - "-Xms1g"
```

{% endtab %}

{% tab title="Docker / Bare-Metal" %}
Docker 部署通过 `ALLUXIO_JAVA_OPTS` 设置 JVM 选项，通过 `--memory` 和 `--cpus` 设置容器资源上限：

```shell
docker run ... \
  --memory=36g \
  --cpus=12 \
  -e ALLUXIO_JAVA_OPTS=" \
    -Xmx22g -Xms22g -XX:MaxDirectMemorySize=10g" \
  alluxio/alluxio-enterprise worker
```

裸机部署在 `conf/alluxio-env.sh` 中设置 JVM 选项：

```shell
ALLUXIO_WORKER_JAVA_OPTS+=" -Xmx22g -Xms22g -XX:MaxDirectMemorySize=10g"
ALLUXIO_COORDINATOR_JAVA_OPTS+=" -Xmx4g -Xms1g"
```

{% endtab %}
{% endtabs %}

### 内存限制公式

```
memory limit ≥ -Xmx + -XX:MaxDirectMemorySize + 2–4 GiB (JVM 开销)
```

上面 worker 示例（`-Xmx22g`、`-XX:MaxDirectMemorySize=10g`）：最小内存为 22 + 10 + 2 = 34 GiB，示例中设为 36 GiB。

{% hint style="info" %}
若省略 `-XX:MaxDirectMemorySize`，JVM 默认将其设为与 `-Xmx` 相同的值，因此容器内存限制通常需要 2.5 倍 `-Xmx` 或更多。
{% endhint %}

### 诊断 OOM

若 Worker 被 OOM 杀死（退出码 137），使用下列命令确认原因。

{% tabs %}
{% tab title="Kubernetes (Operator)" %}

```shell
# 查看 pod 事件
kubectl describe pod <worker-pod-name> -n alx-ns
# 查找 "OOMKilled" 或 "Exit Code: 137"

# 查看前一次容器崩溃前的日志
kubectl logs <worker-pod-name> -n alx-ns --previous | tail -50
# 查找 "OutOfMemoryError" 或 "java.lang.OutOfMemoryError"
```

{% endtab %}

{% tab title="Docker / Bare-Metal" %}

```shell
# Docker：查看已退出容器的状态
docker inspect <container-id> --format='{{.State.OOMKilled}} {{.State.ExitCode}}'
# "true 137" 表示被 OOM 杀掉

# 查看 worker 日志中的 OutOfMemoryError
tail -100 /opt/alluxio/logs/worker.log | grep -i OutOfMemoryError
```

{% endtab %}
{% endtabs %}

| 症状                                                 | 根因                              | 修复                                       |
| -------------------------------------------------- | ------------------------------- | ---------------------------------------- |
| `Exit Code 137`，无 Java 报错                          | 容器超过内存限制——被 Linux OOM killer 杀掉 | 增大 `resources.limits.memory`             |
| `java.lang.OutOfMemoryError: Java heap space`      | `-Xmx` 偏小                       | 增大 `-Xmx` 并相应提高容器内存上限                    |
| `java.lang.OutOfMemoryError: Direct buffer memory` | `-XX:MaxDirectMemorySize` 偏小    | 增大 `-XX:MaxDirectMemorySize` 并相应提高容器内存上限 |

### 诊断卡顿

若其他节点记录到某个 worker 的 redirect 或连接超时、读请求回退到 UFS，而该 worker Pod 一直 `READY`，很可能是 worker JVM 每次停顿数秒：要么在做垃圾回收（GC），要么停在 safepoint（JVM 为执行某些内部操作而暂停所有 Java 线程的位置）。在调整网络之前先确认这一点：节点上 TCP 监听队列丢包增多是停顿的结果，而不是原因。

**1. 确认停顿。** Worker 会把每次超过 1 秒的停顿记录为 `JVM paused <N>ms`（超过 10 秒时为 WARN 级别）。下一行说明停顿期间是否发生了 GC：

```shell
# Kubernetes
kubectl logs <worker-pod-name> -n alx-ns | grep -A1 "JVM paused"
# Docker / bare-metal
grep -A1 "JVM paused" /opt/alluxio/logs/worker.log
```

`GC list:` 表示停顿期间发生了 GC；`No GCs detected` 表示 JVM 因其他原因停顿。单看 GC 指标无法区分这两种情况，因为 GC 指标不统计非 GC 的停顿。

**2. 收集 GC 和 safepoint 日志**，持续几个小时：采集时间太短可能会指向错误的原因。在 worker JVM 选项中加入该参数，下次重启后生效：

{% tabs %}
{% tab title="Kubernetes (Operator)" %}

```yaml
spec:
  worker:
    jvmOptions:
      # jvmOptions 会替换默认列表：保留已有的堆内存、直接内存等参数
      - "-Xlog:gc*,safepoint:file=/opt/alluxio/logs/gc.log:time,uptime:filecount=5,filesize=50M"
```

{% endtab %}

{% tab title="Docker / Bare-Metal" %}

```shell
# conf/alluxio-env.sh；Docker 上把该参数追加到 ALLUXIO_JAVA_OPTS
ALLUXIO_WORKER_JAVA_OPTS+=" -Xlog:gc*,safepoint:file=/opt/alluxio/logs/gc.log:time,uptime:filecount=5,filesize=50M"
```

{% endtab %}
{% endtabs %}

也可以在运行中的 worker 上直接打开同样的日志，无需重启。该设置在 worker 重启后失效。

```shell
# Kubernetes：进入 worker 容器
kubectl exec -it <worker-pod-name> -n alx-ns -- bash
# 找到 worker JVM 的进程号：以 alluxio.worker.AlluxioWorker 结尾的那一行
jcmd -l
jcmd <pid> VM.log output="file=/opt/alluxio/logs/gc.log" output_options="filecount=5,filesize=50M" what="gc*,safepoint" decorators="time,uptime"
```

在 Kubernetes 上，几个小时后用 `kubectl cp alx-ns/<worker-pod-name>:/opt/alluxio/logs/gc.log gc.log` 把日志拷出来。

**3. 根据日志找到原因。** 每次 GC 是一组 `GC(<n>)` 编号相同的行：停顿及其总耗时、各阶段耗时、线程消耗的 CPU 时间。每个 safepoint 是一行 `Safepoint`，时间单位为纳秒。卡顿时的日志类似：

```
GC(189) Pause Young (Normal) (G1 Evacuation Pause) 21G->13G(36G) 7040.519ms
GC(189)   Pre Evacuate Collection Set: 6998.1ms
GC(189)   Evacuate Collection Set: 36.2ms
GC(189) User=0.67s Sys=0.01s Real=7.04s
Safepoint "Cleanup", Time since last: 1000120313 ns, Reaching safepoint: 4812339871 ns, At safepoint: 25163042 ns, Total: 4837502913 ns
```

这里一次 7 秒的 young GC 几乎全部时间都花在 `Pre Evacuate Collection Set`，一次 `Cleanup` safepoint 用了 4.8 秒才到达。先看与第 1 步结果对应的行。

| 第 1 步显示                       | GC 和 safepoint 日志中的症状                                                                            | 根因                                                                  | 修复                                             |
| ----------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- | ---------------------------------------------- |
| `GC list`                     | 出现 `Pause Full` 或 `To-space exhausted`，或 `Pause Young` 很长且大部分时间在 `Evacuate Collection Set`       | 堆内存装不下存活数据                                                          | 增大 `-Xmx` 并相应提高容器内存上限                          |
| `GC list`                     | GC 停顿很长，但其中 `User` CPU 时间远小于 `Real`                                                              | 容器的 CPU 上限让 GC 线程拿不到 CPU（cgroup 的 `cpu.stat` 中 `nr_throttled` 持续增长） | 提高 CPU 上限                                      |
| `GC list` 或 `No GCs detected` | `Pause Young` 很长且大部分时间在 `Pre Evacuate Collection Set`，或 `Safepoint` 行的 `Reaching safepoint` 达到秒级 | 写 JVM mmap 文件 `/tmp/hsperfdata_<user>/<pid>` 的线程卡在容器的脏页上限上          | 在 worker JVM 选项中加入 `-XX:+PerfDisableSharedMem` |
| `No GCs detected`             | 每次抓取指标都出现数秒的 `Safepoint "FindDeadlocks"` 行                                                       | 设置了 `alluxio.metrics.jvm.deadlock.detection.enabled=true`           | 保持该属性的默认值 `false`                              |

对于 hsperfdata 这种情况，脏页上限即节点的 `vm.dirty_bytes` 或 `vm.dirty_ratio`，按各容器的 memory cgroup 等比缩小；设成绝对值的 `vm.dirty_bytes` 可能只给容器留下几 MB。要确认，查看 worker cgroup 的 `memory.stat` 中 `file_dirty` 是否一直贴近这个上限。

{% hint style="info" %}
设置 `-XX:+PerfDisableSharedMem` 后，`jps`、`jstat` 和 `jcmd -l` 将不再列出 worker JVM，但 `jcmd <pid>` 仍然可用。
{% endhint %}

## 3. Worker 网络配置

### 将 Worker 绑定到指定网卡

将 Worker 绑定到指定的本地网卡（假设网卡名为 `NIC1`），需要分别为各服务设置 bind device：

```properties
alluxio.worker.rpc.bind.device=NIC1
alluxio.worker.web.bind.device=NIC1
alluxio.worker.data.bind.device=NIC1
```

## 4. 客户端与 Worker 超时

FUSE 等客户端的每次读取、写入和元数据调用都要等待 Worker 响应。一组超时决定了客户端在慢速或不可达的 Worker 上等待多久后让操作失败，以便客户端重试、从其他副本读取或[回退到 UFS](https://documentation.alluxio.io/ee-ai-cn/high-availability/ufs-fallback.md)。Coordinator 调用 Worker 时（例如分发加载任务）也使用这些超时。

这些超时作为一个策略 `ClientWorkerConnectivityPolicyEntity` 在集群范围内保存。所有客户端和服务端进程读取同一个策略，可以在运行中的集群上修改，无需重启任何进程。

该策略与其他[动态配置](https://documentation.alluxio.io/ee-ai-cn/administration/dynamic-configuration.md#qian-ti-tiao-jian)一样保存在 etcd 中。通过 Kubernetes Operator 部署的集群已满足此条件。未配置 etcd 的进程改用自己的属性，参见[与旧属性的关系](#yu-jiu-shu-xing-de-guan-xi)。客户端超时之后的处理方式参见 [UFS 回退](https://documentation.alluxio.io/ee-ai-cn/high-availability/ufs-fallback.md) 和 [数据多副本](https://documentation.alluxio.io/ee-ai-cn/high-availability/multiple-replicas.md)；其他无需重启即可修改的配置参见[动态配置](https://documentation.alluxio.io/ee-ai-cn/administration/dynamic-configuration.md)。

### 何时调整

#### Worker 停止响应时读取挂起

降低 `readSilenceTimeoutMs`（默认 `10000`）。Worker 在这段时间内没有发送任何内容时，读取失败。值过低会让繁忙但健康的 Worker 上的读取失败。

#### Worker 正常但长时间读取失败

仍在准备数据的 Worker（例如从慢速 UFS 读取大范围数据）可能沉默超过 `readSilenceTimeoutMs`。开启读心跳：将 `heartbeatEnabled` 设为 `true`，并将 `readDataProgressTimeoutMs` 设为读取在收不到数据时最多可等待的时间，例如 `120000`。此后 Worker 在工作期间每隔 `readSilenceTimeoutMs` 的四分之一（至少每 100 ms）发送一次心跳，沉默但繁忙的 Worker 不再导致读取失败。两个字段都设置后才会启用心跳。

#### 客户端很久才发现 Worker 的增减

降低 `workerListRefreshIntervalMs`（默认 `45000`）。客户端按此间隔从 etcd 刷新 Worker 列表。值越低，对拓扑变化的反应越快，etcd 读压力也越大。另见[集群与成员管理](https://documentation.alluxio.io/ee-ai-cn/administration/managing-alluxio.md#ke-hu-duan-worker-lie-biao-shua-xin)。

#### 连接不可达的 Worker 耗时过长

降低 `workerConnectTimeoutMs`（默认 `3000`）。它限制建立到 Worker 的新连接所需的时间，元数据和数据连接都适用。

#### 大型扫描、预加载或加载作业超时

调高失败调用对应的超时：

* `slowRpcTimeoutMs`（默认 `120000`）：耗时较长的 Worker 调用，例如将数据预加载到缓存、批量查询缓存状态和缓存扫描。
* `loadTaskResponseTimeoutMs`（默认 `1800000`）：Coordinator 等待 Worker 回复已分发加载任务的时间。`0` 表示不限制。
* `streamRpcTimeoutMs`（默认 `900000`）和 `rebalanceRpcTimeoutMs`（默认 `14400000`）：从 Worker 下载文件，以及[缓存再平衡](https://documentation.alluxio.io/ee-ai-cn/cache/cache-rebalancing.md)传输。

#### Worker 停止响应时写入挂起

降低 `writeSilenceTimeoutMs`（Worker 在这段时间内没有回复时写入失败）或 `writerCloseTimeoutMs`（关闭文件时等待 Worker 的时间）。这两个字段为 `0` 时，使用[与旧属性的关系](#yu-jiu-shu-xing-de-guan-xi)中列出的旧属性。

### 字段

所有值的单位都是毫秒。

| 字段                            | 默认值        | 控制内容                      | 生效时机     |
| ----------------------------- | ---------- | ------------------------- | -------- |
| `readSilenceTimeoutMs`        | `10000`    | 读取等待 Worker 任何响应的最长时间     | 修改后开始的读取 |
| `heartbeatEnabled`            | `false`    | 读取较慢时 Worker 发送心跳         | 修改后开始的读取 |
| `readDataProgressTimeoutMs`   | `0`（关闭）    | 开启心跳时，读取等待数据的最长时间         | 修改后开始的读取 |
| `writeSilenceTimeoutMs`       | `0`（继承）    | 写入等待 Worker 回复的最长时间       | 修改后开始的写入 |
| `writerCloseTimeoutMs`        | `0`（继承）    | 关闭写入时等待的最长时间              | 修改后开始的写入 |
| `writerPacketsInFlight`       | `0`（继承）    | 每个写入未确认的数据包数量             | 修改后开始的写入 |
| `workerConnectTimeoutMs`      | `3000`     | 建立到 Worker 的连接            | 新建立的连接   |
| `getStatusRpcTimeoutMs`       | `3000`     | 对 Worker 的文件状态调用          | 下一次调用    |
| `lightWeightRpcTimeoutMs`     | `500`      | 对 Worker 的版本检查            | 下一次调用    |
| `defaultRpcTimeoutMs`         | `10000`    | 对 Worker 的其他元数据调用         | 下一次调用    |
| `slowRpcTimeoutMs`            | `120000`   | 耗时较长的 Worker 调用，如预加载和缓存扫描 | 下一次调用    |
| `streamRpcTimeoutMs`          | `900000`   | 从 Worker 下载文件             | 下一次调用    |
| `rebalanceRpcTimeoutMs`       | `14400000` | 缓存再平衡传输                   | 下一次调用    |
| `loadTaskResponseTimeoutMs`   | `1800000`  | Worker 对已分发加载任务的回复        | 下一次分发    |
| `workerListRefreshIntervalMs` | `45000`    | 客户端刷新 Worker 列表的间隔        | 下一次刷新    |

### 查看和修改策略

读取集群当前使用的策略：

```shell
curl -sS 'http://<COORDINATOR_HOST>:19999/api/v1/conf?key=ClientWorkerConnectivityPolicyEntity'
# Expected: a JSON document with the fields above
# If HTTP 404 "Configuration not found": no process has started with etcd yet; start from the defaults below
```

保存包含修改的完整策略。文档中缺少的字段会被设为默认值，而不是保留原值，因此请以刚读取的文档为基础。下面的示例将读取静默超时降为 5 秒，其他字段保持默认值：

```shell
curl -sS 'http://<COORDINATOR_HOST>:19999/api/v1/conf' -X PUT \
  -H 'Content-Type: application/json' \
  --data '{"key": "ClientWorkerConnectivityPolicyEntity", "conf": {
    "readSilenceTimeoutMs": 5000, "heartbeatEnabled": false, "readDataProgressTimeoutMs": 0,
    "writeSilenceTimeoutMs": 0, "writerCloseTimeoutMs": 0, "writerPacketsInFlight": 0,
    "workerConnectTimeoutMs": 3000, "getStatusRpcTimeoutMs": 3000, "lightWeightRpcTimeoutMs": 500,
    "defaultRpcTimeoutMs": 10000, "slowRpcTimeoutMs": 120000, "streamRpcTimeoutMs": 900000,
    "rebalanceRpcTimeoutMs": 14400000, "loadTaskResponseTimeoutMs": 1800000,
    "workerListRefreshIntervalMs": 45000}}'
# Expected: {"status":"ok"}
```

也可以运行 `alluxio conf edit --config ClientWorkerConnectivityPolicyEntity` 在编辑器中修改已保存的策略（在 Kubernetes 上需在 Coordinator pod 内运行），参见[修改属性](https://documentation.alluxio.io/ee-ai-cn/administration/dynamic-configuration.md#tong-guo-cli)。

运行中的进程会在约 10 秒内应用新策略。与属性不同，该策略不会记录 `Dynamic property … changed` 日志，请等待约 20 秒后再检查新行为。已在进行的操作保留开始时的值。

### 与旧属性的关系

早期版本通过属性设置这些超时。这些属性仍然存在，但只用于创建策略：第一个配置了 etcd 并发现尚未保存策略的 Alluxio 进程，会根据自己的这些属性值创建策略。此后所有进程都使用已保存的策略，**修改这些属性不再有任何效果**。请改为修改策略。

| 字段                            | 初始值来源                                              |
| ----------------------------- | -------------------------------------------------- |
| `readSilenceTimeoutMs`        | `alluxio.user.network.netty.timeout`               |
| `getStatusRpcTimeoutMs`       | `alluxio.user.client.get.status.timeout`           |
| `lightWeightRpcTimeoutMs`     | `alluxio.user.client.light.weight.rpc.timeout`     |
| `slowRpcTimeoutMs`            | `alluxio.user.client.slow.rpc.timeout`             |
| `streamRpcTimeoutMs`          | `alluxio.user.client.stream.rpc.timeout`           |
| `rebalanceRpcTimeoutMs`       | `alluxio.user.client.rebalance.rpc.timeout`        |
| `defaultRpcTimeoutMs`         | `alluxio.user.rpc.retry.max.duration`              |
| `workerListRefreshIntervalMs` | `alluxio.user.worker.list.refresh.interval`        |
| `workerConnectTimeoutMs`      | `alluxio.user.network.netty.connect.timeout`（如已设置） |
| `loadTaskResponseTimeoutMs`   | `alluxio.master.dora.load.task.response.timeout`   |

三个写入字段的规则不同：写入字段为 `0` 时，每个客户端在开始写入时读取对应的属性。`writeSilenceTimeoutMs` 使用 `alluxio.user.network.netty.timeout`，`writerCloseTimeoutMs` 使用 `alluxio.user.network.netty.writer.close.timeout`，`writerPacketsInFlight` 使用 `alluxio.user.network.netty.writer.buffer.size.packets`。早期版本保存的策略没有写入字段，因此升级后写入行为保持不变。

未配置 etcd 的进程不保存任何内容，使用根据自己的属性构建的策略。
