【已解决】Java HotSpot(TM)64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

启动elasticsearch时警告warning:

Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

【已解决】Java HotSpot(TM)64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

这也不算是报错,但是看着警告就很难受。警告提示我们什么呢:虚拟机热部署的问题;

原因是我们虚拟机在创建时分配的内存为2G,而elasticsearch默认初始内存就为1g或2g;

【已解决】Java HotSpot(TM)64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

因此,我们就需要适当调整 jvm.options 中分配内存的值

进入文件夹找到该文件

【已解决】Java HotSpot(TM)64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

切换es权限用户使用命令打开

【已解决】Java HotSpot(TM)64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

vim jvm.options

【已解决】Java HotSpot(TM)64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

如图,我这里默认为1g,调整为512m即可

【已解决】Java HotSpot(TM)64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

修改完成后保存退出。

再次启动elasticsearch该警告便消失啦...


如有错误,欢迎指正

Thanks

上一篇:Python日志封装可多模块调用


下一篇:docker安装mysql