首页/数据/NoSQL 速查/集群级设置 _cluster/settings
Elasticsearch89 条

集群级设置 _cluster/settings

集群设置分持久化与临时两类,影响分片分配、磁盘水位、快照与恢复速率等;8.x 已移除 transient 设置,统一写 persistent。

NoSQL 速查数据更新于 2026-10-12
接口PUT /_cluster/settings
常用项cluster.routing.allocation.enable、cluster.routing.allocation.disk.threshold_enabled、cluster.routing.allocation.exclude._name、indices.recovery.max_bytes_per_sec
清理方式把值设为 null 恢复默认

示例

示例
PUT /_cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": "all",
    "indices.recovery.max_bytes_per_sec": "200mb"
  }
}

GET /_cluster/settings?include_defaults=true&flat_settings=true
维护/重启大节点前把 allocation.enable 设为 none 暂停分片移动,恢复后再设回 all,可减少无谓的重新分配。

易错点

  • transient 设置在 8.x 会直接报错,旧脚本升级时需要改为 persistent
  • 用 _name 做分配排除时改节点名会导致规则失配,建议用 _ip 或按角色维护节点属性

数据来源与参考

  • Elasticsearch Guide: Cluster update settings API
​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌