首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >架构错误: curator中的字典值@ data['actions']需要字典

架构错误: curator中的字典值@ data['actions']需要字典
EN

Stack Overflow用户
提问于 2021-07-30 15:30:26
回答 2查看 704关注 0票数 0

我已经安装了curator-5.8.1,但是从第一天起它就不能工作了。

获取/var/log/curator_snapshot_backup.log中的以下错误

代码语言:javascript
复制
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条目

代码语言:javascript
复制
#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

代码语言:javascript
复制
---
# 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_indees.yml

代码语言:javascript
复制
# 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:
代码语言:javascript
复制
[root@ ~]# cat /opt/curator-5.8.1/actions/snapshot_backup.yml
# Ansible managed
actions:
[root@ ~]#

有人能告诉我问题出在哪里吗?

谢谢,

EN

回答 2

Stack Overflow用户

发布于 2021-07-31 10:33:58

这很可能是这里的某些东西导致YAML被误解。一个错误的间距可能会be.Use任何yml验证器来验证你的yml文件。

票数 1
EN

Stack Overflow用户

发布于 2021-07-31 16:48:41

您在客户机配置前面添加了三个短划线,表明它是一个YAML文件。在三破折号标题后面有注释行是可以的。您的操作文件似乎缺少三个破折号的标题,但以注释行开头,这可能会破坏YAML兼容性。

更新:

我在一个移动设备上度假后回复了。我知道是怎么回事了。策展人希望actions是一个字典。因为actionssnapshot_backup.yml文件中没有子键/值对,所以它看起来像是一个简单的键/值对本身,而不是错误所表示的字典。

底线:在未定义任何操作的情况下调用Curator将导致此错误或其他错误。它不完全是无效的YAML,但是它不是模式正确的(这就是错误的状态)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68593534

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档