Elasticsearch 安装及注意事项

最近公司项目用到了elasticsearch,一个搜索引擎,具休功能不做介绍了,在安装过程中遇到一些问题,即做记录于此。

安装

下载elasticsearch-6.4.0.tar.gz

1
2
> tar -zxvf elasticsearch-6.4.0.tar.gz
> cd /elasticsearch-6.4.0/config

修改jvm启动参数

1
2
3
> vim jvm.options
-Xms512M
-Xmx512M

修改elasticsearch.yml

1
2
3
4
5
6
7
8
9
10
11
#修改elasticsearch配置文件
> vim elasticsearch.yml
path.data: /usr/local/elasticsearch-6.4.0/data
path.logs: /usr/local/elasticsearch-6.4.0/logs
#在bootstrap.memory_lock: true 下面添加 bootstrap.system_call_filter: false
#这是在因为Centos6不支持SecComp,而ES6.4.0默认bootstrap.system_call_filter为true进行检测,
#所以导致检测失败,失败后直接导致ES不能启动
bootstrap.system_call_filter: false

network.host: 192.168.137.100
http.port: 9200

由于安全原因,elasticsearch不请允许root直接启动,所以创建elasticsearch用户

1
2
3
> groupadd elsearch
> useradd elsearch -g elsearch -p elasticsearch
> chown -R elsearch:elsearch elasticsearch-6.4.0 #elasticsearch安装目录

配置limits.conf

1
2
3
4
5
6
7
8
9
10
11
#在文件最后添加如下内容
> vim /etc/security/limits.conf
elsearch hard nofile 65536
elsearch soft nofile 65536
elsearch soft nproc 4096
elsearch hard nproc 4096

> vim /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
#将1024修改为4096
* soft nproc 4096

设置vm.max_map_count

1
2
3
4
5
> vim /etc/sysctl.conf
#文件最后添加
vm.max_map_count=262144

> sysctl -p

启动elasticsearch

1
2
> cd /elasticsearch-6.4.0/bin
> ./elasticsearch -d #后台启动命令

原文作者: dgb8901,yinxing

原文链接: https://www.itwork.club/2018/09/26/install-elasticsearch/

版权声明: 转载请注明出处

为您推荐

体验小程序「简易记账」

关注公众号「特想学英语」

Install zsh-autosuggestions