plugin-script.asciidoc 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. [[plugin-management]]
  2. == Plugin Management
  3. The `plugin` script is used to install, list, and remove plugins. It is
  4. located in the `$ES_HOME/bin` directory by default but it may be in a
  5. different location depending on which Elasticsearch package you installed:
  6. * {ref}/zip-targz.html#zip-targz-layout[Directory layout of `.zip` and `.tar.gz` archives]
  7. * {ref}/deb.html#deb-layout[Directory layout of Debian package]
  8. * {ref}/rpm.html#rpm-layout[Directory layout of RPM]
  9. Run the following command to get usage instructions:
  10. [source,shell]
  11. -----------------------------------
  12. sudo bin/elasticsearch-plugin -h
  13. -----------------------------------
  14. [IMPORTANT]
  15. .Running as root
  16. =====================
  17. If Elasticsearch was installed using the deb or rpm package then run
  18. `/usr/share/elasticsearch/bin/elasticsearch-plugin` as `root` so it can write to the appropriate files on disk.
  19. Otherwise run `bin/elasticsearch-plugin` as the user that owns all of the Elasticsearch
  20. files.
  21. =====================
  22. [[installation]]
  23. === Installing Plugins
  24. The documentation for each plugin usually includes specific installation
  25. instructions for that plugin, but below we document the various available
  26. options:
  27. [float]
  28. === Core Elasticsearch plugins
  29. Core Elasticsearch plugins can be installed as follows:
  30. [source,shell]
  31. -----------------------------------
  32. sudo bin/elasticsearch-plugin install [plugin_name]
  33. -----------------------------------
  34. For instance, to install the core <<analysis-icu,ICU plugin>>, just run the
  35. following command:
  36. [source,shell]
  37. -----------------------------------
  38. sudo bin/elasticsearch-plugin install analysis-icu
  39. -----------------------------------
  40. This command will install the version of the plugin that matches your
  41. Elasticsearch version and also show a progress bar while downloading.
  42. [[plugin-management-custom-url]]
  43. === Custom URL or file system
  44. A plugin can also be downloaded directly from a custom location by specifying the URL:
  45. [source,shell]
  46. -----------------------------------
  47. sudo bin/elasticsearch-plugin install [url] <1>
  48. -----------------------------------
  49. <1> must be a valid URL, the plugin name is determined from its descriptor.
  50. --
  51. Unix::
  52. To install a plugin from your local file system at `/path/to/plugin.zip`, you could run:
  53. +
  54. [source,shell]
  55. -----------------------------------
  56. sudo bin/elasticsearch-plugin install file:///path/to/plugin.zip
  57. -----------------------------------
  58. Windows::
  59. To install a plugin from your local file system at `C:\path\to\plugin.zip`, you could run:
  60. +
  61. [source,shell]
  62. -----------------------------------
  63. bin\elasticsearch-plugin install file:///C:/path/to/plugin.zip
  64. -----------------------------------
  65. +
  66. NOTE: Any path that contains spaces must be wrapped in quotes!
  67. +
  68. NOTE: If you are installing a plugin from the filesystem the plugin distribution
  69. must not be contained in the `plugins` directory for the node that you are
  70. installing the plugin to or installation will fail.
  71. HTTP::
  72. To install a plugin from an HTTP URL:
  73. +
  74. [source,shell]
  75. -----------------------------------
  76. sudo bin/elasticsearch-plugin install http://some.domain/path/to/plugin.zip
  77. -----------------------------------
  78. +
  79. The plugin script will refuse to talk to an HTTPS URL with an untrusted
  80. certificate. To use a self-signed HTTPS cert, you will need to add the CA cert
  81. to a local Java truststore and pass the location to the script as follows:
  82. +
  83. [source,shell]
  84. -----------------------------------
  85. sudo ES_JAVA_OPTS="-Djavax.net.ssl.trustStore=/path/to/trustStore.jks" bin/elasticsearch-plugin install https://host/plugin.zip
  86. -----------------------------------
  87. --
  88. [[listing-removing-updating]]
  89. === Listing, Removing and Updating Installed Plugins
  90. [float]
  91. === Listing plugins
  92. A list of the currently loaded plugins can be retrieved with the `list` option:
  93. [source,shell]
  94. -----------------------------------
  95. sudo bin/elasticsearch-plugin list
  96. -----------------------------------
  97. Alternatively, use the {ref}/cluster-nodes-info.html[node-info API] to find
  98. out which plugins are installed on each node in the cluster
  99. [float]
  100. === Removing plugins
  101. Plugins can be removed manually, by deleting the appropriate directory under
  102. `plugins/`, or using the public script:
  103. [source,shell]
  104. -----------------------------------
  105. sudo bin/elasticsearch-plugin remove [pluginname]
  106. -----------------------------------
  107. After a Java plugin has been removed, you will need to restart the node to
  108. complete the removal process.
  109. By default, plugin configuration files (if any) are preserved on disk; this is
  110. so that configuration is not lost while upgrading a plugin. If you wish to
  111. purge the configuration files while removing a plugin, use `-p` or `--purge`.
  112. This can option can be used after a plugin is removed to remove any lingering
  113. configuration files.
  114. [float]
  115. === Updating plugins
  116. Plugins are built for a specific version of Elasticsearch, and therefore must be reinstalled
  117. each time Elasticsearch is updated.
  118. [source,shell]
  119. -----------------------------------
  120. sudo bin/elasticsearch-plugin remove [pluginname]
  121. sudo bin/elasticsearch-plugin install [pluginname]
  122. -----------------------------------
  123. === Other command line parameters
  124. The `plugin` scripts supports a number of other command line parameters:
  125. [float]
  126. === Silent/Verbose mode
  127. The `--verbose` parameter outputs more debug information, while the `--silent`
  128. parameter turns off all output including the progress bar. The script may
  129. return the following exit codes:
  130. [horizontal]
  131. `0`:: everything was OK
  132. `64`:: unknown command or incorrect option parameter
  133. `74`:: IO error
  134. `70`:: any other error
  135. [float]
  136. === Batch mode
  137. Certain plugins require more privileges than those provided by default in core
  138. Elasticsearch. These plugins will list the required privileges and ask the
  139. user for confirmation before continuing with installation.
  140. When running the plugin install script from another program (e.g. install
  141. automation scripts), the plugin script should detect that it is not being
  142. called from the console and skip the confirmation response, automatically
  143. granting all requested permissions. If console detection fails, then batch
  144. mode can be forced by specifying `-b` or `--batch` as follows:
  145. [source,shell]
  146. -----------------------------------
  147. sudo bin/elasticsearch-plugin install --batch [pluginname]
  148. -----------------------------------
  149. [float]
  150. === Custom config directory
  151. If your `elasticsearch.yml` config file is in a custom location, you will need
  152. to specify the path to the config file when using the `plugin` script. You
  153. can do this as follows:
  154. [source,sh]
  155. ---------------------
  156. sudo ES_PATH_CONF=/path/to/conf/dir bin/elasticsearch-plugin install <plugin name>
  157. ---------------------
  158. [float]
  159. === Proxy settings
  160. To install a plugin via a proxy, you can add the proxy details to the
  161. `ES_JAVA_OPTS` environment variable with the Java settings `http.proxyHost`
  162. and `http.proxyPort` (or `https.proxyHost` and `https.proxyPort`):
  163. [source,shell]
  164. -----------------------------------
  165. sudo ES_JAVA_OPTS="-Dhttp.proxyHost=host_name -Dhttp.proxyPort=port_number -Dhttps.proxyHost=host_name -Dhttps.proxyPort=https_port_number" bin/elasticsearch-plugin install analysis-icu
  166. -----------------------------------
  167. Or on Windows:
  168. [source,shell]
  169. ------------------------------------
  170. set ES_JAVA_OPTS="-Dhttp.proxyHost=host_name -Dhttp.proxyPort=port_number -Dhttps.proxyHost=host_name -Dhttps.proxyPort=https_port_number"
  171. bin\elasticsearch-plugin install analysis-icu
  172. ------------------------------------
  173. === Plugins directory
  174. The default location of the `plugins` directory depends on which package you install:
  175. * {ref}/zip-targz.html#zip-targz-layout[Directory layout of `.zip` and `.tar.gz` archives]
  176. * {ref}/deb.html#deb-layout[Directory layout of Debian package]
  177. * {ref}/rpm.html#rpm-layout[Directory layout of RPM]
  178. [float]
  179. === Mandatory Plugins
  180. If you rely on some plugins, you can define mandatory plugins by adding
  181. `plugin.mandatory` setting to the `config/elasticsearch.yml` file, for
  182. example:
  183. [source,yaml]
  184. --------------------------------------------------
  185. plugin.mandatory: analysis-icu,lang-js
  186. --------------------------------------------------
  187. For safety reasons, a node will not start if it is missing a mandatory plugin.