es数据冷热分离配置
elasticsearch.yaml配置文件添加节点属性
- 热数据节点
node.attr.group: hot
- 冷数据节点
node.attr.group: cold
配置mapping数据模板写入节点
post /_template/logstash
{
"order": 0,
"template": "logstash*",
"settings": {
"index.routing.allocation.include.group": "hot",
"index.refresh_interval": "10s",
"index.number_of_replicas": "1",
"index.number_of_shards": "1"
}
}
- 主要是
"index.routing.allocation.include.group": "hot",
这一行,其他更具情况自行配置
定时迁移数据至冷数据节点
put logstash-2018.07.23/_settings
{
"index.routing.allocation.include.group": "cold"
}
-
number_of_replicas 是数据备份数,如果只有一台机器,设置为0
-
number_of_shards 是数据分片数,默认为5
-
number_of_shards不可以在线改