1、下载官网 (版本 7.6.2)
压缩包下载
2、liunx服务器安装
示例:放入 /home/es 文件夹
cd /home/es
tar -xzf elasticsearch-7.6.2-linux-x86_64.tar.gz
进入目录
cd elasticsearch-7.6.2
3、修改配置
vim config/elasticsearch.yml
#允许外部访问
network.host: 0.0.0.0
#集群名称
node.name: node-1
#启用端口
http.port: 9600
#数据目录
path.data: /home/es/data
#日志目录
path.logs: /home/es/logs
#如果不配置,会出现错误:system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
bootstrap.system_call_filter: false
#集群发现
discovery.zen.ping.unicast.hosts: ["192.168.1.1"]
#集群配置需要有
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]
4、配置环境变量
vi /etc/profile
#es 环境变量
ELASTICSEARCH_HOME=//home/es/elasticsearch-7.6.2
PATH=$PATH:$ELASTICSEARCH_HOME/bin
export ELASTICSEARCH_HOME PATH
让环境变量配置立即生效:
source /etc/profile
5、创建新用户
原因:不能使用root用户启动
解决方案:改用别的用户
groupadd esgroup
adduser esadmin -g esgroup
passwd esadmin
# 密码不能太简单,需要大于8位 ,我这里是 esadmin123456
chown -R esadmin:esgroup .
切换用户 su esadmin
6、给用户设置权限 (登录 root用户)
[root@hcss-ecs-ba24 ~]# cd /home/es/logs/
[root@hcss-ecs-ba24 logs]# chown esadmin elasticsearch.log
[root@hcss-ecs-ba24 logs]# chown esadmin elasticsearch_server.json
[root@hcss-ecs-ba24 logs]# sudo chown -R esadmin:esgroup /home/es/data
[root@hcss-ecs-ba24 logs]# sudo chmod -R 775 /home/es/data
[root@hcss-ecs-ba24 logs]# drwxrwxr-x 2 esadmin esgroup 4096 Jun 3 12:34 /home/es/data/nodes
5、启动
cd /home/es/elasticsearch-7.6.2
./bin/elasticsearch
后台启动
nohup ./bin/elasticsearch > elasticsearch.log 2>&1 &
查看启动进程
ps aux | grep elasticsearch
查看日志打印
tail -f /home/es/logs/elasticsearch.log
可视化界面
https://elasticvue.com/