[英]Elasticsearch is running with old java version
I recently upgraded the elasticsearch version in a elasticsearch slave node.我最近在 elasticsearch 从节点中升级了 elasticsearch 版本。 Still it is picking the wrong java version even though I set the
$JAVA_HOME
variable.即使我设置了
$JAVA_HOME
变量,它仍然选择了错误的 java 版本。
[igwuser@hbase3 ~]$ sudo systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-05-01 12:06:09 +08; 11min ago
Docs: http://www.elastic.co
Main PID: 15809 (java)
CGroup: /system.slice/elasticsearch.service
├─15809 /opt/jdk1.8.0_151/bin/java -Xms15g -Xmx15g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=...
└─15893 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
May 01 12:06:09 hbase3.api.celcom.com.my systemd[1]: Started Elasticsearch.
May 01 12:06:09 hbase3.api.celcom.com.my elasticsearch[15809]: Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file /var/log/elasticsearch/gc.log due to Permission denied
[igwuser@hbase3 ~]$
[igwuser@hbase3 ~]$
[igwuser@hbase3 ~]$ echo $JAVA_HOME
/usr/java/jdk1.8.0_251-amd64/
[igwuser@hbase3 ~]$
As it's mentioned in the logs, your elasticsearch service is using the JDK present at the path /opt/jdk1.8.0_151/bin/java
while your JAVA_HOME
is pointing to /usr/java/jdk1.8.0_251-amd64/
.正如日志中提到的,您的 elasticsearch 服务正在使用路径
/opt/jdk1.8.0_151/bin/java
中存在的 JDK,而您的JAVA_HOME
指向/usr/java/jdk1.8.0_251-amd64/
。
Please make sure, that your elasticsearch service uses the correct path.请确保您的 elasticsearch 服务使用正确的路径。 Please see this official information on how to set it.
请参阅此官方信息以了解如何设置它。
Edit As Elasticsearch installation is done using the installer, its owned by elasticsearch user, which uses the bundled JDK mentioned in my previous link, In order to make it work, you need to add your new JDK JAVA_HOME
to this user but it's not trivial ,编辑Elasticsearch 安装是使用安装程序完成的,它由 elasticsearch 用户拥有,该用户使用我之前链接中提到的捆绑 JDK,为了使其工作,您需要将新的 JDK
JAVA_HOME
添加到该用户,但这并不简单,
Hence would suggest installing Elasticsearch from tarball from this official link and when you start elasticsearch now from user igwuser
for which JAVA_HOME
points to your lastest JDK, your Elasticsearch will also use that and you can see that in startup logs as well or in your elasticsearch process. Hence would suggest installing Elasticsearch from tarball from this official link and when you start elasticsearch now from user
igwuser
for which JAVA_HOME
points to your lastest JDK, your Elasticsearch will also use that and you can see that in startup logs as well or in your elasticsearch process .
For example, in my case, my JAVA_HOME points to例如,就我而言,我的 JAVA_HOME 指向
/usr/lib/jvm/java-11-openjdk-amd64
And this is what printed in Elastic startup logs这就是 Elastic 启动日志中打印的内容
JVM home [/usr/lib/jvm/java-11-openjdk-amd64]
JVM 主页 [/usr/lib/jvm/java-11-openjdk-amd64]
And same can also be verified in Elastic process by using ps aux | grep elastic
同样也可以使用
ps aux | grep elastic
在 Elastic 过程中进行验证。 ps aux | grep elastic
/usr/lib/jvm/java-11-openjdk-amd64/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true
/usr/lib/jvm/java-11-openjdk-amd64/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava。 awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.