elasticsearch随笔filebeat

ES数据库迁移索引数据

先新建索引

POST _reindex
{
  "source": {
    "index": "old_index"
  },
  "dest": {
    "index": "new_index"
  }
}

修改分片数量和,副本数

settings修改索引库默认配置

  例如:分片数量,副本数量

  查看:curl -XGET http://192.168.80.10:9200/zhouls/_settings?pretty

  操作不存在索引:curl -XPUT '192.168.80.10:9200/liuch/' -d'{"settings":{"number_of_shards":3,"number_of_replicas":0}}'

  操作已存在索引:curl -XPUT '192.168.80.10:9200/zhouls/_settings' -d'{"index":{"number_of_replicas":1}}'

总结:就是,不存在索引时,可以指定副本和分片,如果已经存在,则只能修改副本。

  在创建新的索引库时,可以指定索引分片的副本数。默认是1,这个很简单

filebeat setup.template.settings

filebeat解析

#==================== Elasticsearch template setting ==========================

setup.template.settings:
  index.number_of_shards: 1
  index.number_of_replicas: 0

这个配置文件会在es建一个索引模板,一旦创建成功后,再修改filebeat配置是不会更新es的索引模板的,

通过http://192.168.1.134:9200/_template,火狐浏览器人性化

 查看有哪些模板,http://192.168.1.134:9200/_template/filebeat-6.8.2找到模板数据,用json.cn分析,并参考索引模板,修改es的索引模板

http://192.168.1.134:9200/_template/filebeat-6.8.2/
PUT方法
{
  "index_patterns": [
    "filebeat-6.8.2-*"
  ],
  "settings": {
    "number_of_shards": 5,
    "number_of_replicas": "2"
  }
}

原文地址:https://www.cnblogs.com/fanever/p/13066879.html