千家信息网

es5.4安装head、ik中文分词插件

发表于:2025-02-07 作者:千家信息网编辑
千家信息网最后更新 2025年02月07日,安装maven打包工具wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.
千家信息网最后更新 2025年02月07日es5.4安装head、ik中文分词插件
  1. 安装maven打包工具

wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gztar -xf apache-maven-3.3.9-bin.tar.gzmv apache-maven-3.3.9 /usr/local/data/apache-mavenvim /etc/profileexport MAVEN_HOME=/usr/local/data/apache-mavenexport PATH=$PATH:$MAVEN_HOME/binsource /etc/profile

2. 安装ik分词

git  clone https://github.com/medcl/elasticsearch-analysis-ikcd elasticsearch-analysis-ik/mvn packagell /usr/local/data/elasticsearch-analysis-ik/target/releases/total 4400-rw-r--r-- 1 root root 4502096 May 26 11:29 elasticsearch-analysis-ik-5.4.0.zip

创建分词目录

mkdir /usr/local/data/elasticsearch/plugins/ikcp target/releases/elasticsearch-analysis-ik-5.4.0.zip  /usr/local/data/elasticsearch/plugins/ik/cd /usr/local/data/elasticsearch/plugins/ik && unzip elasticsearch-analysis-ik-5.4.0.zipchown -R es.es /usr/local/data/elasticsearch

测试分词

http://172.16.230.198:9200/index/_analyze?analyzer=ik_max_word&text=×××

3.安装head插件

yum -y install git npmgit clone git://github.com/mobz/elasticsearch-head.gitcd elasticsearch-headnpm installnpm install -g cnpm --registry=修改head监听地址为内网vim Gruntfile.js                connect: {                        server: {                                options: {                                        hostname:'172.16.230.198',                                        port: 9100,                                        base: '.',                                        keepalive: true                                }                        }                }后台启动elasticsearch-head 插件npm install grunt-cliln -s /usr/local/data/elasticsearch-head/node_modules/grunt/bin/grunt  /usr/bin/grunt  server &

遇到的问题:head 插件无法连接es集群 显示集群健康值未连接

修改head的es监听地址

cd elasticsearch-headvim _site/app.js

修改 『http://localhost:9200』字段到本机ES端口与IP

vim $ES_HOME$/config/elasticsearch.yml# 增加如下字段http.cors.enabled: truehttp.cors.allow-origin: "*"

重启es 和head即可


0