Elasticsearch可以動態設定某些屬性,並且可以透過API來進行設定,包括transient和persistent兩種方式,
例如,下面的執行命令:
PUT /_cluster/settings
{
"persistent" : {
"indices.lifecycle.poll_interval":"1s"
},
"transient" : {
"cluster.routing.allocation.disk.watermark.low": "90%",
"cluster.routing.allocation.disk.watermark.high": "95%",
"cluster.info.update.interval": "1m"
}
}
執行輸出結果如圖所示:
同時,在Elasticsearch控制檯,也可以看到相應的輸出資訊, cluster.routing.allocation.disk.watermark 屬性設定發生了更新。
[2021-01-30T12:04:23,399][INFO ][o.e.c.s.ClusterSettings ] [node-1] updating [cluster.routing.allocation.disk.watermark.low] from [85%] to [90%]
[2021-01-30T12:04:23,400][INFO ][o.e.c.s.ClusterSettings ] [node-1] updating [cluster.routing.allocation.disk.watermark.high] from [90%] to [95%]
[2021-01-30T12:04:23,400][INFO ][o.e.c.s.ClusterSettings ] [node-1] updating [cluster.info.update.interval] from [30s] to [1m]
查詢Elasticsearch叢集的設定資訊:
_cluster/settings