Elasticsearch runs with specified Java

When using elasticsearch, sometimes the Java version may not match. For example, the 2.4.1 I use requires jdk to be at least 1.8. Since the unified version on the server is jdk1.7, JAVA_HOME cannot be modified at this time. Under the circumstance, how can elasticsearch run?

Baidu for a while and found that no one has encountered this situation, there is no way, think of a way, after a few thoughts, fortunately found a solution, in fact, the method is very simple, find the elasticsearch startup script in the bin directory


You can find that the startup script actually uses JAVA_HOME, so it is very simple. We replace all JAVA_HOME in the script with ES_JAVA_HOME. After replacing this, the next step is to configure the environment variables of the system and configure an ES_JAVA_HOME.

When configuring the environment, it is recommended to configure the current user, such as vi ~/.bashrc under Linux system, and then configure ES_JAVA_HOME to write the Java directory you want to use ( note that the configuration method here is the same as JAVA_HOME, no need to go to bin, Don't add ES_JAVA_HOME to the path, because a JAVA_HOME has been configured in the system, and there may be conflicts after configuration, but problems will occur )

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325490426&siteId=291194637