ElasticSearch6.5.4安装elasticsearch-head插件,IK分词插件

elasticsearch-head插件的安装

  1. 以前装过低版本的直接放入到es的plugins目录下就行了,5.0以后独立运行。
  2. 安装elasticsearch-head插件需要nodejs的支持
  3. nodejs  Linux Binaries (x64)下载地址:https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.xz
  4. tar -xvf node-v10.15.0-linux-x64.tar.xz -C /usr/local/
  5. echo 'export PATH=/usr/local/node-v10.15.0-linux-x64/bin:$PATH '>>/etc/profile
  6. source /etc/profile
  7. 查看node版本号:node -v
  8. ///////////////////////////////////////////////////////////////////////////////////////////
  9. 修改vim /usr/local/elasticsearch-head/Gruntfile.js
  10. 在connect-->server-->options下面添加hostname: '*' 允许所有ip访问
  11. ///////////////////////////////////////////////////////////////////////////////////////////
  12.  
  13. elasticsearch-head插件下载地址:https://github.com/mobz/elasticsearch-head,该插件不能放到es的plugins目录下了,不然启动es会报错,报错如下:

  14. cd /usr/local/elasticsearch-head/
  15. npm install     //执行该步骤会报错
  16. 如果下载慢使用淘宝镜像
  17. npm install  --registry=https://registry.npm.taobao.org
  18. npm install [email protected] --ignore-scripts             //忽略[email protected]
  19.  
  20. npm run start     //启动elastichsearch-head,加&后台启动
  21. 访问http://IP:9100没有任何信息,连接不上es
  22. 需要在es的配置文件中添加允许es跨域访问配置
  23. vim elasticsearch.yml
  24. http.cors.enabled: true
  25. http.cors.allow-origin: "*"
  26. 修改完重启es之后可以通过head插件连接es了
  27. 由于head插件和es服务在一台机器上,如果不在一台服务器上,需要修改
  28. cd /usr/local/elasticsearch-head/_site
  29. vim app.js
  30. 将this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";中的localhost修改为es服务所在服务器的IP地址

  31. 启动head插件也可以使用该命令

  32. cd /usr/local/elasticsearch-head/node_modules/grunt/bin

  33. ./grunt server

ik分词插件的安装

  1. ik分词插件下载地地址: https://github.com/medcl/elasticsearch-analysis-ik/releases,ik分词插件版本要和es版本对应

  2. 下载es的IK插件命名改为ik插件

  3. 直接上传到es的plugins目录下就可以了

  4. 启动看日志接在ik插件

  5. 测试ik分词生效

  6. 自定义分词

  7. cd  /usr/local/elasticsearch-6.5.4/plugins/ik/config

  8. mkdir customer

  9.  vim new_word.dic

  10. 王者荣耀

  11. vi IKAnalyzer.cfg.xml

  12. 重启es

  13. 自定义扩展字典成功

猜你喜欢

转载自blog.csdn.net/qq_39669058/article/details/86429721