elasticsearch自动关闭

es用了三个月了 一直没出过问题

就在前天凌晨,php开始报错

exception 'Elasticsearch\Common\Exceptions\NoNodesAvailableException' with message 'No alive nodes found 
in your cluster' in /data/website/test.xiaoniugupiao.com/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php:51

进服务器查看es服务

ps aux |grep elastic

进程没了?wtf?

如果是正常的话 应该显示

[root@i2zefu shelldir]# ps aux |grep elastic
elsearch  2929 12.3 17.8 6704356 1440480 ?     Sl   10:44   0:39 /usr/java/jdk1.8.0_171/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/elasticsearch -cp /opt/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
root      3456  0.0  0.0 103196   872 pts/2    S+   10:49   0:00 grep elastic

我还以为是谁把我这个服务关了吗?但是不可能啊

先不解决了 重启再说

重启完发现没有毛病,继续运行了,平安度过到了第二天下午

又自动给关了...

日了狗

后来刚好和一群里的同学聊起这个 他说他以前也遇到过

他说:top一下,看看是不是es占用的内存空间过大 了,让系统过荷载了

我top了一下 果然 占内存33%

然后执行

free -m

[root@iZ2zelogs]# free -m
             total       used       free     shared    buffers     cached
Mem:          7872       7742        129          0         24        667
-/+ buffers/cache:       7050        821
Swap:            0          0          0

buffers/cache的free竟然只剩821了 以前可是都剩4000多的

然后查了查优化方法

修改elasticsearch的配置文件

我的安装目录在//opt/elasticsearch/

cd /opt/elasticsearch/config

vim jvm.options

默认设置是

-Xms2g
-Xmx2g

修改 -Xms 和 -Xmx,根据系统剩余内存自己感觉配置 我还剩了四个g 所以都分配为1个G

-Xms1g
-Xmx1g

修改完重启
kill -9 12345
/opt/elasticsearch/bin/elasticsearch -d

然后重启了,再次查看剩余内存

[root@i43zefu config]# free -m
             total       used       free     shared    buffers     cached
Mem:          7872       7555        317          0         32       1380
-/+ buffers/cache:       6142       1729

还剩将近两个g 继续观察看看

猜你喜欢

转载自blog.csdn.net/hoooooly/article/details/82586445
今日推荐