centos6安装elasticsearch6错误笔记

环境

服务器:centos6
elasticsearch:6
工具:CRT
操作系统:win7

场景

想装个elasticsearch6

错误

seccomp unavailable: requires kernel 3.5+

java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
        at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:328) ~[elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:616) ~[elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:258) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:109) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:130) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:121) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) [elasticsearch-6.0.0.jar:6.0.0]

这个错误是因为centos6的内核不支持SecComp,所以我们需要禁止这个功能:

[yutao@master01 config]# vim elasticsearch.yml

# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
bootstrap.system_call_filter: false

Failed to create temporary file for /com/sun/jna/linux-x86-64/libjnidispatch.so library

下面中/home/yutao/tmp/elasticsearch路径被我改过,默认不是这个,但是错都是一样的!

JNA Warning: IOException removing temporary files: JNA temporary directory '/home/yutao/tmp/elasticsearch' is not writable
[2017-12-02T17:54:50,683][WARN ][o.e.b.Natives            ] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/linux-x86-64/libjnidispatch.so library: JNA temporary directory '/home/yutao/tmp/elasticsearch' is not writable
        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.(Native.java:190) ~[jna-4.4.0-1.jar:4.4.0 (b0)]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_121]
        at java.lang.Class.forName(Class.java:264) ~[?:1.8.0_121]
        at org.elasticsearch.bootstrap.Natives.(Natives.java:45) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:130) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:121) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) [elasticsearch-6.0.0.jar:6.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) [elasticsearch-6.0.0.jar:6.0.0]

这个错基本是因为访问权限的原因造成的!

其在往tmp文件写入时,发现没有权限!

所以我就自己创建了一个tmp目录,并修改配置,指定好:

[yutao@master01 config]# vim jvm.options
# 上面省略。。。
# 在最后添加
-Djava.io.tmpdir=/home/yutao/tmp/elasticsearch
-Djna.tmpdir=/home/yutao/tmp/elasticsearch

java.nio.file.AccessDeniedException

[yutao@master01 elasticsearch-6.0.0]$ bin/elasticsearch-plugin install file:///home/yutao/download/x-pack-6.0.0.zip 

-> Downloading file:///home/yutao/download/x-pack-6.0.0.zip
Exception in thread "main" java.nio.file.AccessDeniedException: /tmp/2089611009639660923.zip
        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.createFile(Files.java:632)
        at java.nio.file.TempFileHelper.create(TempFileHelper.java:138)
        at java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:161)
        at java.nio.file.Files.createTempFile(Files.java:852)
        at org.elasticsearch.plugins.InstallPluginCommand.downloadZip(InstallPluginCommand.java:322)
        at org.elasticsearch.plugins.InstallPluginCommand.download(InstallPluginCommand.java:245)
        at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:213)
        at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:204)
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
        at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
        at org.elasticsearch.cli.Command.main(Command.java:90)
        at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:47)

我知道是权限问题,但是明明elasticsearch能正常启动,安装插件居然报错,
其实上面写修改elasticsearch启动脚本,还不如修改elasticsearch-env这个文件,这里是elasticsearch环境变量文件,修改方式和之前一样。

对于这个问题,我就是重新登录下CRT,就好了。

==============2017年12月2日 23点32分===========
特意记录下,上面我写到,重新登录下就好了,其实是因为重新登录后,我的登录用户变成了root,自然有权限往/tmp目录里写东西啦!

而当我以yutao用户登录,安装时,就会报没有权限,也就是上面这个错误;

我没有找到好的办法,我把/tmp的权限改为777,就可以安装啦!

但是我觉得 ,能指定这个路径才是最优的做法;

我在elastic中文社区提出了这个问题,知道的帮忙回答下谢谢:
https://elasticsearch.cn/question/2996

WWW-Authenticate”:”Basic realm=\”security\” charset=\”UTF-8\”

{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

输入默认用户和密码,就报这个错,猜想就是用户名和密码不对,虽然不明白为什么会不对,后来我执行下面命令重新生成密码:

[yutao@master01 elasticsearch-6.0.0]$ bin/x-pack/setup-passwords auto
Initiating the setup of reserved user elastic,kibana,logstash_system passwords.
The passwords will be randomly generated and printed to the console.
Please confirm that you would like to continue [y/N]y


Changed password for user kibana
PASSWORD kibana = WjFJ6G$lEH71W7K1+vcl

Changed password for user logstash_system
PASSWORD logstash_system = TS8ZR41smxm9o?F6gbBB

Changed password for user elastic
PASSWORD elastic = rc~ENBxy?18hOQ^R9OUJ

[yutao@master01 elasticsearch-6.0.0]$ 

Can not upgrade to a production license unless TLS is configured or security is disabled

{"error":{"root_cause":[{"type":"illegal_state_exception","reason":"Can not upgrade to a production license unless TLS is configured or security is disabled"}],"type":"illegal_state_exception","reason":"Can not upgrade to a production license unless TLS is configured or security is disabled"},"status":500}

这个错误,是因为elasticsearch6.0.0,现在更新license文件时,要么配置SSL\TLS,要么就禁用security

那就临时禁用,更新完了再启用就行了:

[yutao@master01 elasticsearch-6.0.0]$ vim config/elasticsearch.yml
# 以上省略。。。
xpack.security.enabled: false
#xpack.security.transport.ssl.enabled: true

更新完了license后,再改为:

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

bootstrap checks failed

ERROR: [1] bootstrap checks failed
[1]: Transport SSL must be enabled for setups with production licenses. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]
[2017-12-02T23:30:06,538][INFO ][o.e.n.Node               ] [FWGb82W] stopping ...
[2017-12-02T23:30:06,593][INFO ][o.e.n.Node               ] [FWGb82W] stopped
[2017-12-02T23:30:06,593][INFO ][o.e.n.Node               ] [FWGb82W] closing ...
[2017-12-02T23:30:06,610][INFO ][o.e.n.Node               ] [FWGb82W] closed

这是因为更新license并启动xpack.security.enabled: true,后必须也要启用xpack.security.transport.ssl.enabled: true

小技巧

因为elasticsearch不能使用root用户登录,而我一般都是使用root登录CRT的,所以可以使用:

su yutao

临时切下身份,可以使用ctrl + D,再切换回来。

参考地址:

elasticsearch fails to start when tmp directory defined

Elasticsearch 2.2 fails to start with jna tmp dir configured

你可能感兴趣的:(Java,elasticsearch,es库)