如何解决架构错误:策展人中的字典值@data['actions'] 的预期字典 更新:
我已经安装了 curator-5.8.1
,但从第一天起就发现它无法正常工作。
在 /var/log/curator_snapshot_backup.log
中出现以下错误
2021-07-21 02:00:02,232 ERROR Schema error: expected dict for dictionary value @ data['actions']
2021-07-22 02:00:05,408 ERROR Schema error: expected dict for dictionary value @ data['actions']
2021-07-23 02:00:08,351 ERROR Schema error: expected dict for dictionary value @ data['actions']
下面是要运行的cron入口
#Ansible: Curator Delete indices
0 0 * * * /root/curatorvenv/bin/python3 /opt/curator-5.8.1/run_curator.py --config /opt/curator-5.8.1/curator.yaml /opt/curator-5.8.1/actions/delete_indices.yml
#Ansible: Curator Backup all indices
0 2 * * * /root/curatorvenv/bin/python3 /opt/curator-5.8.1/run_curator.py --config /opt/curator-5.8.1/curator.yaml /opt/curator-5.8.1/actions/snapshot_backup.yml >> /var/log/curator_snapshot_backup.log 2>&1
配置文件-
cat /opt/curator-5.8.1/curator.yaml
---
# Ansible managed
# Remember,leave a key empty if there is no value. None will be a string,# not a Python "nonetype"
client:
hosts: ['http://10.191.191.100:5200','http://10.191.191.101:5200','http://10.191.191.102:5200']
port: 5200
url_prefix:
use_ssl: False
certificate:
client_cert:
client_key:
aws_key:
aws_secret_key:
aws_region:
ssl_no_validate: False
http_auth: elastic:xxx
timeout: 30
master_only: False
logging:
loglevel: INFO
logfile:
logformat: default
blacklist: ['elasticsearch','urllib3']
删除操作是
cat /opt/curator-5.8.1/actions/delete_indices.yml
# Ansible managed
actions:
1:
action: delete_indices
description: >-
Delete indices older than 60 days (based on index name).
options:
ignore_empty_list: True
timeout_override:
continue_if_exception: True
disable_action: False
filters:
- filtertype: pattern
kind: prefix
value: metricbeat
exclude:
- filtertype: age
source: name
direction: older
timestring: "%Y.%m.%d"
unit: days
unit_count: 60
exclude:
2:
action: delete_indices
description: >-
Delete indices older than 60 days (based on index name).
options:
ignore_empty_list: True
timeout_override:
continue_if_exception: True
disable_action: False
filters:
- filtertype: pattern
kind: prefix
value: heartbeat
exclude:
- filtertype: age
source: name
direction: older
timestring: "%Y.%m.%d"
unit: days
unit_count: 60
exclude:
3:
action: delete_indices
description: >-
Delete indices older than 60 days (based on index name).
options:
ignore_empty_list: True
timeout_override:
continue_if_exception: True
disable_action: False
filters:
- filtertype: pattern
kind: prefix
value: filebeat
exclude:
- filtertype: age
source: name
direction: older
timestring: "%Y.%m.%d"
unit: days
unit_count: 60
exclude:
4:
action: delete_indices
description: >-
Delete indices older than 60 days (based on index name).
options:
ignore_empty_list: True
timeout_override:
continue_if_exception: True
disable_action: False
filters:
- filtertype: pattern
kind: prefix
value: .monitoring
exclude:
- filtertype: age
source: name
direction: older
timestring: "%Y.%m.%d"
unit: days
unit_count: 3
exclude:
[root@ ~]# cat /opt/curator-5.8.1/actions/snapshot_backup.yml
# Ansible managed
actions:
[root@ ~]#
有人能指出我问题出在哪里吗?
谢谢,
解决方法
很可能是这里的某些东西导致 YAML 被误解。 间距可能不合适。使用任何 yml 验证器来验证您的 yml 文件。
,您在客户端配置前添加了三个破折号,表明它是一个 YAML 文件。在三连字符标题后添加注释行是可以的。您的操作文件似乎缺少三重破折号标头,但以注释行开头,这可能会破坏 YAML 兼容性。
更新:
我在移动设备上回复了假期。我明白现在发生了什么。 Curator 希望 actions
是一本字典。因为 actions
在 snapshot_backup.yml
文件中没有子键/值对,所以它本身似乎是一个简单的键/值对,而不是字典,这是错误所指示的。
底线:在未定义任何操作的情况下调用 Curator 将导致此错误或其他错误。它并不是完全无效的 YAML,但它不是架构正确的(这是错误状态)。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。