Aldebaran

人生最棒的感觉,就是你做到别人说你做不到的事。

0%

常用的Elasticsearch插件

三田寺円

前言

Elastic内置或者第三方配置了非常多的插件,插件又分为3类

站点插件:相当于一个web服务,只需要在一台节点上部署即可;

java插件:相当于一些jar包,需要在每个集群上部署,并且需要重启集群;

混合插件,也就是站点插件和java插件的混合,部署方式和java插件一样。

准备

如果操作系统版本nodejs版本太低,那么建议重新安装nodejs。

$ cd /usr/local/src
$ wget https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz
$ tar xf node-v8.11.3-linux-x64.tar.xz
$ mv node-v8.11.3-linux-x64 /usr/local
$ ln -s /usr/local/node-v8.11.3-linux-x64 /usr/local/node
$ ln -s /usr/local/node/bin/npm /usr/local/bin/npm
$ ln -s /usr/local/node/bin/node /usr/local/bin/node
$ ln -s /usr/local/node/bin/npx /usr/local/bin/npx

插件安装

以下插件都是可选的,请根据实际需求安装。

可视化插件

  • cerebro

  • elasticsearch-head

    这个是很经典的ES Web UI了

      $ git clone git://github.com/mobz/elasticsearch-head.git
      $ cd elasticsearch-head
      $ npm --registry https://registry.npm.taobao.org install
      $ npm run start
    

    02

    安装过程中可能会遇到的错误: 如果安装phantomjs报错。那么可以参考 https://www.cnblogs.com/yuanbaodong/p/8638765.html

      $ npm --registry https://registry.npm.taobao.org install phantomjs-prebuilt@2.1.16 --ignore-scripts
    

SQL转化插件

  • elasticsearch-sql

      下载地址:https://github.com/NLPchina/elasticsearch-sql/releases
    
      ## 安装可视化SQL可视化界面
      $ git clone https://github.com/NLPchina/elasticsearch-sql.git
      $ cd src/site-server
      $ npm --registry https://registry.npm.taobao.org install  express --save
      $ nohup node node-server.js &
    
      ## 安装, 以6.3.1为例
      $ ./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.3.1.0/elasticsearch-sql-6.3.1.1.zip
    

    03

分词插件

  • IK Analysis for Elasticsearch

      下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases, 例如:
    
      $ ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.3.1/elasticsearch-analysis-ik-6.3.1.zip
    

    默认生成/etc/elasticsearch/analysis-ik路径,此为插件的配置文件。