1、官网下载对应版本
https://www.elastic.co/cn/downloads/past-releases#elasticsearch
本次使用7.8版本
2、下载上传到服务器解压
3、配置-启动
#ES 不允许 root 用户直接运行,所以要创建新用户,在 root 用户中创建新用户
useradd es #新增 es 用户
passwd es #为 es 用户设置密码
userdel -r es #如果错了,可以删除再加
chown -R es:es /opt/module/es #文件夹所有者
vim config/elasticsearch.yml
# 加入如下配置
cluster.name: elasticsearch
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
cluster.initial_master_nodes: ["node-1"]
# 在文件末尾中增加下面内容
# 每个进程可以打开的文件数的限制
vim /etc/security/limits.conf
es soft nofile 65536
es hard nofile 65536
# 在文件末尾中增加下面内容
# 每个进程可以打开的文件数的限制
vim /etc/security/limits.d/20-nproc.conf
es soft nofile 65536
es hard nofile 65536
* hard nproc 4096
重新加载
sysctl -p
cd /opt/module/es/
#启动
bin/elasticsearch
#后台启动
bin/elasticsearch -d
启动失败文件所述问题,执行一下命令
chown -R es:es /opt/module/es #文件夹所有者