根据Elasticsearch中文社区《ES冷热分离(读写分离) hot, stale 场景》一篇整理的。
一、冷热分离
- 按《控制Elasticsearch分片和副本的分配》来设置,将hot,stale数据分到不同的集群上去
- hot集群只保留最近一天或两天数据
-
写一个定时任务每天凌晨将前一天的索引标记为stale
PUT /index_name/_settings { "index.routing.allocation.include.zone" : "stale" }
- 1
- 2
- 3
- 4
这样