調用 elasticsearch 打開和關閉索引接口 返回 503
一、操作內容
curl --user 123:456 -s -XPOST http://127.0.0.1:9200/jy-123-server_3_2b9ec95-21020-2021.02.27/_open
二、錯誤信息
接口返回的錯誤信息
{"error":{"root_cause":[{"type":"process_cluster_event_timeout_exception","reason":"failed to process cluster event (update-settings) within 30s"}],"type":"process_cluster_event_timeout_exception","reason":"failed to process cluster event (update-settings) within 30s"},"status":503}
elasticsearch
錯誤日誌
[2021-03-02T16:15:17,382][DEBUG][o.e.a.b.TransportShardBulkAction] [jy-123-server_3_2b9ec95-21020-2021.02.27][0] failed to execute bulk item (index) BulkShardRequest [[jy-gateway-server-inner_1_release1-2021.02.28][0]] containing [index {[jy-123-server_3_2b9ec95-21020-2021.02.27][doc][V1sA8ncBW_IbLluGsND1], source[n/a, actual length: [14.3kb], max length: 2kb]}]
org.elasticsearch.ElasticsearchTimeoutException: Failed to acknowledge mapping update within [30s]
三、問題解決
https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html
默認超時時間是 30s , 我們可以設置我們的集羣時間爲 5m.
增大超時時間 ?master_timeout=5m
curl --user 123:456 -s -XPOST http://127.0.0.1:9200/jy-123-server_3_2b9ec95-21020-2021.02.27/_open?master_timeout=5m