正在加载

Universal Profiling 索引生命周期管理

Elastic Stack

索引生命周期策略允许您自动管理 profiling 索引的生命周期,因为它们会随着增长而老化。 应用默认策略,但您可以根据您的业务需求自定义它。

默认的 Universal Profiling 索引生命周期策略包括以下滚动更新和删除定义

  • 滚动更新:滚动更新可防止单个索引变得过大,并优化索引和搜索性能。 达到年龄或大小度量阈值后,将创建一个新索引,并且所有后续更新都将写入新索引。
  • 删除:删除阶段会在达到时间阈值后永久删除索引。

下表列出了滚动更新和删除的默认阈值

滚动更新 温数据层 删除
30 天后或 50 GB 30 天后 60 天后
注意

滚动更新条件会阻止阶段转换,这意味着索引在热数据层滚动更新之后保留 30 天。

要在 Kibana 中查看 Universal Profiling 索引生命周期策略,请导航至 Stack ManagementIndex Lifecycle Management,然后搜索 profiling

提示

默认的 ILM 策略可能会在次要版本之间发生更改。 这不被认为是重大更改,因为索引管理应不断改进并适应新功能。

完成以下步骤来配置自定义索引生命周期策略。

  1. 要打开 索引生命周期策略,请在主菜单中找到 Stack Management,或使用全局搜索字段
  2. 单击 创建策略
  3. 命名您的新策略,例如 custom-profiling-policy
  4. 根据您的喜好自定义策略。
  5. 单击 保存策略
提示

请参阅管理索引生命周期以了解有关 ILM 策略的更多信息。

要为 Universal Profiling 应用新的索引生命周期策略,请创建一个名为 profiling-ilm@custom 的新组件模板。

注意

要应用自定义 ILM 策略,您必须将组件模板命名为 profiling-ilm@custom。 不支持其他名称。

  1. 索引管理 页面中,选择 组件模板 选项卡,然后单击 创建组件模板

  2. 输入 profiling-ilm@custom 作为名称,然后单击 下一步

  3. 索引设置 中,设置在上一步中创建的 ILM 策略名称

    {
      "lifecycle": {
        "name": "custom-profiling-policy"
      }
    }
    
  4. 继续到 查看 步骤,然后选择 请求 选项卡。 您的请求应类似于下图。

    如果是这样,请单击 创建组件模板

    Create component template

确认 Universal Profiling 现在正在使用新的索引模板和 ILM 策略

  1. 通过在全局搜索字段中找到 Dev Tools 来打开 控制台

  2. 运行以下命令

    GET _ilm/policy/custom-profiling-policy
    
    1. 步骤 1中选择的自定义 ILM 策略的名称。

如果已应用自定义策略,则结果应包括以下内容

{
    "in_use_by": {
      "indices": [
        ...
      ],
      "data_streams": [
        ...
        "profiling-events-all",
        ...
      ],
      "composable_templates": [
        "profiling-stackframes",
        "profiling-symbols-global",
        "profiling-metrics",
        "profiling-stacktraces",
        "profiling-executables",
        "profiling-hosts",
        "profiling-events"
      ]
    }
}

如果结果为空,则自定义 ILM 策略尚未在使用中。 新的 ILM 策略仅在新索引创建时生效,因此请等待滚动更新发生(通常在 30 天后或索引大小达到 50 GB 时),或者使用Elasticsearch 滚动更新 API强制进行滚动更新

POST /profiling-events-5pow01/_rollover/
POST /profiling-events-5pow02/_rollover/
POST /profiling-events-5pow03/_rollover/
POST /profiling-events-5pow04/_rollover/
POST /profiling-events-5pow05/_rollover/
POST /profiling-events-5pow06/_rollover/
POST /profiling-events-5pow07/_rollover/
POST /profiling-events-5pow08/_rollover/
POST /profiling-events-5pow09/_rollover/
POST /profiling-events-5pow10/_rollover/
POST /profiling-events-5pow11/_rollover/
POST /profiling-events-all/_rollover/
POST /profiling-executables/_rollover/
POST /profiling-hosts/_rollover/
POST /profiling-metrics/_rollover/
POST /profiling-stackframes/_rollover/
POST /profiling-stacktraces/_rollover/
POST /profiling-symbols-global/_rollover/

滚动更新后,自定义 ILM 策略将应用于新的索引和数据流。

© . All rights reserved.