1.下载elasticSearch
2.上传到linux机器上
可以使用winSCP进行上传
winSCP下载地址:https://winscp.net/eng/download.php
3.解压elasticSearch文件并放到指定位置
tar -zxvf elasticsearch-6.8.4.tar.gz -C /usr/local/
4.修改elastic配置文件
cd /usr/local/elasticsearch-6.8.4/config/
vim elasticsearch.yml
打开并修改 node.name参数
打开并修改 path.logs参数
打开并修改 path.data参数
打开并修改network.host参数值为:0.0.0.0
添加跨域设置:
http.cors.enabled: true
http.cors.allow-origin: "*"
5.修改jvm.options文件
vim jvm.options
修改参数
-Xms256m
-Xmx256m
6.添加elastic用户
useradd esuser
添加esuser作为elasticSearch目录所有者
注意:root 不能运行elasticsearch
chown -R esuser /usr/local/elasticsearch-6.8.4
7运行elasticsearch
cd /usr/local/elasticsearch-6.8.4/bin
./elasticsearch -d
8.查看是否运行成功
在浏览器中打开linux电脑的IP地址的9200端口
例如:http://192.168.1.22:9200/,出现如下信息表示运行成功
9.安装中文分词器插件
下载相应的zip文件,解压到elasticsearch的plugins目录下
unzip elasticsearch-analysis-ik-6.8.4.zip -d /usr/local/elasticsearch-6.8.4/plugins/ik
修改配置文件
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">custom.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords"></entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>
在配置文件的同级目录下创建custom.dic文件 加入自定义的词语