我已在Debian 7 (wheezy)
中安装了Elasticsearch 6.x.我尝试从service elasticsearch start
开始,但它给了我一条错误消息
root@debian:~# sudo -i service elasticsearch start
[FAIL] Starting Elasticsearch Server: failed!
我试着查看nano /var/log/elasticsearch/elasticsearch.log
处的elasticsearch日志文件,我收到了此错误
[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
我该如何解决这个问题?我已经安装了java,它是version javac 1.8.0_151
我的代码可能出现什么问题? `
答案 0 :(得分:6)
我在通过YUM安装了ElasticSearch 7.8的CentOS7 cPanel服务器上遇到了相同的问题。 根据{{3}},我执行了以下操作:
ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp"
中设置/etc/sysconfig/elasticsearch
mkdir -p /var/lib/elasticsearch/tmp
chown -R elasticsearch.elasticsearch /var/lib/elasticsearch/tmp
答案 1 :(得分:3)
我希望你的问题能得到解决。
答案 2 :(得分:2)
检查/tmp/
目录的权限。它必须有noexec
。
/tmp
需要exec
才能支持JNA。解决方法是在elasticsearch sysconfig文件中指定tmp
目录。
像export JAVA_OPTS="-Djava.io.tmpdir=$ES_HOME/tmp"
确保有$ES_HOME/tmp
目录且elasticsearch
用户具有写入权限。
我遇到了这个问题,因为我使用的是强化操作系统,也因为默认的umask是0027
。
答案 3 :(得分:1)
从命令提示符运行时, Windows 10 上发生了同样的问题:
unable to load JNA native support library, native methods will be disabled.
要解决此问题,只需使用管理员权限运行 elasticsearch.exe 即可(单击开始 - &gt;键入&#34;命令&#34; - &gt;右键单击& #34;命令提示符&#34; - &gt;选择&#34;以管理员身份运行&#34;)
答案 4 :(得分:0)
好的,我找到了解决方案。显然我的vm内存存储(RAM)是1 GB - 2 GB,所以我将我的VM的RAM容量增加到至少4GB,然后我重启机器。弹性搜索开始工作得很好。
答案 5 :(得分:0)
以下对我有用的
PUT your_index_name/_settings
{
"index": {
"blocks": {
"read_only_allow_delete": "false"
}
}
}
我点击了以下链接:
https://discuss.elastic.co/t/forbidden-12-index-read-only-allow-delete-api/110282/4
答案 6 :(得分:0)
在Ubuntu 18.04上,解决方案是
sudo systemctl编辑--full elasticsearch.service
添加一行
Environment = ES_JAVA_OPTS =“-Djava.io.tmpdir = / var / lib / elasticsearch / tmp”
在vi中使用-x退出
重新启动服务
sudo systemctl重新启动elasticsearch.service