Hey,
I want install elasticsearch on my server (Linux RHEL-6Server-6.6.0.2.el6.x86_64) with jdk1.8.0_112 but I always the same error.
I try with the latest version of jdk (1.8.0.121) but the result is the same.
[elasticsearch@pcyy4aix ~]$ cd /logiciels/elasticsearch-5.3.0/bin
[elasticsearch@pcyy4aix bin]$ ./elasticsearch
Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create new native thread
Elasticsearch requires at least Java 8 but your Java version from /usr/bin/java does not meet this requirement
[elasticsearch@pcyy4aix bin]$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
In the script, I find
"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.JavaVersionChecker
if [ $? -ne 0 ]; then
echo "Elasticsearch requires at least Java 8 but your Java version from $JAVA does not meet this requirement"
exit 1
fi
And I try with the same variables and command line, no mistake
[elasticsearch@pcyy4aixbin]$ JAVA=/usr/bin/java
[elasticsearch@pcyy4aix bin]$ES_CLASSPATH=/logiciels/elasticsearch-5.3.0/lib/elasticsearch-5.3.0.jar:/logiciels/elasticsearch-5.3.0/lib/*
[elasticsearch@pcyy4aix bin]$ "$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.JavaVersionChecker
[elasticsearch@pcyy4aixbin]$ echo $?
0
Thank you for your help.
Comes when you dont have sufficient memory , can you tell how much memory you have in system , you can check it via
free -m
If you have less than 4 GB then try changing the heap size in jvm.options from 2G (default) and make it 1G or 512M
Here is what I have:
[elasticsearch@pcyy4aix ~]$ free -m
total used free shared buffers cached
Mem: 15822 2400 13422 12 277 1342
-/+ buffers/cache: 780 15041
Swap: 1055 0 1055
I think I have enough memory
And how to make the change ?
I added
ES_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/elasticsearch
In the script "elasticsearch" but I always have an error:
[elasticsearch@pcyy4aix bin]$ ./elasticsearch
./elasticsearch: fork: retry: Resource temporarily unavailable
./elasticsearch: fork: retry: Resource temporarily unavailable
./elasticsearch: fork: retry: Resource temporarily unavailable
./elasticsearch: fork: retry: Resource temporarily unavailable
I fund the file "jvm.options" in the folder "config".
I have change the parameters "Xms" and "Xmx" with "1g" or "8 g" and nothing.
Always the same error.
I found the problem.
I increase the number of processus of user "elasticsearch" of 2 to 200 to modify the file "/etc/security/limits.conf" and added the line
elasticsearch hard nproc 200
Now, I have a another problem:
[elasticsearch@pcyy4aix bin]$ ./elasticsearch
Exception in thread "main" SettingsException[Failed to load settings from /logiciels/elasticsearch-5.3.0/config/elasticsearch.yml]; nested: AccessDeniedException[/logiciels/elasticsearch-5.3.0/config/elasticsearch.yml];
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:107)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:63)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:58)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
at org.elasticsearch.cli.Command.main(Command.java:88)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
Caused by: java.nio.file.AccessDeniedException: /logiciels/elasticsearch-5.3.0/config/elasticsearch.yml
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1011)
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:105)
... 6 more
I fund this error's origin.
The folder of "elasticsearch" had the owner "root" instead of "elasticsearch".
Now, the process run:
496 7182 1 13 18:03 ? 00:00:19 /usr/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/logiciels/elasticsearch-5.3.0 -cp /logiciels/elasticsearch-5.3.0/lib/elasticsearch-5.3.0.jar:/logiciels/elasticsearch-5.3.0/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid -d -Edefault.path.logs=/var/log/elasticsearch -Edefault.path.data=/var/lib/elasticsearch -Edefault.path.conf=/etc/elasticsearch
But the connection at the URL "http://@IP:9200" don't answer.
Is it normal ?