设置参数 `node.name` 可以自定义 Elasticsearch 节点的名字。 此条 Tips 由 medcl 贡献。

elasticsearch 5 磁盘存储量过大,压缩率不足

Elasticsearch | 作者 highmoutain | 发布于2018年07月11日 | 阅读数:14654

版本:elasticsearch 5.3
问题现象:写入索引到ES之后,磁盘存储量过大,压缩率不足。经测试,1亿条记录就会产生36G磁盘存储,从ES官方社区找到的优化方法,也只能减少40%.导致我们只能存储3个月的数据,严重影响业务。请问各位大神,还有什么可以提高压缩率的方法。
长整形改为短整型,使用best_compression等已经都使用过了
已邀请:

medcl - 今晚打老虎。

赞同来自: ghnjk

一个字段么?我看都是col_a。
你可以试试把这个字段开启索引时排序,可以提高压缩率,也节省不少磁盘空间。
https://www.elastic.co/guide/e ... .html

highmoutain

赞同来自:

我已经按照https://www.elastic.co/guide/e ... teral中所描述的进行了调优,但是效果不好

highmoutain

赞同来自:

我索引的mapping如下:
{
  "ae_count_es_417" : {
    "mappings" : {
      "analytics" : {
        "_all" : {
          "enabled" : false
        },
        "properties" : {
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          },
          "col_a" : {
            "type" : "integer"
          }
        }
      }
    }
  }
}

chachabusi - 新手妹子运维,希望多多关照

赞同来自:

问个没关系的,请问你们是怎么清理过期数据的 
可以在保留索引的情况下 清理数据吗

白衬衣 - 金桥

赞同来自:

你原始数据多大呢?然后进行了segment merge吗?

zqc0512 - andy zhou

赞同来自:

best_compression 这个好像还可以选择压缩方式的样,可以修改的。
你的所有字段都需要索引查询不?不需要就不要搞这么多mapping,
实在不行就添加节点,或者扩展硬盘吧。

viewsite

赞同来自:

把不需要索引的字段设置成index:false,

ghnjk

赞同来自:

如果一些字段不需要聚合或者排序,可以考虑关闭doc_value

weizijun - elasticsearch fan

赞同来自:

贴下原始数据看看吧,字段太多,索引容量占比会比较高,这些字段的Cardinality越大,索引容量消耗越多。还加上doc_value也是默认加上的,这些都会增加存储开销,你可以根据使用情况决定哪些字段可以不建索引,不建立doc_value

yayg2008

赞同来自:

1,不需要用来查询的字段设置index:false;
2,如果字段不需要聚合,汇总,推荐使用keyword类型,哪怕原始数据是int;
3,关闭 _all;

要回复问题请先登录注册