首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Elasticsearch best_compression无效

Elasticsearch best_compression无效
EN

Stack Overflow用户
提问于 2016-11-25 12:57:11
回答 1查看 1.2K关注 0票数 0

我从Logstash解析Apache日志,并将其索引到Elasticsearch索引中。我还编制了geoipagent字段的索引。当我观察到索引时,elasticsearch索引大小比实际文件大小(磁盘上的空间)大6.7x。所以我只想明白这是正确的行为还是我做错了什么?我正在使用Elasticsearch 5.0Logstash 5.0Kibana 5.0版本。我也尝试过压缩,但它的磁盘大小相同。下面是我到目前为止尝试过的配置文件的完整观察。

My的观察:

用例1:

Apache Log file Size:211 MB

Total number of lines:1 000 000

Index Size:1.5GB

Observation:索引是大于文件大小的6.7x

用例2:

我找到了一些压缩elasticsearch索引的解决方案,然后我也尝试了。

代码语言:javascript
复制
- Disable `_all` fields
- Remove unwanted fields that has been created by `geoip` and `agent` parsing.
- Enable `best_compression` [ index.codec": "best_compression"]

Apache Log file Size:211 MB

Total number of lines:1 000 000

Index Size:1.3GB

Observation:索引6.16x大于文件大小

日志文件格式:

代码语言:javascript
复制
127.0.0.1 - - [24/Nov/2016:02:03:08 -0800] "GET /wp-admin HTTP/1.0" 200 4916 "http://trujillo-carpenter.com/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.01; Trident/5.1)"

我发现了Logstash +弹性搜索存储经验,他们说他们已经将索引大小从6.23x缩减到1.57x。但这是相当老的解决方案,这些解决方案不再适用于Elasticsearch 5.0

我已经尝试过一些更多的参考:

是否有更好的方法来优化Elasticseach索引大小,而您的目的只是显示在Kibana上的可视化?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-30 08:56:55

由于索引设置未应用于索引,因此我面临此问题。我的索引名和模板名不同。在使用相同的模板名称和索引名称之后,将正确地应用压缩。

在下面的示例中,我使用了索引名apache_access_logs和模板名elk_workshop

共享修正的模板和日志存储配置。

Logstash.conf

代码语言:javascript
复制
output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "apache_access_logs"
    template => "apache_sizing_2.json"
    template_name => "apache_access_logs" /* it was elk_workshop */
    template_overwrite => true
  }
}

模板:

代码语言:javascript
复制
{

    "template": "apache_access_logs", /* it was elk_workshop */
    "settings": {
        "index.refresh_interval": "5s",
        "index.refresh_interval": "30s",
        "number_of_shards": 5,
        "number_of_replicas": 0
    },
    ..
}         

参考: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html#indices-templates

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

https://stackoverflow.com/questions/40805643

复制
相关文章

相似问题

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