这个问题在这里已经有了答案:
why docker image with elasticsearch status restarting always?
(1 个回答)
1年前关闭。
我试图在 ec2 t2.micro 内部为 dev porpuse 启动一个 elasticsearch 实例(尽可能小,不关心)(为了避免从 aws 运行 elasticsearch 服务的成本)
所以...我拉了实例
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.8.9
现在,当我尝试运行图像时
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.8.9
出现以下错误
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0)
failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid1.log
我在某些地方听说你有两种选择
要么为你的虚拟机提供更多内存(这对于 t2.micro 实例是否可行),如何实现呢?
或更改 Elasticsearch JVM 设置
/etc/elasticsearch/jvm.options
并降低以下参数的值 -Xms512m -Xmx512m 但是如果我的图像无法进入,我该怎么做我还尝试通过 rpm 安装 elasticserach 但需要 coreutils >= 8.4 ,因此尝试启动实例又失败了
在 jvm.options 上使用 -Xms512m -Xmx512m 和可用空间(我猜)
我得到了同样的错误空间不够
最佳答案
你走在正确的轨道上。 t2.micro
实例只有 1 GiB 内存,因此您需要升级 VM 或降低 JVM 设置。
要绑定(bind)挂载 jvm 选项文件,可以使用 -v
选项。因此,在启动容器时,您可以在 docker 命令中添加如下内容:
<docker run command> -v local/jvm.options:/etc/elasticsearch/jvm.options docker.elastic.co/elasticsearch/elasticsearch:6.8.9
在哪里
local/jvm.options
包含您指定的 JVM 选项作为 EC2 实例上的文件。有关 bing 安装的更多信息,您可以查看文档 here
关于amazon-web-services - 在 ec2 上从 docker 运行 elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61844868/