需要准备的安装包 丢在 /data/source/es
- elasticsearch-6.2.4.tar.gz
- kibana-6.2.4-linux-x86_64.tar.gz
词库插件 丢在 /data/source/es
- elasticsearch-analysis-ik-6.2.4.zip
- elasticsearch-analysis-pinyin-6.2.4.zip
- elasticsearch-analysis-stconvert-6.2.4.zip
扩展词库 丢在 /data/source/es/elasticsearch-6.2.4/plugins/ik/config/custom
扩展词库 近义词 丢在 /data/source/es/elasticsearch-6.2.4/plugins/ik
需要打开端口
安装开始
# 1.安装ES
mkdir /data/source
mkdir /data/source/es
tar -zxvf elasticsearch-6.2.4.tar.gz
vim elasticsearch-6.2.4/config/elasticsearch.yml
# 打开
cluster.name: my-application
node.name: node-1
network.host: 内网ip
http.port: 9200
# 末尾新增
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
#启动
./elasticsearch-6.2.4/bin/elasticsearch -d
#检测服务
curl http://内网ip:9200
#安装成功 返回成功
{
"name" : "GdjRcpG",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "NU4COCBZSwy5XsrVg03n-g",
"version" : {
"number" : "6.2.4",
"build_hash" : "ccec39f",
"build_date" : "2018-04-12T20:37:28.497551Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
# 2.安装IK 中文分词
cd /data/source/es/elasticsearch-6.2.4/plugins
cp /data/source/es/elasticsearch-analysis-* ./
cd ./ik/config
mkdir custom
# my_extra.dic 配置自己的扩展词典
# synonym.txt 丢在 ik/ 下
vim IKAnalyzer.cfg.xml
<entry key="ext_dict">custom/my_extra.dic</entry>
unzip elasticsearch-analysis-ik-6.2.4.zip -d ik
mv ./ik/elasticsearch/* ./ik/
unzip elasticsearch-analysis-pinyin-6.2.4.zip -d pinyin
mv ./pinyin/elasticsearch/* ./pinyin/
unzip elasticsearch-analysis-stconvert-6.2.4.zip -d stconvert
mv ./stconvert/elasticsearch/* ./stconvert/
# 3.关闭/重启
cd /data/source/es
ps -ef | grep elas
kill - 9 pid
./elasticsearch-6.2.4/bin/elasticsearch -d
#4.安装kibana
tar -zxvf kibana-6.2.4-linux-x86_64.tar.gz
cd kibana-6.2.4-linux-x86_64
vim config/kibana.yml
# 解开注释
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.url: "http://内网地址:9200"
kibana.index: ".newkibana"
# 启动
nohup ./bin/kibana &
curl http://内网ip:5601
# 问题 FATAL Port 5601 is already in use. Another instance of Kibana may be running!
kibana.index:原来默认是".kibana",但是新版本的kibana启动之后发现无法访问,访问之后抛出一个异常:kibana server is not ready yet,那么回来把配置更改成".newkibana",然后重启kibana,再次访问,即可成功。
#5.词库热更新 问题解决 1min/updatte
修改 IKAnalyzer.cfg.xml
remote_ext_dict : http://127.0.0.1:7033/search/MyWord.dic
remote_ext_stopwords: http://127.0.0.1:7033/search/MyStop.dic
Caused by: java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:8080" "connect,resolve")
#解决办法 $JAVA_HOME/jre/lib/security/java.policy 添加 权限
//操作Socket端口的各种权限
permission java.net.SocketPermission "-", "listen";
permission java.net.SocketPermission "-", "accept";
permission java.net.SocketPermission "*:*","connect,resolve";
//读写文件的权限
permission java.io.FilePermission "-", "read";
permission java.io.FilePermission "-", "write";
#MAC wq 保存失败
E45: 'readonly' option is set (add ! to override)
wq-> w !sudo tee %