1、官网下载对应版本

https://www.elastic.co/cn/downloads/past-releases#elasticsearch
本次使用7.8版本
image.png

2、下载上传到服务器解压

image.png

3、配置-启动

  1. #ES 不允许 root 用户直接运行,所以要创建新用户,在 root 用户中创建新用户
  2. useradd es #新增 es 用户
  3. passwd es #为 es 用户设置密码
  4. userdel -r es #如果错了,可以删除再加
  5. chown -R es:es /opt/module/es #文件夹所有者
  1. vim config/elasticsearch.yml
  2. # 加入如下配置
  3. cluster.name: elasticsearch
  4. node.name: node-1
  5. network.host: 0.0.0.0
  6. http.port: 9200
  7. cluster.initial_master_nodes: ["node-1"]
  1. # 在文件末尾中增加下面内容
  2. # 每个进程可以打开的文件数的限制
  3. vim /etc/security/limits.conf
  4. es soft nofile 65536
  5. es hard nofile 65536
  6. # 在文件末尾中增加下面内容
  7. # 每个进程可以打开的文件数的限制
  8. vim /etc/security/limits.d/20-nproc.conf
  9. es soft nofile 65536
  10. es hard nofile 65536
  11. * hard nproc 4096
  12. 重新加载
  13. sysctl -p
  1. cd /opt/module/es/
  2. #启动
  3. bin/elasticsearch
  4. #后台启动
  5. bin/elasticsearch -d

启动失败文件所述问题,执行一下命令
chown -R es:es /opt/module/es #文件夹所有者