官术网_书友最值得收藏!

  • ElasticSearch Cookbook
  • Alberto Paro
  • 535字
  • 2021-04-02 10:09:58

Installing a plugin

One of the main features of ElasticSearch is the possibility to extend it with plugins. Plugins extend ElasticSearch features and functionalities in several ways. There are two kinds of plugins:

  • Site plugins: These are used to serve static contents in their entry points. They are mainly used to create management application: monitoring and administration of a cluster.
  • Binary plugins: These are jar files that contain application code. They are used for:
    • Rivers (plugins that allow importing data from DBMS or other sources)
    • ScriptEngine (JavaScript, Python, Scala, and Ruby)
    • Custom analyzers and tokenizers
    • REST entry points
    • Supporting new protocols (Thrift, memcache, and so on)
    • Supporting new storages (Hadoop)

Getting ready

You need an installed working ElasticSearch server.

How to do it...

ElasticSearch provides a script for automatically downloading and installing plugins in bin/directory, called plugin.

The steps required to install a plugin are:

  1. Call the plugin install the ElasticSearch command with the plugin name reference.

    For installing an administrative interface for Elasticsearch, simply call:

    • on Linux/Mac:
      plugin -install mobz/elasticsearch-head
      
    • on Windows:
      plugin.bat -install mobz/elasticsearch-head
      
  2. Check by starting the node that the plugin is correctly loaded.

    The following screenshot shows the installation and the initialization of ElasticSearch server with the installed plugin.

    How to do it...

Note

Remember that a plugin installation requires to restart the ElasticSearch server.

How it works...

The plugin[.bat] script is a wrapper for ElasticSearch Plugin Manager. It can be used to install or remove a plugin with the –remove options.

To install a plugin, there are two kinds of options:

  • Pass the URL of the plugin (zip archive) with the -url parameter, that is, bin/plugin –url http://mywoderfulserve.com/plugins/awesome-plugin.zip
  • Use the –install parameter with the Github repository of the plugin.

    The install parameter, that must be given, is formatted in this way:

    <username>/<repo>[/<version>]

In the previous example:

  • <username> was mobz
  • <repo> was elasticsearch-head
  • <version> was not given so master/trunk was used

During the install process, ElasticSearch Plugin Manager is able to:

  • Download the plugin
  • Create a plugins directory in ES_HOME if it's missing
  • Unzip the plugin content in the plugin directory
  • Remove temporary files

There's more...

There are some hints to remember while installing plugins. The first and most important is that the plugin must be certified for your current ElasticSearch version: some releases can break your plugins. Typically on the plugin developer page, there are the ElasticSearch versions supported by this plugin.

For example, if you look at the Python language plugin page (https://github.com/elasticsearch/elasticsearch-lang-python), you'll see a reference table similar to the following table:

---------------------------------------
| Python Plugin    | ElasticSearch    |
--------------------------------------- 
| master           | 0.90 -> master   |
--------------------------------------- 
| 1.2.0            | 0.90 -> master   |
--------------------------------------- 
| 1.1.0            | 0.19 -> 0.20     | 
--------------------------------------- 
| 1.0.0            | 0.18             | 
---------------------------------------

You must choose the version working with your current ElasticSearch version.

Updating some plugins in a node environment can cause malfunction due to different plugin versions in different nodes. If you have a big cluster for safety, it's better to check the update in a separate environment to prevent problems.

Note that updating an ElasticSearch server could also break your custom binary plugins due to some internal API changes.

See also

主站蜘蛛池模板: 南郑县| 永胜县| 将乐县| 沙坪坝区| 海林市| 莱州市| 马山县| 南宁市| 景宁| 伊宁县| 绵阳市| 绵竹市| 宿松县| 建湖县| 师宗县| 广汉市| 凉城县| 焉耆| 抚顺县| 阿合奇县| 昂仁县| 姜堰市| 离岛区| 四平市| 南部县| 鄂托克旗| 资溪县| 普安县| 嘉兴市| 钟祥市| 玉屏| 太仆寺旗| 永新县| 镇康县| 西充县| 永胜县| 波密县| 永嘉县| 临清市| 钟山县| 叙永县|