41.为索引设置冷热属性

41.1 为索引设置冷热属性

  • 业务方可以根据实际情况决定索引的冷热属性
    • 对于热数据,索引设置如下
PUT hot_data_index/_settings
{
  "index.routing.allocation.require.temperature": "hot"
}
  • 对于冷数据,索引设置
PUT warm_data_index/_settings
{
  "index.routing.allocation.require.temperature": "warm"
}

41.2 为索引设置冷热属性-验证

  • 创建索引
PUT hot_warm_test_index
{
  "settings": {
  "number_of_replicas": 1,
  "number_of_shards": 3
  } 
}
  • 查看分片分配,可以看到分片均匀分配在五个节点上
GET _cat/shards/hot_warm_test_index?v&h=index,shard,prirep,node&s=node

index shard prirep node
hot_warm_test_index 1 p node1
hot_warm_test_index 0 r node1
hot_warm_test_index 2 r node2
hot_warm_test_index 2 p node3
hot_warm_test_index 1 r node4
hot_warm_test_index 0 p node5
  • 设置索引为热索引
PUT hot_warm_test_index/_settings
{
  "index.routing.allocation.require.temperature": "hot"
}
  • 查看分片分配,发现分片均分配在热节点上
GET _cat/shards/hot_warm_test_index?v&h=index,shard,prirep,node&s=node

index shard prirep node
hot_warm_test_index 1 p node1
hot_warm_test_index 0 r node1
hot_warm_test_index 0 p node2
hot_warm_test_index 2 r node2
hot_warm_test_index 2 p node4
hot_warm_test_index 1 r node4
  • 设置索引为冷索引
PUT hot_warm_test_index/_settings
{
  "index.routing.allocation.require.temperature": "warm"
}
  • 查看分片分配,发现分片均分配到冷节点上
GET _cat/shards/hot_warm_test_index?v&h=index,shard,prirep,node&s=node
index shard prirep node
hot_warm_test_index 1 p node3
hot_warm_test_index 0 r node3
hot_warm_test_index 2 r node3
hot_warm_test_index 0 p node5
hot_warm_test_index 2 p node5
hot_warm_test_index 1 r node5

大数据视频推荐:
腾讯课堂
CSDN
ELK入门精讲
AIOps智能运维实战
ELK7 stack开发运维
大数据语音推荐:
ELK7 stack开发运维
企业级大数据技术应用
大数据机器学习案例之推荐系统
自然语言处理
大数据基础
人工智能:深度学习入门到精通

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容