我正在通过以下方式启动 ElasticSearch
echo "export ES_HEAP_SIZE = 4096" >> /root/setenv
echo "export ES_MAX_MEM = 4096" >> /root/setenv
echo "export ES_MAX_MEM = 4096" >> /root/setenv
# finally, we can start the app
echo 'Starting ElasticSearch...'
bin/elasticsearch -Xmx4g -Xms4g
然而,在没有时间(20分钟)之后,它变得没有响应,显然是由于HeapDumpOnOutOfMemoryError
......
[root@ip-***** api]# ps -ax | grep elasticsearch
6225 ? SLl 5:35 java -Xms256m -Xmx1g -Xss256k -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=/root/elasticsearch/elasticsearch-0.20.3 -cp :/root/elasticsearch/elasticsearch-0.20.3/lib/elasticsearch-0.20.3.jar:/root/elasticsearch/elasticsearch-0.20.3/lib/*:/root/elasticsearch/elasticsearch-0.20.3/lib/sigar/* -Xmx4g -Xms4g org.elasticsearch.bootstrap.ElasticSearch
编辑——我刚刚注意到这里输出的 -Xms 大小只有 256m,尽管在上面的启动中传递了 4g。我是不是误会了什么?
FWIW,我在运行 CentOS 和 Java v1.6.0_14-b08 的 Amazon EC2(m1.large 实例 => 8GB 内存)上