I have installed Elasticsearch 6.x in my Debian 7 (wheezy)
. I tried to start with service elasticsearch start
but its give me an error message
root@debian:~# sudo -i service elasticsearch start
[FAIL] Starting Elasticsearch Server: failed!
I tried to look at the elasticsearch log files at nano /var/log/elasticsearch/elasticsearch.log
, and i got this error
[2017-12-14T11:25:39,153][WARN ][o.e.b.Natives ] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/linux-x86/libjnidispatch.so) not found in resource path ([file:/usr/share/elasticsearch/lib/lucene-spatial-$
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:962) ~[jna-4.4.0-1.jar:4.4.0 (b0)]
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) ~[jna-4.4.0-1.jar:4.4.0 (b0)]
at com.sun.jna.Native.<clinit>(Native.java:190) ~[jna-4.4.0-1.jar:4.4.0 (b0)]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_151]
at java.lang.Class.forName(Class.java:264) ~[?:1.8.0_151]
at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:45) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.1.0.jar:6.1.0]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.1.0.jar:6.1.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) [elasticsearch-6.1.0.jar:6.1.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) [elasticsearch-6.1.0.jar:6.1.0]
[2017-12-14T11:25:39,212][WARN ][o.e.b.Natives ] cannot check if running as root because JNA is not available
[2017-12-14T11:25:39,212][WARN ][o.e.b.Natives ] cannot install system call filter because JNA is not available
[2017-12-14T11:25:39,215][WARN ][o.e.b.Natives ] cannot register console handler because JNA is not available
[2017-12-14T11:25:39,256][WARN ][o.e.b.Natives ] cannot getrlimit RLIMIT_NPROC because JNA is not available
[2017-12-14T11:25:39,256][WARN ][o.e.b.Natives ] cannot getrlimit RLIMIT_AS beacuse JNA is not available
[2017-12-14T11:25:39,256][WARN ][o.e.b.Natives ] cannot getrlimit RLIMIT_FSIZE because JNA is not available
How can i fixed this ? i have installed java, and it's version javac 1.8.0_151
what could go wrong with my code ? `
/etc/sysconfig/elasticsearch
Add ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp"
.
(For newer Elasticsearch, use Djava.io.tmpdir
instead of Djna.tmpdir
)
systemctl start elasticsearch
or service start elasticsearch
.tmp
folder created inside /var/lib/elasticsearch/
.elasticsearch
useri -l /var/lib/elasticsearch
Make sure the permission file have something like below permission
dr-xr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root lib
drwxr-x--- elasticsearch elasticsearch elasticsearch
I hope your issue will be resolved.
I had the same issue on a CentOS7 cPanel server with ElasticSearch 7.8 installed via YUM. As per the answer, I did the following:
ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp"
in /etc/sysconfig/elasticsearch
mkdir -p /var/lib/elasticsearch/tmp
chown -R elasticsearch.elasticsearch /var/lib/elasticsearch/tmp
Check the permissions on your /tmp/
directory. It must have had noexec
.
/tmp
needs exec
to support JNA. A workaround is to specify a tmp
directory in elasticsearch sysconfig file.
Something like export JAVA_OPTS="-Djava.io.tmpdir=$ES_HOME/tmp"
Make sure there is a $ES_HOME/tmp
directory and elasticsearch
user has write permissions to it.
I had this issue as I was using a hardened OS and also because the default umask is 0027
.
The same problem happened to me on Windows 10 when running from command prompt:
unable to load JNA native support library, native methods will be disabled.
To solve this, it was enough to run elasticsearch.exe with Admin rights (Click Start -> type "Command" -> right click on "Command Prompt" -> select "Run as Administrator")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With