1、下载地址:https://www.elastic.co/cn/downloads/elasticsearch
2、下载完成后上传到目标服务器
// An highlighted block
tar -zxvf elasticsearch-7.8.0-linux-x86_64.tar.gz
mv elasticsearch-7.8.0 /usr/local
cd elasticsearch-7.8.0/config
vim elasticsearch.yml
修改elasticsearch.yml
//修改配置文件中如下内容
cluster.name: wshop-elasticserach
node.name: es-node1
path.data: /usr/local/elasticsearch-7.8.0/data
path.logs: /usr/local/elasticsearch-7.8.0/logs
network.host: 0.0.0.0
http.port: 9200
cluster.initial_master_nodes: [“es-node1”]
//同在elasticserach.yml文件中,在network最后加两行,开启跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
修改jvm.options
//本地虚拟机内存设置小一点,生产环境可以根据情况设置大一点
-Xms128m
-Xmx128m
创建esuser启动用户
//创建esuser用户,将文件夹授权给esuser
useradd esuser
chown -R esuser:esuser /usr/local/elasticsearch-7.8.0
修改 /etc/security/limits.conf、/etc/sysctl.conf
vim /etc/security/limits.conf
//在最后一行上方添加如下内容
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
vim /etc/sysctl.conf
//在最下方添加如下内容
vm.max_map_count=262145
//保存成功后,刷新配置
sysctl -p
切换用户,启动es
su esuser
cd /usr/local/elasticserach-7.8.0/bin
./elasticserach -d
启动完成后,通过ip:9200访问
记得开启9200端口
firewall-cmd --add-port=9200/tcp --permanent
firewall-cmd --reload
3、下载elasticserach-head
//进入windows本地文件夹,启动git bash,执行如下命令
git clone git://github.com/mobz/elasticserach-head.git
cd elasticserach-head
npm install
npm run start
启动后通过localhost:9100 访问,连接es即可