Linux环境安装Elasticsearch-6.4.3

在搭建环境之前首先配置好jdk环境,在此以jdk1.8为例(Elasticsearch7以上的要jdk11)

1、下载elasticsearch安装包

官方文档https://www.elastic.co/downloads/elasticsearch

注意:linux安装内存建议1g内存以上

2、上传elasticsearch安装包

3、解压elasticsearch

tar -zxvf elasticsearch-6.4.3.tar.gz

4、修改elasticsearch.yml

network.host: 192.168.212.151       #自己虚拟机ip

http.port: 9200

5、不能用root账号启动,

会报错 can not run elasticsearch as root

adduser es  #新增用户

passwd es  #修改密码

chown -R es  elasticsearch-6.4.3  #给用户es赋权限

6、启动,继续报错

bootstrap checks failed max virtual memory areas vm.max_map_count [65530] is

vi /etc/sysctl.conf

在最后一行添加:vm.max_map_count=655360

然后运行sysctl -p

7、vi  /etc/security/limits.conf

在最后一行添加

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

重启服务器即可

8、访问elasticsearch

关闭防火墙  systemctl stop firewalld.service

Linux环境安装Elasticsearch-6.4.3

9、重新启动es

sh elasticsearch -d