# 下载 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.2-linux-x86_64.tar.gz # 解压 tar -zxvf /usr/local/elasticsearch-7.15.2-linux-x86_64.tar.gz # 创建ES用户和用户组 groupadd elasticsearch useradd elasticsearch -g elasticsearch -p elasticsearch # 更改ES文件的所属用户组及用户 chown -R elasticsearch:elasticsearch /usr/local/elasticsearch-7.15.2 # 切换用户 su elasticsearch # 前台启动ES cd elasticsearch-7.15.2/bin ./elasticsearch # 或者后台启动ES cd elasticsearch-7.15.2/bin ./elasticsearch -d # 测试连接ES,当结果输出JSON数据则说明ES启动成功 curl -XGET "127.0.0.1:9200"
# 关闭后台运行的ES
ps -aux|grep elasticsearch
kill -9 pid