elasticsearch,out-of-memory,Ubuntu,elasticsearch,Out Of Memory" /> elasticsearch,out-of-memory,Ubuntu,elasticsearch,Out Of Memory" />

Ubuntu-elasticsearch-错误:无法分配内存

Ubuntu-elasticsearch-错误:无法分配内存,ubuntu,elasticsearch,out-of-memory,Ubuntu,elasticsearch,Out Of Memory,我正试图在本地Ubuntu机器上安装elasticsearch,指南如下: ,当尝试运行“./elasticsearch”时,出现以下错误: Java HotSpot(TM) 64-Bit Server VM warning: INFO: <br> os::commit_memory(0x00007f0e50cc0000, 64075595776, 0) failed; <br> error='Cannot allocate memory' (errno=12) &

我正试图在本地Ubuntu机器上安装elasticsearch,指南如下:

,当尝试运行“./elasticsearch”时,出现以下错误:

Java HotSpot(TM) 64-Bit Server VM warning: INFO: <br>

os::commit_memory(0x00007f0e50cc0000, 64075595776, 0) failed; <br>

error='Cannot allocate memory' (errno=12) <br>

There is insufficient memory for the Java Runtime Environment to continue.<br>

Native memory allocation (mmap) failed to map 64075595776 bytes for committing reserved memory
来自日志的错误消息:

There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 64075595776 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2627), pid=13021, tid=139764129740544
#
# JRE version:  (8.0_66-b17) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.66-b17 mixed mode linux-amd64 )
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
已经尝试过早期版本,使用apt从存储库安装,但没有任何效果


有人知道可能是什么问题吗?

看起来您正在尝试使用默认选项启动ElasticSearch,该选项尝试将堆栈大小设置为2Go。如果你没有免费的。。。卡布姆(默默地)

查看
/etc/elasticsearch/jvm.options
并修改行:

-Xms2g
-Xmx2g

找到适合你可用记忆的东西。但请注意,ElasticSearch是一个巨大的内存占用器,它需要所有的东西。在2Go限制下,您可能无法获得有用的系统。

首先,Elasticsearch使用混合的mmapfs/niofs目录。操作系统限制mmap计数,通常默认值为65536。它可能导致内存不足异常。 在Linux上,您可以通过以root用户身份运行以下命令来增加此默认内核值:

sysctl -w vm.max_map_count=262144
或者通过更新/etc/sysctl.conf中的vm.max_map_count设置来永久性地更新。也可以通过以下命令进行更改:

echo 262144 > /proc/sys/vm/max_map_count
有关更多信息,请查看:

最大映射计数: 此文件包含进程可能具有的最大内存映射区域数。内存映射区域被用作调用malloc的副作用,直接由mmap和mprotect调用,也可以在加载共享库时使用。 虽然大多数应用程序需要不到1000个映射,但某些程序,特别是malloc调试器,可能会消耗大量映射,例如,每次分配最多一到两个映射。 默认值为65536

您应该考虑的第二件事是JVM最小堆大小和最大堆大小。您可以在/etc/elasticsearch/jvm.options中更改计算机上的此值。要选择合适的值,您可以在上找到良好的规则

这对我很有效

通过更改以下值,我更改了总堆空间的初始大小和最大大小

/etc/elasticsearch/jvm.options


-Xms1g
-Xmx1g


-Xms256m

-Xmx256m

编辑
jvm。选项

sudo nano /etc/elasticsearch/jvm.options
更改JVM堆大小 从


原因:弹性搜索正在尝试分配2GB堆化(默认情况下),这注定会失败。因此,我们将其更改为200mb

您显然存在RAM问题(即
内存不足错误
)。查看可能的解决方案:我会先尝试
减小Java堆大小(-Xmx/-Xms)
。@Var没有任何更改,再次出现相同的错误。当还有4g可用时,内存如何成为问题。几乎没有发现其他人有同样问题的问题,但在他们的例子中,使用的内存几乎和总内存一样高。在某些情况下,它试图分配比可用内存更多的内存。这有用吗?不:/这行很奇怪。本机内存分配(mmap)映射64075595776字节以提交保留内存失败。这是否意味着它试图为传入任务保留64G内存?您是否将
mlockall
标志设置为true?嗨,我有4GB内存,我想我负担不起超过1GB的
ElasticSearch
。elasticsearch在1GB内存中的性能不是很好吗?如果不是,为什么?看起来现在是1Go了:
sudo nano /etc/elasticsearch/jvm.options
Xms2g 
Xmx2g
Xms200m
Xmx200m