我正在尝试在 AWS Elasticsearch Service 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”,但 policy_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-config 索引中看到该文档:
{
"_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”行显示“状态”为“活动”,“操作”为“-”,“作业状态”为“正在运行”。它会保持这种状态好几天......我也尝试过:
PUT _cluster/settings
{
"persistent": {
"opendistro.index_state_management.enabled" : true
}
}
仍然没有触发。我究竟做错了什么?