ElasticSearch学习中的坑

Posted helloworld6379

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ElasticSearch学习中的坑相关的知识,希望对你有一定的参考价值。

安装完启动报错:   解决,建立新用户执行

[root@localhost bin]# ./elasticsearch
[2019-09-01T05:56:36,875][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.2.jar:6.8.2]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.2.jar:6.8.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.2.jar:6.8.2]
	... 6 more

 

用非root用户启动 ,对文件没有执行权限: 对新用户赋予可执行权限 chown -R es:es elasticsearch-6.8.2/

[es@localhost bin]$ ./elasticsearch
Exception in thread "main" java.nio.file.AccessDeniedException: /opt/elasticsearch-6.8.2/config/jvm.options
	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.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:60)

 

ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败

[es@localhost elasticsearch-6.8.2]$ ./bin/elasticsearch
[2019-09-01T06:09:27,605][WARN ][o.e.b.JNANatives         ] [unknown] unable to install syscall filter: 
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
	at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:342) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:617) ~[elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:260) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:108) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.8.2.jar:6.8.2]
	at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) [elasticsearch-6.8.2.jar:6.8.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.8.2.jar:6.8.2]
[2019-09-01T06:09:45,111][INFO ][o.e.e.NodeEnvironment    ] [45eSasN] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [41.9gb], net total_space [46.9gb], types [rootfs]
[2019-09-01T06:09:45,112][INFO ][o.e.e.NodeEnvironment    ] [45eSasN] heap size [990.7mb], compressed ordinary object pointers [true]
[2019-09-01T06:09:45,115][INFO ][o.e.n.Node               ] [45eSasN] node name derived from node ID [45eSasNbScGS8amGSXmqtA]; set [node.name] to override
[2019-09-01T06:09:45,116][INFO ][o.e.n.Node               ] [45eSasN] version[6.8.2], pid[24758], build[default/tar/b506955/2019-07-24T15:24:41.545295Z], OS[Linux/2.6.32-642.el6.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_192/25.192-b12]

 

网上老哥解决办法:

elasticsearch.yml 添加 :

bootstrap.memory_lock: false

bootstrap.system_call_filter: false

 

以上是关于ElasticSearch学习中的坑的主要内容,如果未能解决你的问题,请参考以下文章

我在elasticsearch遇到的坑

ElasticSearch学习中的坑

Elasticsearch:Elastic Maps 现在支持机器学习异常层

Elasticsearch:使用 Elastic 机器学习进行 data frame 分析

elasticsearch学习

Elasticsearch之es学习工作中遇到的坑(陆续更新)