ism不会触发工作

lf5gs5x2  于 2021-06-10  发布在  ElasticSearch
关注(0)|答案(1)|浏览(435)

我尝试在aws elasticsearch服务v7.8上使用ism和opendistro。我正在尝试设置一个基本的滚动/删除策略,但该策略似乎没有触发。我想我做错了什么,但我似乎找不到答案。。。我正在测试它使用滚动每小时和删除后6小时。。。
这是我的ism政策,我把它恰当地命名为“测试”:

{
    "policy": {
        "policy_id": "test",
        "description": "A test policy",
        "last_updated_time": 1605196195481,
        "schema_version": 1,
        "error_notification": null,
        "default_state": "active",
        "states": [{
                "name": "active",
                "actions": [{
                    "rollover": {
                        "min_index_age": "1h"
                    }
                }],
                "transitions": [{
                    "state_name": "delete",
                    "conditions": {
                        "min_index_age": "6h"
                    }
                }]
            },
            {
                "name": "delete",
                "actions": [{
                    "delete": {}
                }],
                "transitions": []
            }
        ]
    }
}

我已经创建了一个模板来维护索引创建等。注意,我添加了滚动别名“atest”,但是策略id是“test”。我不会将索引添加到此模板中的任何别名:

PUT /_template/atest
{
    "index_patterns" : [
      "atest-*"
    ],
    "settings" : {
      "index" : {
        "opendistro" : {
          "index_state_management" : {
            "policy_id" : "test",
            "rollover_alias" : "atest"
          }
        },
        "analysis" : {
        }
      }
    },
    "mappings" : {
    },
    "aliases" : { }
}

然后,我使用模板中的索引模式创建一个索引,将其添加到我在上面定义的滚动别名中:

PUT /atest-000001
{
  "aliases": {"atest": {}}
}

然后我可以在opendistro ism配置索引中看到文档:

{
  "_index": ".opendistro-ism-config",
  "_type": "_doc",
  "_id": "T_k8jMI5RvuWRaLp1tY_hg",
  "_version": 2,
  "_score": null,
  "_source": {
    "managed_index": {
      "name": "atest-000001",
      "enabled": true,
      "index": "atest-000001",
      "index_uuid": "T_k8jMI5RvuWRaLp1tY_hg",
      "schedule": {
        "interval": {
          "start_time": 1605200587242,
          "period": 30,
          "unit": "Minutes"
        }
      },
      "last_updated_time": 1605200587242,
      "enabled_time": 1605200587242,
      "policy_id": "test",
      "policy_seq_no": 422,
      "policy_primary_term": 111,
      "policy": {
        "policy_id": "test",
        "description": "A test policy",
        "last_updated_time": 1605196195481,
        "schema_version": 1,
        "error_notification": null,
        "default_state": "active",
        "states": [
          {
            "name": "active",
            "actions": [
              {
                "rollover": {
                  "min_index_age": "1h"
                }
              }
            ],
            "transitions": [
              {
                "state_name": "delete",
                "conditions": {
                  "min_index_age": "6h"
                }
              }
            ]
          },
          {
            "name": "delete",
            "actions": [
              {
                "delete": {}
              }
            ],
            "transitions": []
          }
        ]
      },
      "change_policy": null
    }
  },
  "fields": {
    "managed_index.last_updated_time": [
      "2020-11-12T17:03:07.242Z"
    ],
    "policy.last_updated_time": [],
    "policy.states.actions.notification.destination.last_update_time": [],
    "policy.error_notification.destination.last_update_time": [],
    "managed_index.schedule.interval.start_time": [
      "2020-11-12T17:03:07.242Z"
    ],
    "managed_index.enabled_time": [
      "2020-11-12T17:03:07.242Z"
    ]
  },
  "sort": [
    1605200587242
  ]
}

在某个时刻,我看到托管索引信息从“初始化”变为

{
    "message": "Successfully initialized policy: test"
}

在这一点上,什么也没有发生。kibana中ism控制台中“atest-000001”的行表示“state”为“active”,“action”为“-”,“job status”为“running”。它会像这样持续好几天。。。我也尝试过:

PUT _cluster/settings
{
  "persistent": {
    "opendistro.index_state_management.enabled" : true

  }
}

还是没有什么触发。我做错什么了?

rqdpfwrv

rqdpfwrv1#

原来是内部的事情。更新到r20201117解决了问题。

相关问题