Elasticsearch 7.13.2 linux(centos) service - Custom JVM - Doesn't start

It's installed as a linux service. It comes up and works fine using the bundled jdk(16).

[tsadmin@tsmkmslin04 ~]$ curl -XGET 'http://localhost:9200'
{
  "name" : "tsmkmslin04",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "MKY32C_DQxmTyU8Xfh7U9A",
  "version" : {
    "number" : "7.13.2",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "4d960a0733be83dd2543ca018aa4ddc42e956800",
    "build_date" : "2021-06-10T21:01:55.251515791Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.2",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

I change the ES_JAVA_HOME to any other jdk including jdk-16 or jdk-11 by editing /etc/sysconfig/elasticsearch file. Then it fails to come with below error :-

-- Unit elasticsearch.service has begun starting up.
Jul 02 15:54:46 tsmkmslin04 systemd-entrypoint[105988]: could not find java in ES_JAVA_HOME at /home/tsadmin/rajnish_openjdk11/jdk-16.0.1/bin/java
Jul 02 15:54:46 tsmkmslin04 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Jul 02 15:54:46 tsmkmslin04 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Jul 02 15:54:46 tsmkmslin04 systemd[1]: Failed to start Elasticsearch.

I have tried this with jdk-11 and with jdk-16. It's a valid path.

[tsadmin@tsmkmslin04 elasticsearch]$ /home/tsadmin/rajnish_openjdk11/jdk-16.0.1/bin/java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-24)
OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
[tsadmin@tsmkmslin04 elasticsearch]$ 

I am not able to figure out at all what's going wrong. Any help us appreciated.

  1. have you tried pointing it at the home directory not the bin directory?

/home/tsadmin/rajnish_openjdk11/jdk-16.0.1

  1. Also when you start elasticsearch as a service it starts as the elasticsearch user so it would need access / permissions to that path as well
  1. This is how the changes look.
    ES_JAVA_HOME=/home/tsadmin/rajnish_openjdk11/jdk-16.0.1
    From here elasticsearch automatically looks up for java in ES_JAVA_HOME/bin directory.

  2. This is how the permission on jdk looks like
    You correctly pointed out. This was the reason. Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.