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

Cud*_*ste 7 ubuntu out-of-memory elasticsearch

我正在尝试在我的本地Ubuntu机器上按照以下指南安装elasticsearch:

https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html

,当尝试运行'./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
Run Code Online (Sandbox Code Playgroud)

这是内存统计:

             total       used       free     shared    buffers     cached
Mem:       8113208    4104900    4008308      44244     318076    1926964
-/+ buffers/cache:    1859860    6253348
Swap:      7812092          0    7812092
Run Code Online (Sandbox Code Playgroud)

来自日志的错误消息:

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
Run Code Online (Sandbox Code Playgroud)

已经尝试过早期版本,使用apt从存储库安装,没有任何效果.

任何人都知道可能是什么问题?

Nel*_*llo 11

看起来你正试图用默认选项启动ElasticSearch,它试图将堆栈大小设置为2Go.如果你没有那个免费的... kaboom(默默地).

看看/etc/elasticsearch/jvm.options并修改线条:

-Xms2g
-Xmx2g
Run Code Online (Sandbox Code Playgroud)

能够适应你的可用记忆.但请注意,ElasticSearch是一个伟大的大记忆,并希望一切.您可能无法在2Go限制下获得有用的系统.