Elasticsearch 内存占用高

Sti*_*985 5 elasticsearch

我目前在我们的开发机器上使用 elasticsearch。我们想在几周内提高生产力。今天我输入了“top”,我对所看到的感到震惊。

 PID   USER      PR   NI  VIRT  RES   SHR S  %CPU %MEM    TIME+   COMMAND
 28972 elastics  20   0   27.4g 1.4g  39m S  186  4.3     2:11.19 java
Run Code Online (Sandbox Code Playgroud)

弹性搜索使用这么多内存是否正常。我从来没有这样配置过。如果我们在一台具有 32 GB RAM 的机器上最多有 5 个索引,那么完美的配置是什么?我应该配置多少个副本/分片?如何控制内存使用?

我不想遇到与 Solr => 意外关机相同的问题。

谢谢你的帮助!

Bla*_*POP 5

Es 1.0 版本之后。默认的文件存储模式是Mmapfs。mamapfs将数据存储在HD 中。但它使用虚拟内存概念。虽然数据存在于HD 中,但它看起来像从RAM 中获取数据。它比其他文件系统更快。

所以 mmapfs 可能看起来消耗更多空间并且它阻塞了一些地址空间。但是它是健康的并且完全没有问题。

要配置分片和副本的最佳数量, 请参阅此.

为了摆脱意外关机和数据丢失。配置以下条款..

1)必须尽可能地增加某些用户要打开的文件数的ulimit

2) 不应预先配置线程数..以下是一些示例配置

    # Search pool
threadpool.search.type: fixed
threadpool.search.size: 5
threadpool.search.queue_size: 200

# Bulk pool
threadpool.bulk.type: fixed
threadpool.bulk.size: 5
threadpool.bulk.queue_size: 300

# Index pool
threadpool.index.type: fixed
threadpool.index.size: 5
threadpool.index.queue_size: 200

# Indices settings
indices.memory.index_buffer_size: 30%
indices.memory.min_shard_index_buffer_size: 12mb
indices.memory.min_index_buffer_size: 96mb

# Cache Sizes
indices.fielddata.cache.size: 15%
indices.fielddata.cache.expire: 6h
indices.cache.filter.size: 15%
indices.cache.filter.expire: 6h

# Indexing Settings for Writes
index.refresh_interval: 30s
index.translog.flush_threshold_ops: 50000
Run Code Online (Sandbox Code Playgroud)