Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to start elastic search service

I am trying to start the Elastic Search service on a Windows 2008 R2 server, but it's failing to start. It had previously been running for several months without issue.

In services, I get the message:

"Windows could not start the Elasticsearch 1.7.2 (ELASTIC_POC) on Local Computer. For more information, review the System Event Log. If this is a non_Microsoft service, contact the service vendor, and refer to service specific error code 1."

Event log was very unhelpful, showing the following error:

"The Elasticsearch 1.7.2 (ELASTIC_POC) service entered the stopped state."

"The Elasticsearch 1.7.2 (ELASTIC_POC) service terminated with service-specific error Incorrect function.."

I do get more information in Elastic Search own log files however:

[2016-03-30 10:47:22] [info]  [ 3988] Running 'ELASTIC_POC' Service...
[2016-03-30 10:47:22] [info]  [ 3760] Starting service...
[2016-03-30 10:47:22] [error] [ 3760] Failed creating java C:\Progra~2\Java\jre1.8.0_60\bin\client\jvm.dll
[2016-03-30 10:47:22] [error] [ 3760] The system cannot find the path specified.
[2016-03-30 10:47:22] [error] [ 3760] ServiceStart returned 1
[2016-03-30 10:47:22] [error] [ 3760] The system cannot find the path specified.
[2016-03-30 10:47:22] [info]  [ 3988] Run service finished.
[2016-03-30 10:47:22] [info]  [ 3988] Commons Daemon procrun finished

Checking C:\Program Files (x86)\Java\jre1.8.0_60, it only contains a folder named "lib" (which is empty). There is a "jre1.8.0_73" folder that has several files, "including \bin\client\jvm.dll"

How can I either make Elastic Search use the later Java release, or bring back the contents for the jre1.8.0_60 folder? I can't seem to find (a safe to download) installer for this..

Any help greatly appreciated.

like image 519
mp3duck Avatar asked Mar 30 '16 09:03

mp3duck


4 Answers

There is a very high probability that your Java Runtime Environment was auto-updated.

This will break Elastic Search because you have an environment variable called JAVA_HOME that is now pointed at the wrong location.

First, go into program files / java and find the new folder of JRE. It is probably a later version number. Example: instead of jre1.8.0_73, perhaps jre1.8.090 or some higher number tacked onto the end.

Update your JAVA_HOME environment variable accordingly.

Then, after taking appropriate backups of your elastic search files, in an admin-enabled command prompt, navigate to your elastic search bin folder.

type the following commands

 service remove
 service install

Then, you will probably want to go into services.msc and switch the service from "manual start" to "automatic" or "automatic delayed"

One might think that reinstalling the service after updating the JAVA_HOME environment variable would be unnecessary, but it was necessary for my installation.

like image 130
Brian Webster Avatar answered Oct 14 '22 04:10

Brian Webster


Resolved, by install service again..

Open

{path-to-elastic-search}\bin\

in command prompt,

and run

service install

It would not allow me to run

service remove, so I now how two elastic search services listed, however, this is a test server, so that's fine.

like image 34
mp3duck Avatar answered Oct 14 '22 04:10

mp3duck


For me it was caused by a problem in my registry after updating Java. It seemed that older versions of the service installer hardcoded the java path in the registry keys while they should depend on the JAVA_HOME environment variable.

Locate the following key in your registry: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\elasticsearch-service-x64\Parameters\Java\Jvm. If it looks like a hardcoded path to jvm.dll, change the value to %JAVA_HOME%\bin\server\jvm.dll and try starting the service.

like image 37
Jorrit Schippers Avatar answered Oct 14 '22 05:10

Jorrit Schippers


Just do the following steps step by step and then your elastic search installation will work: advanced system setting >> Environment variables >> System Variables >> path >> New and then insert your latest java jdk path. like this: C:\Program Files\Java\jdk-11.0.3\bin

like image 35
Eli Avatar answered Oct 14 '22 05:10

Eli