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参数 , 必须先关闭索引,设置完成后再打开

推荐阅读