温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux下安装Elasticsearch的步骤

发布时间:2021-07-23 15:11:29 来源:亿速云 阅读:167 作者:chen 栏目:大数据

本篇内容主要讲解“Linux下安装Elasticsearch的步骤”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Linux下安装Elasticsearch的步骤”吧!

安装部署

1. Linux安装

下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch

步骤一:上传Linux、解压

上传Linux服务器:
rz Elasticsearch 6.7.2

解压Es:
sudo tar xvf  Elasticsearch 6.7.2

步骤二:修改配置文件

步骤三:启动Es

[dev@lihuan1-dev.bj1.haodf.net elasticsearch-6.7.2]$ ./bin/elasticsearch

备注:后台启动
sh elasticsearch.sh  &
nohup sh elasticsearch &
nohup sh elasticsearch.sh &

问题1:java.nio.file.AccessDeniedException:Exception in thread "main" java.nio.file.AccessDeniedException: /home/elasticsearch/elasticsearch-6.7.2/config/jvm.options

原因:当前用户没有执行权限 

权限不足:[dev@lihuan1-dev.bj1.haodf.net elasticsearch-6.7.2]$ chown -R dev:dev elasticsearch-6.7.2

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

原因:用户拥有的内存权限太小,至少需要262144。

解决方案:方案一

  • 切换到root用户

  • 执行命令:sysctl -w vm.max_map_count=262144

  • 查看结果:sysctl -a|grep vm.max_map_count

  • 显示:vm.max_map_count = 262144

解决方案:方案二

[dev@lihuan1-dev.bj1.haodf.net elasticsearch-6.7.2]$ sudo vim /etc/sysctl.conf

  vm.max_map_count=655360

[dev@lihuan1-dev.bj1.haodf.net elasticsearch-6.7.2]$ sudo sysctl -p

问题3:system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

原因: 这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

解决方案: 在elasticsearch.yml中配置bootstrap.system_call_filter为false,

注意要在Memory下面:

bootstrap.memory_lock: false 
bootstrap.system_call_filter: false

问题4: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

解决方案:修改/etc/security/limits.conf文件

# End of file
* soft nofile 65536
* hard nofile 65536
* soft nproc 6552
"/etc/security/limits.conf" [converted] 53L, 1883C

使用 ulimit -Hn 查看当前值 

[dev@lihuan1-dev.bj1.haodf.net bin]$ sudo vim /etc/profile
[dev@lihuan1-dev.bj1.haodf.net bin]$ ulimit -Hn
65535

注意:修改完后要退出用户重启,再ulimit -Hn 查看当前值,已发生变化。 

2. Mac安装

步骤一:官网下载

步骤二:解压文件

步骤三:终端切换到bin目录下

/Documents/opt/elasticsearch-cluster/elasticsearch-7.2.1/elasticsearch-7.2.1/bin

步骤四:启动es

sh elasticsearch

步骤五:验证结果

http://localhost:9200/

{
    "name":"node-0",
    "cluster_name":"es-cluster-7.2.1",
    "cluster_uuid":"Fv0qn48ET1W7xvReE6QfcA",
    "version":{
        "number":"7.2.1",
        "build_flavor":"default",
        "build_type":"tar",
        "build_hash":"fe6cb20",
        "build_date":"2019-07-24T17:58:29.979462Z",
        "build_snapshot":false,
        "lucene_version":"8.0.0",
        "minimum_wire_compatibility_version":"6.8.0",
        "minimum_index_compatibility_version":"6.0.0-beta1"
    },
    "tagline":"You Know, for Search"
}

到此,相信大家对“Linux下安装Elasticsearch的步骤”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI