Bootstrap

Docker 启动elasticsearch报内存不足解决

启动es

[root@localhost es]# docker run -d --name es2 -p 9201:9200 -p 9301:9300 elasticsearch_ik
25eeaefae21deb42424577e328dca81adcdd61b7a03c7a1b8be1911457f72c3a
[root@localhost es]# docker exec -it es2 /bin/bash
Error response from daemon: Container 25eeaefae21deb42424577e328dca81adcdd61b7a03c7a1b8be1911457f72c3a is not running
[root@localhost es]# docker logs -f --tail=100 es2
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=0
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000ca660000, 899284992, 0) failed; error='Not enough space' (errno=12)

解决方法

[root@localhost /]# find / -name jvm.options
find: ‘/run/user/1000/gvfs’: Permission denied
/var/lib/docker/overlay2/c84999045e8a92c418fd2df9c7f0a4174caa5f7248edaffa8537729b6c0c4a4e/diff/usr/share/elasticsearch/config/jvm.options

## JVM configuration

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms1g      #改成512m
-Xmx1g      #改成512m

################################################################

;