指定节点类型 方式
方式一 启动加入 节点类型 参数
./bin/elasticsearch -Enode.attr.box_type=hot
方式二 配置文件 修改 elasticsearch.yml
node.attr.box_type: "type" # type为该node类型 自定义
通过Kibana 配置index属性
1、设置已有的index 到指定node上
PUT /test-index/_settings
{
"settings": {
"index.routing.allocation.require.box_type": "hot",
"index.number_of_replicas": "0"
}
}
2、在模板指定类型
PUT _template/active-logs
{
"template": "active-logs-*",
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1,
"routing.allocation.include.box_type": "hot",
"routing.allocation.total_shards_per_node": 2
},
"aliases": {
"active-logs": {}
}
}
指定索引模板只把新数据放到hot节点上面
PUT /_template/hot_template
{
"template": "*",
"order": 0,
"version": 0,
"settings": {
"index": {
"routing": {
"allocation": {
"require": {
"box_type": "hot"
},
"exclude":{
"box_type": "warm"
}
}
},
"number_of_shards": 3,
"number_of_replicas": 1,
"refresh_interval": "50s"
},
"index.unassigned.node_left.delayed_timeout": "3d"
}
}
网友评论