1.访问官网,下载自己想要安装的版本,我这里下载是Elasticsearch 5.5.2版本,下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch
2.解压安装包
tar -xvf elasticsearch-5.5.2.gz
3.新建Elasticserach的启动用户es,并更改Elasticserach所属的用户和用户组
useradd es
passwd 密码
chown -R es:es elasticsearch-5.5.2
chmod -R 777 elasticsearch-5.5.2
4.切换用户,并启动Elasticsearch
su es
cd elasticsearch-5.5.2
bin/elasticsearch
看到上图所示的信息说明启动成功
5.访问测试
curl http://localhost:9200
看到如图所示的信息说明elasticsearch访问成功
6.Elasticsearch开启远程访问
关闭elasticsearch服务,并修改以下配置
vim /elasticsearch-5.5.2/config/elasticsearch.yml
path.data: /data/elasticsearch/data 数据存放目录
path.logs: /data/elasticsearch/logs 日志存放目录
network.host: 0.0.0.0 不限定ip访问
http.port: 9200 访问端口
7.启动失败解决方法
首次启动或者修改了配置文件之后,再次启动可能会报错导致启动失败
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
临时解决方法:
sysctl -w vm.max_map_count=655360
永久解决方法:
获取root权限后执行如下命令:
vim /etc/security/limits.conf
再文件末尾加上如下配置
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
临时解决方法:
sysctl -w vm.max_map_count=262144
永久解决方法:
vim /etc/sysctl.conf
文件末尾加上如下配置
max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解决方法:
vim /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048