排查分片容量健康问题
edit排查分片容量健康问题
editElasticsearch 使用 cluster.max_shards_per_node 和
cluster.max_shards_per_node.frozen 设置来限制每个节点可以持有的最大分片数量。
集群的当前分片容量可以在 健康 API 分片容量部分中找到。
集群接近达到数据节点配置的最大分片数。
edit集群设置 cluster.max_shards_per_node 限制了集群中开放分片的最大数量,仅计算不属于冻结层的节点。
此症状表明应采取行动,否则,创建新索引或升级集群可能会被阻止。
如果你确信你的更改不会使集群不稳定,你可以使用集群更新设置 API暂时增加限制:
使用 Kibana
- 登录到 Elastic Cloud 控制台。
-
在Elasticsearch Service面板上,点击您的部署名称。
如果您的部署名称被禁用,您的 Kibana 实例可能不健康,在这种情况下,请与 Elastic 支持 联系。如果您的部署不包含 Kibana,您需要做的就是 首先启用它。
-
打开您的部署的侧边导航菜单(位于左上角的Elastic标志下方),然后转到开发工具 > 控制台。
-
根据分片容量指示器检查集群的当前状态:
GET _health_report/shards_capacity
响应将会是这样的:
{ "cluster_name": "...", "indicators": { "shards_capacity": { "status": "yellow", "symptom": "集群接近达到数据节点配置的最大分片数量。", "details": { "data": { "max_shards_in_cluster": 1000, "current_used_shards": 988 }, "frozen": { "max_shards_in_cluster": 3000, "current_used_shards": 0 } }, "impacts": [ ... ], "diagnosis": [ ... } } } -
更新
cluster.max_shards_per_node设置为适当的值:PUT _cluster/settings { "persistent" : { "cluster.max_shards_per_node": 1200 } }这种增加应该是暂时的。作为长期解决方案,我们建议您向过度分片的数据层添加节点,或者在不属于冻结层的节点上减少集群的分片数量。
-
要验证更改是否已修复问题,您可以通过检查健康 API的
data部分来获取shards_capacity指标的当前状态:GET _health_report/shards_capacity
响应将会是这样的:
{ "cluster_name": "...", "indicators": { "shards_capacity": { "status": "green", "symptom": "集群有足够的空间添加新分片。", "details": { "data": { "max_shards_in_cluster": 1000 }, "frozen": { "max_shards_in_cluster": 3000 } } } } } -
当长期解决方案到位时,我们建议您重置
cluster.max_shards_per_node限制。PUT _cluster/settings { "persistent" : { "cluster.max_shards_per_node": null } }
根据分片容量指示器检查集群的当前状态:
GET _health_report/shards_capacity
响应将会是这样的:
{
"cluster_name": "...",
"indicators": {
"shards_capacity": {
"status": "yellow",
"symptom": "Cluster is close to reaching the configured maximum number of shards for data nodes.",
"details": {
"data": {
"max_shards_in_cluster": 1000,
"current_used_shards": 988
},
"frozen": {
"max_shards_in_cluster": 3000
}
},
"impacts": [
...
],
"diagnosis": [
...
}
}
}
使用集群设置API,更新cluster.max_shards_per_node设置:
PUT _cluster/settings
{
"persistent" : {
"cluster.max_shards_per_node": 1200
}
}
这种增加应该是暂时的。作为长期解决方案,我们建议您向过度分片的数据层添加节点,或者在不属于冻结层的节点上减少集群的分片数量。要验证更改是否已解决问题,您可以通过检查健康 API的data部分来获取shards_capacity指标的当前状态:
GET _health_report/shards_capacity
响应将会是这样的:
{
"cluster_name": "...",
"indicators": {
"shards_capacity": {
"status": "green",
"symptom": "The cluster has enough room to add new shards.",
"details": {
"data": {
"max_shards_in_cluster": 1200
},
"frozen": {
"max_shards_in_cluster": 3000
}
}
}
}
}
当长期解决方案到位时,我们建议您重置cluster.max_shards_per_node限制。
PUT _cluster/settings
{
"persistent" : {
"cluster.max_shards_per_node": null
}
}
集群接近达到为冻结节点配置的分片最大数量。
edit集群设置 cluster.max_shards_per_node.frozen 限制了集群中开放分片的最大数量,仅计算属于冻结层的数据节点。
此症状表明应采取行动,否则,创建新索引或升级集群可能会被阻止。
如果你确信你的更改不会使集群不稳定,你可以使用集群更新设置 API暂时增加限制:
使用 Kibana
- 登录到 Elastic Cloud 控制台。
-
在Elasticsearch Service面板上,点击您的部署名称。
如果您的部署名称被禁用,您的 Kibana 实例可能不健康,在这种情况下,请与 Elastic 支持 联系。如果您的部署不包含 Kibana,您需要做的就是 首先启用它。
-
打开您的部署的侧边导航菜单(位于左上角的Elastic标志下方),然后转到开发工具 > 控制台。
-
根据分片容量指示器检查集群的当前状态:
GET _health_report/shards_capacity
响应将会是这样的:
-
更新
cluster.max_shards_per_node.frozen设置:PUT _cluster/settings { "persistent" : { "cluster.max_shards_per_node.frozen": 3200 } }这种增加应该是暂时的。作为长期解决方案,我们建议您向过度分片的数据层添加节点,或在属于冻结层的节点上减少集群的分片数量。
-
要验证更改是否已修复问题,您可以通过检查健康 API的
data部分来获取shards_capacity指标的当前状态:GET _health_report/shards_capacity
响应将会是这样的:
{ "cluster_name": "...", "indicators": { "shards_capacity": { "status": "green", "symptom": "集群有足够的空间添加新分片。", "details": { "data": { "max_shards_in_cluster": 1000 }, "frozen": { "max_shards_in_cluster": 3200 } } } } } -
当长期解决方案到位时,我们建议您重置
cluster.max_shards_per_node.frozen限制。PUT _cluster/settings { "persistent" : { "cluster.max_shards_per_node.frozen": null } }
根据分片容量指示器检查集群的当前状态:
GET _health_report/shards_capacity
{
"cluster_name": "...",
"indicators": {
"shards_capacity": {
"status": "yellow",
"symptom": "Cluster is close to reaching the configured maximum number of shards for frozen nodes.",
"details": {
"data": {
"max_shards_in_cluster": 1000
},
"frozen": {
"max_shards_in_cluster": 3000,
"current_used_shards": 2998
}
},
"impacts": [
...
],
"diagnosis": [
...
}
}
}
使用集群设置API,更新cluster.max_shards_per_node.frozen设置:
PUT _cluster/settings
{
"persistent" : {
"cluster.max_shards_per_node.frozen": 3200
}
}
这种增加应该是暂时的。作为长期解决方案,我们建议您向过度分片的数据层添加节点,或者在属于冻结层的节点上减少集群的分片数量。要验证更改是否解决了问题,您可以通过检查健康 API的data部分来获取当前的shards_capacity指标状态:
GET _health_report/shards_capacity
响应将会是这样的:
{
"cluster_name": "...",
"indicators": {
"shards_capacity": {
"status": "green",
"symptom": "The cluster has enough room to add new shards.",
"details": {
"data": {
"max_shards_in_cluster": 1000
},
"frozen": {
"max_shards_in_cluster": 3200
}
}
}
}
}
当长期解决方案到位时,我们建议您重置cluster.max_shards_per_node.frozen限制。
PUT _cluster/settings
{
"persistent" : {
"cluster.max_shards_per_node.frozen": null
}
}