在linux虚拟机安装Elasticsearch遇到的问题及解决方法

本文涉及的产品
检索分析服务 Elasticsearch 版,2核4GB开发者规格 1个月
简介: 在linux虚拟机安装Elasticsearch遇到的问题及解决方法[0] unable to load JNA native support library, native methods will be disabled[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536][2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at leas

在linux虚拟机安装Elasticsearch遇到的问题及解决方法

[0] unable to load JNA native support library, native methods will be disabled

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

[3]: JVM is using the client VM [Java HotSpot(TM) Client VM] but should be using a server VM for the best performance

[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk


[0] unable to load JNA native support library, native methods will be disabled

[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:/home/leyou/elasticsearch/lib/jts-core-1.15.0.jar, file:/home/leyou/elasticsearch/lib/elasticsearch-core-6.3.0.jar, file:/home/leyou/elasticsearch/lib/jna-4.5.1.jar, file:/home/leyou/elasticsearch/lib/lucene-analyzers-common-7.3.1.jar, file:/home/leyou/elasticsearch/lib/lucene-spatial-7.3.1.jar, file:/home/leyou/elasticsearch/lib/lucene-queries-7.3.1.jar, file:/home/leyou/elasticsearch/lib/lucene-suggest-7.3.1.jar, file:/home/leyou/elasticsearch/lib/snakeyaml-1.17.jar, file:/home/leyou/elasticsearch/lib/lucene-spatial3d-7.3.1.jar, file:/home/leyou/elasticsearch/lib/lucene-grouping-7.3.1.jar, file:/home/leyou/elasticsearch/lib/elasticsearch-6.3.0.jar, file:/home/leyou/elasticsearch/lib/log4j-api-2.9.1.jar, file:/home/leyou/elasticsearch/lib/t-digest-3.2.jar, file:/home/leyou/elasticsearch/lib/lucene-spatial-extras-7.3.1.jar, file:/home/leyou/elasticsearch/lib/lucene-queryparser-7.3.1.jar, file:/home/leyou/elasticsearch/lib/spatial4j-0.7.jar, file:/home/leyou/elasticsearch/lib/hppc-0.7.1.jar, file:/home/leyou/elasticsearch/lib/jackson-dataformat-smile-2.8.10.jar, file:/home/leyou/elasticsearch/lib/lucene-memory-7.3.1.jar, file:/home/leyou/elasticsearch/lib/lucene-sandbox-7.3.1.jar, file:/home/leyou/elasticsearch/lib/jackson-dataformat-yaml-2.8.10.jar, file:/home/leyou/elasticsearch/lib/elasticsearch-launchers-6.3.0.jar, file:/home/leyou/elasticsearch/lib/jopt-simple-5.0.2.jar, file:/home/leyou/elasticsearch/lib/plugin-cli-6.3.0.jar, file:/home/leyou/elasticsearch/lib/lucene-core-7.3.1.jar, file:/home/leyou/elasticsearch/lib/log4j-1.2-api-2.9.1.jar, file:/home/leyou/elasticsearch/lib/jackson-dataformat-cbor-2.8.10.jar, file:/home/leyou/elasticsearch/lib/lucene-highlighter-7.3.1.jar, file:/home/leyou/elasticsearch/lib/elasticsearch-x-content-6.3.0.jar, file:/home/leyou/elasticsearch/lib/lucene-backward-codecs-7.3.1.jar, file:/home/leyou/elasticsearch/lib/HdrHistogram-2.1.9.jar, file:/home/leyou/elasticsearch/lib/plugin-classloader-6.3.0.jar, file:/home/leyou/elasticsearch/lib/joda-time-2.9.9.jar, file:/home/leyou/elasticsearch/lib/elasticsearch-cli-6.3.0.jar, file:/home/leyou/elasticsearch/lib/log4j-core-2.9.1.jar, file:/home/leyou/elasticsearch/lib/lucene-join-7.3.1.jar, file:/home/leyou/elasticsearch/lib/jackson-core-2.8.10.jar, file:/home/leyou/elasticsearch/lib/lucene-misc-7.3.1.jar, file:/home/leyou/elasticsearch/lib/elasticsearch-secure-sm-6.3.0.jar])
  at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:962) ~[jna-4.5.1.jar:4.5.1 (b0)]
  at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) ~[jna-4.5.1.jar:4.5.1 (b0)]
  at com.sun.jna.Native.<clinit>(Native.java:190) ~[jna-4.5.1.jar:4.5.1 (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-6.3.0.jar:6.3.0]
  at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) [elasticsearch-6.3.0.jar:6.3.0]
  at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) [elasticsearch-6.3.0.jar:6.3.0]
  at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) [elasticsearch-6.3.0.jar:6.3.0]
  at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) [elasticsearch-6.3.0.jar:6.3.0]
  at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) [elasticsearch-6.3.0.jar:6.3.0]
  at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.3.0.jar:6.3.0]
  at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.3.0.jar:6.3.0]
  at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.3.0.jar:6.3.0]
  at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.3.0.jar:6.3.0]
  at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) [elasticsearch-6.3.0.jar:6.3.0]

抛出的异常是说找不到JNA的本地依赖。

解决:

在elasticsearch的安装目录的bin下直接下载需要的JNA jar包

wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/4.5.1/jna-4.5.1.jar

或者把原来的JNA 的jar包删除,在windows下重新下载jna jar包,后上传到elasticsearch的lib文件中。

重新运行: ./elasticsearch


下面提供jna 4.5.1 jar包:

链接:https://pan.baidu.com/s/1ZkO557yf1JC2r-o0ysb1YA

提取码:u86i


运行之后出现新的错误

ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: JVM is using the client VM [Java HotSpot(TM) Client VM] but should be using a server VM for the best performance
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

编辑 /etc/security/limits.conf,追加以下内容;


soft nofile 65536

hard nofile 65536

此文件修改后需要重新登录用户,才会生效



[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

编辑 /etc/sysctl.conf,追加以下内容:

vm.max_map_count=655360

保存后,执行:

sysctl -p


[3]: JVM is using the client VM [Java HotSpot™ Client VM] but should be using a server VM for the best performance

意思是当前jvm是Java HotSpot Client VM(-client),而应该使用的是Java HotSpot Server VM(-server),前者如其名称,应该适合在客户端使用,后者则适合在服务器环境中使用。

所以只需要从Java HotSpot Client VM(-client)切换到Java HotSpot Server VM(-server)就行。

找到jre目录,切换到该下

cd /usr/local/jdk/jdk1.8.0_05/jre

然后修改 ./lib/i386/jvm.cfg这个文件,把-server KNOWN移到第一行,就是-client上面,保存退出即可。

2.jpg


[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

在 config/elasticsearch.yml 末尾加上一句

bootstrap.system_call_filter: false

重新运行: ./elasticsearch

3.jpg

出现这些信息就是启动成功了。

我这里是要访问 192.168.237.128:9200

相关实践学习
使用阿里云Elasticsearch体验信息检索加速
通过创建登录阿里云Elasticsearch集群,使用DataWorks将MySQL数据同步至Elasticsearch,体验多条件检索效果,简单展示数据同步和信息检索加速的过程和操作。
ElasticSearch 入门精讲
ElasticSearch是一个开源的、基于Lucene的、分布式、高扩展、高实时的搜索与数据分析引擎。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr(也是基于Lucene)。 ElasticSearch的实现原理主要分为以下几个步骤: 用户将数据提交到Elastic Search 数据库中 通过分词控制器去将对应的语句分词,将其权重和分词结果一并存入数据 当用户搜索数据时候,再根据权重将结果排名、打分 将返回结果呈现给用户 Elasticsearch可以用于搜索各种文档。它提供可扩展的搜索,具有接近实时的搜索,并支持多租户。
相关文章
|
1天前
|
Linux C语言 虚拟化
VM和Linux的安装
VM和Linux的安装
|
1天前
|
关系型数据库 MySQL Linux
【菜鸟版】 Linux 安装 MySql 5.7
【菜鸟版】 Linux 安装 MySql 5.7
9 2
|
1天前
|
存储 Linux Android开发
Volatility3内存取证工具安装及入门在Linux下的安装教程
Volatility 是一个完全开源的工具,用于从内存 (RAM) 样本中提取数字工件。支持Windows,Linux,MaC,Android等多类型操作系统系统的内存取证。针对竞赛这块(CTF、技能大赛等)基本上都是用在Misc方向的取证题上面,很多没有听说过或者不会用这款工具的同学在打比赛的时候就很难受。以前很多赛项都是使用vol2.6都可以完成,但是由于操作系统更新,部分系统2.6已经不支持了,如:Win10 等镜像,而Volatility3是支持这些新版本操作系统的。
|
1天前
|
网络协议 Java
elasticsearch7.1 安装启动报错
elasticsearch7.1 安装启动报错
6 1
|
1天前
|
自然语言处理 数据可视化 Linux
ElasticSearch安装ik分词器_使用_自定义词典
ElasticSearch安装ik分词器_使用_自定义词典
6 1
|
1天前
Elasticsearch安装配置文件
Elasticsearch安装配置文件
5 0
|
1天前
|
安全
【Elasticsearch6】安装笔记
【Elasticsearch6】安装笔记
7 2
|
1天前
|
关系型数据库 MySQL Linux
mysql在linux下安装
mysql在linux下安装
15 3
|
1天前
|
Linux 开发工具
linux下安装Anaconda3
linux下安装Anaconda3
10 1
|
2天前
|
存储 自然语言处理 网络协议
【elastic search】下载安装、使用教程
【elastic search】下载安装、使用教程
10 1