elasticsearch-head插件的安装
- 以前装过低版本的直接放入到es的plugins目录下就行了,5.0以后独立运行。
- 安装elasticsearch-head插件需要nodejs的支持
- nodejs Linux Binaries (x64)下载地址:https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.xz
- tar -xvf node-v10.15.0-linux-x64.tar.xz -C /usr/local/
- echo 'export PATH=/usr/local/node-v10.15.0-linux-x64/bin:$PATH '>>/etc/profile
- source /etc/profile
- 查看node版本号:node -v
- ///
- 修改vim /usr/local/elasticsearch-head/Gruntfile.js
- 在connect-->server-->options下面添加hostname: '*' 允许所有ip访问
- ///
-
elasticsearch-head插件下载地址:https://github.com/mobz/elasticsearch-head,该插件不能放到es的plugins目录下了,不然启动es会报错,报错如下:
- cd /usr/local/elasticsearch-head/
- npm install //执行该步骤会报错
- 如果下载慢使用淘宝镜像
- npm install --registry=https://registry.npm.taobao.org
- npm install phantomjs-prebuilt@2.1.16 --ignore-scripts //忽略phantomjs-prebuilt@2.1.16
- npm run start //启动elastichsearch-head,加&后台启动
- 访问http://IP:9100没有任何信息,连接不上es
- 需要在es的配置文件中添加允许es跨域访问配置
- vim elasticsearch.yml
- http.cors.enabled: true
- http.cors.allow-origin: "*"
- 修改完重启es之后可以通过head插件连接es了
- 由于head插件和es服务在一台机器上,如果不在一台服务器上,需要修改
- cd /usr/local/elasticsearch-head/_site
- vim app.js
-
将this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";中的localhost修改为es服务所在服务器的IP地址
-
启动head插件也可以使用该命令
-
cd /usr/local/elasticsearch-head/node_modules/grunt/bin
-
./grunt server
ik分词插件的安装
-
ik分词插件下载地地址: https://github.com/medcl/elasticsearch-analysis-ik/releases,ik分词插件版本要和es版本对应
-
下载es的IK插件命名改为ik插件
-
直接上传到es的plugins目录下就可以了
-
启动看日志接在ik插件
-
测试ik分词生效
-
自定义分词
-
cd /usr/local/elasticsearch-6.5.4/plugins/ik/config
-
mkdir customer
-
vim new_word.dic
-
王者荣耀
-
vi IKAnalyzer.cfg.xml
-
重启es
-
自定义扩展字典成功