1. es镜像下载
https://thans.cn/mirror/elasticsearch.html
2. rz上传到/usr/local
3. 解压
tar -zxf elasticsearch-7.3.2-linux-x86_64.tar.gz
4. 配置elasticsearch.yml
cd /usr/local/elasticsearch-7.3.2/config
cp elasticsearch.yml elasticsearch.yml.bak
vim elasticsearch.yml
#集群名字必须一致
cluster.name: escluster
node.name: node-1
path.data: /usr/local/elasticsearch-7.3.2/data
path.logs: /usr/local/elasticsearch-7.3.2/logs
http.port: 9200
cluster.initial_master_nodes: ["node-1"]
network.host: 0.0.0.0
#是否有资格选举为master
node.master: true
node.data: true
http.cors.enabled: true
http.cors.allow-origin: "*"
#discovery.zen.minimum_master_nodes: 2
#discovery.zen.ping_timeout: 3s
#discovery.zen.ping.unicast.hosts: ["192.168.0.8:9200","192.168.0.6:9200","192.168.0.22:9200"]
5. 其他相关配置
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
#进程数
* soft nproc 4096
* hard nproc 4096
vim /etc/sysctl.conf
vm.max_map_count=655360
查看是否生效
sysctl -p
6. 启动
新建用户并授权
groupadd esgrp
useradd esusr -g esgrp
chown -R esusr:esgrp /usr/local/elasticsearch-7.3.2/
切换用户
su esusr
根目录启动es
./bin/elasticsearch
页面访问ip:port(9200)
7. 安装head插件
准备nodejs(https://www.cnblogs.com/zhi-leaf/p/10979629.html)
下载nodejs(选linux x64)
https://nodejs.org/en/download/
rz上传到/usr/local
解压
tar -xf node-v12.16.0-linux-x64.tar.xz
重命名
mv node-v12.16.0-linux-x64 nodejs
软链接
ln -s /usr/local/nodejs/bin/npm /usr/local/bin/
ln -s /usr/local/nodejs/bin/node /usr/local/bin/
查看nodejs是否安装成功
node -v
npm -v
安装grunt
npm install -g grunt
查看
grunt -version
下载elasticsearch-head
cd /usr/local/elasticsearch-7.3.2
git clone https://github.com/mobz/elasticsearch-head.git
百度云链接:https://pan.baidu.com/s/1Bq74rVzBNM9eppm2ALbVpQ 提取码:b3hn
进入head目录,修改Gruntfile.js添加:hostname: '0.0.0.0',
cd elasticsearch-head
vim Gruntfile.js
执行(https://blog.csdn.net/baidu_16839249/article/details/85007365)
npm cache clean --force
下载依赖
npm install -g cnpm --registry=https://registry.npm.taobao.org
启动head插件(二选一)
grunt server
npm run start
页面访问ip:port(9100)
8. 安装ik和拼音分词器
进入plugins目录
cd /usr/local/elasticsearch-7.3.2/plugins
新建分词器文件夹
mkdir analysis-ik
mkdir analysis-pinyin
git clone下载对应版本的分词器到对应的文件夹
IK中文分词器:https://github.com/medcl/elasticsearch-analysis-ik
拼音分词器:https://github.com/medcl/elasticsearch-analysis-pinyin
mvn package之后在target/releases目录下找到zip压缩包,解压至对应的plugins目录下
7.3.2ik链接:https://pan.baidu.com/s/1Lzg6J0QzvIpYgTuthiflxQ 提取码:g7uj
7.3.2pinyin链接:https://pan.baidu.com/s/1MAMcOrMT-slLepFe5Z6UdQ 提取码:ngmr
查看是否生效
重启es
页面访问ip:port(9200)/_cat/plugins
来源:oschina
链接:https://my.oschina.net/joininjoy/blog/3167772