ES集群檢查常用命令( 二 )

5.設置索引副本:
curl -XPUT 'http://ip:port/my_index/_settings?pretty' -H 'Content-Type: application/json' -d'{"number_of_replicas" : 1}'6.執行refresh,將內存數據刷新到磁盤緩存
curl -XPOST 'http://ip:port/myindex/_refresh'7.執行flush,將磁盤緩存刷新到文件系統
curl -XPOST 'https://ip:port/myindex/_flush'8.執行synced flush,生成syncid
curl -XPOST'http://ip:port/_flush/synced'

  1. 強制執行段合并
curl -XPOST 'http://ip:httpport/myindex/_forcemerge?only_expunge_deletes=false&max_num_segments=1&flush=true&pretty'10.設置索引在每個esnode上的分片個數
curl -XPUT 'http://ip:httpport/myindex/_settings?pretty' -H 'Content-Type: application/json' -d'{"index.routing.allocation.total_shards_per_node" : "2"}'
  1. 配置控制段合并的refresh、merge線程數等
curl -XPUT"http://ip:port/my_index/_settings?pretty" -H 'Content-Type: application/json' -d'{"refresh_interval": "60s","merge":{"scheduler":{"max_merge_count" : "100","max_thread_count" : "1"},"policy":{"segments_per_tier" : "100","floor_segment" : "1m","max_merged_segment" : "2g"}}}'12.設置索引的刷新時間和translog配置參數
注意:設置translog參數 , 必須先關閉索引,設置完成后再打開

推薦閱讀