报错如下:
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
flying-bird@flyingbird:~/elk$ ./elasticsearch-5.5.2/bin/elasticsearch -p my_cluster/node1_pid -Epath.conf=./my_cluster/node1/config
[2017-08-28T20:39:04,823][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 (...)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:962) ~[jna-4.4.0.jar:4.4.0 (b0)]
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) ~[jna-4.4.0.jar:4.4.0 (b0)]
at com.sun.jna.Native.<clinit>(Native.java:190) ~[jna-4.4.0.jar:4.4.0 (b0)]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_05]
at java.lang.Class.forName(Class.java:259) ~[?:1.8.0_05]
at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:45) [elasticsearch-5.5.2.jar:5.5.2]
...
[2017-08-28T20:39:04,829][WARN ][o.e.b.Natives ] cannot check if running as root because JNA is not available
[2017-08-28T20:39:04,829][WARN ][o.e.b.Natives ] cannot install system call filter because JNA is not available
[2017-08-28T20:39:04,830][WARN ][o.e.b.Natives ] cannot register console handler because JNA is not available
[2017-08-28T20:39:04,832][WARN ][o.e.b.Natives ] cannot getrlimit RLIMIT_NPROC because JNA is not available
[2017-08-28T20:39:04,832][WARN ][o.e.b.Natives ] cannot getrlimit RLIMIT_AS beacuse JNA is not available
[2017-08-28T20:39:04,992][INFO ][o.e.n.Node ] [node1] initializing ...
原 因 :是因为jna版本问题!(也可能jdk版本原因)
解决方法:删除elasticsearch/bin文件下的jna的jar包(我的是4.5.1版本),采用4.4.0版本
mv jna-4.5.1.jar jna-4.5.1.jar.bak
下载jna4.4.0版本,链接:
https://www.mvnjar.com/net.java.dev.jna/jna/4.4.0/detail.html
由于我执行下载命令报501错误没有解决(有大佬帮解决一下做好啦),所以采用此种方法!
再次执行就可以成功啦!
参阅文章:https://blog.csdn.net/a_flying_bird/article/details/77657803#comments