elasticsearch 状态查看:health为 yellow的解决办法
[elasticsearch@test01 logstash-6.3.1]$ curl 'localhost:9202/_cat/indices?v'
结果:
health | status | index | pri | rep | docs.count | docs.deleted | store.size | pri.store.size |
---|---|---|---|---|---|---|---|---|
yellow | open | .kibana | 1 | 1 | 1 | 0 | 3.1kb | 3.1kb |
yellow | open | info | 5 | 1 | 19485 | 0 | 87.2mb | 87.2mb |
[elasticsearch@test01 config]$ curl -XGET http://localhost:9202/_cluster/health?pretty=true
结果:
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 6,
"active_shards" : 6,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 6,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 50.0
}
使用命令调整
curl -H "Content-Type: application/json" -XPUT 'http://localhost:9202/_settings' -d '
{
"index" : {
"number_of_replicas" : 0
}
}'
更改后,再查询
[elasticsearch@test01 config]$ curl -XGET http://localhost:9202/_cluster/health?pretty=true
结果:
{
"cluster_name" : "elasticsearch",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 6,
"active_shards" : 6,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
[elasticsearch@test01 config]$ curl 'localhost:9202/_cat/indices?v'
health | status | index | pri | rep | docs.count | docs.deleted | store.size | pri.store.size |
---|---|---|---|---|---|---|---|---|
green | open | .kibana | 1 | 0 | 1 | 0 | 3.1kb | 3.1kb |
green | open | info | 5 | 0 | 19485 | 0 | 87.2mb | 87.2mb |
如果
curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/_settings' -d '
{
"index" : {
"number_of_replicas" : 0
}
}'
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}%
就
$ curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/_settings' -d '
{
"index" : {
"blocks": {"read_only_allow_delete": "false"}
}
}
'