elasticsearch-curator创建索引

elasticsearch-curator创建索引

1.elasticsearch-curator安装

pip命令安装,如果没有pip命令需要先安装pip命令

[root@ecs]# pip install elasticsearch-curator

可以使用==指定版本

[root@ecs]# pip install elasticsearch-curator==5.6.0

2.elasticsearch-curator创建索引

在 /usr/目录下创建目录 :curator

[root@ecs]# cd /usr
[root@ecs]# mkdir curator

在/usr/curator目录下创建文件config.yml和action.yml

config.yml内容如下:

client:
  hosts:
    - 127.0.0.1
  port: 9200
  url_prefix:
  use_ssl: False
  certificate:
  client_cert:
  client_key:
  ssl_no_validate: False
  http_auth:
  timeout: 30
  master_only: False
logging:
  loglevel: INFO
  logfile:
  logformat: default
  blacklist: ['elasticsearch', 'urllib3']

action.yml内容如下:

actions:
  1:
    action: create_index
    description: "创建索引名为:'junan-%Y-%m-%d-%H:%M:%S'的索引"
    options:
      name: junan-%Y-%m-%d-%H:%M:%S #索引名称
      extra_settings:    #索引信息
        settings:
          number_of_shards: 2
          number_of_replicas: 1
        mappings:
          student:
            _routing:
              required: true
            properties:
              name:
                type: keyword
              age:
                type: integer

执行命令curator命令创建索引:

[root@ecs]# curator --config /usr/curator/config.yml /usr/curator/action.yml

如果需要定时创建索引,可以创建Linux定时任务命令:crontab

[root@ecs]# crontab -e

添加内容:

curator --config /usr/curator/config.yml /usr/curator/action.yml

保存退出即可定时创建索引

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值