美文网首页ELK
41.为索引设置冷热属性

41.为索引设置冷热属性

作者: 大勇任卷舒 | 来源:发表于2022-07-01 14:48 被阅读0次

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开发运维
企业级大数据技术应用
大数据机器学习案例之推荐系统
自然语言处理
大数据基础
人工智能:深度学习入门到精通

相关文章

网友评论

    本文标题:41.为索引设置冷热属性

    本文链接:https://www.haomeiwen.com/subject/uryavrtx.html