plugin-script.asciidoc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. [[plugin-management]]
  2. == Plugin Management
  3. Use the `elasticsearch-plugin` command line tool 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}/targz.html#targz-layout[Directory layout of `.tar.gz` archives]
  7. * {ref}/zip-windows.html#windows-layout[Directory layout of Windows `.zip` archives]
  8. * {ref}/deb.html#deb-layout[Directory layout of Debian package]
  9. * {ref}/rpm.html#rpm-layout[Directory layout of RPM]
  10. Run the following command to get usage instructions:
  11. [source,shell]
  12. -----------------------------------
  13. sudo bin/elasticsearch-plugin -h
  14. -----------------------------------
  15. [IMPORTANT]
  16. .Running as root
  17. =====================
  18. If Elasticsearch was installed using the deb or rpm package then run
  19. `/usr/share/elasticsearch/bin/elasticsearch-plugin` as `root` so it can write to the appropriate files on disk.
  20. Otherwise run `bin/elasticsearch-plugin` as the user that owns all of the Elasticsearch
  21. files.
  22. =====================
  23. [discrete]
  24. [[plugin-management-docker]]
  25. === Docker
  26. If you run {es} using Docker, you can manage plugins using a
  27. <<manage-plugins-using-configuration-file,configuration file>>.
  28. [[installation]]
  29. === Installing Plugins
  30. The documentation for each plugin usually includes specific installation
  31. instructions for that plugin, but below we document the various available
  32. options:
  33. [discrete]
  34. === Core Elasticsearch plugins
  35. Core Elasticsearch plugins can be installed as follows:
  36. [source,shell]
  37. -----------------------------------
  38. sudo bin/elasticsearch-plugin install [plugin_name]
  39. -----------------------------------
  40. For instance, to install the core <<analysis-icu,ICU plugin>>, just run the
  41. following command:
  42. [source,shell]
  43. -----------------------------------
  44. sudo bin/elasticsearch-plugin install analysis-icu
  45. -----------------------------------
  46. This command will install the version of the plugin that matches your
  47. Elasticsearch version and also show a progress bar while downloading.
  48. [[plugin-management-custom-url]]
  49. === Custom URL or file system
  50. A plugin can also be downloaded directly from a custom location by specifying the URL:
  51. [source,shell]
  52. -----------------------------------
  53. sudo bin/elasticsearch-plugin install [url] <1>
  54. -----------------------------------
  55. <1> must be a valid URL, the plugin name is determined from its descriptor.
  56. --
  57. Unix::
  58. To install a plugin from your local file system at `/path/to/plugin.zip`, you could run:
  59. +
  60. [source,shell]
  61. -----------------------------------
  62. sudo bin/elasticsearch-plugin install file:///path/to/plugin.zip
  63. -----------------------------------
  64. Windows::
  65. To install a plugin from your local file system at `C:\path\to\plugin.zip`, you could run:
  66. +
  67. [source,shell]
  68. -----------------------------------
  69. bin\elasticsearch-plugin install file:///C:/path/to/plugin.zip
  70. -----------------------------------
  71. +
  72. NOTE: Any path that contains spaces must be wrapped in quotes!
  73. +
  74. NOTE: If you are installing a plugin from the filesystem the plugin distribution
  75. must not be contained in the `plugins` directory for the node that you are
  76. installing the plugin to or installation will fail.
  77. HTTP::
  78. To install a plugin from an HTTP URL:
  79. +
  80. [source,shell]
  81. -----------------------------------
  82. sudo bin/elasticsearch-plugin install https://some.domain/path/to/plugin.zip
  83. -----------------------------------
  84. +
  85. The plugin script will refuse to talk to an HTTPS URL with an untrusted
  86. certificate. To use a self-signed HTTPS cert, you will need to add the CA cert
  87. to a local Java truststore and pass the location to the script as follows:
  88. +
  89. [source,shell]
  90. -----------------------------------
  91. sudo ES_JAVA_OPTS="-Djavax.net.ssl.trustStore=/path/to/trustStore.jks" bin/elasticsearch-plugin install https://host/plugin.zip
  92. -----------------------------------
  93. --
  94. [[installing-multiple-plugins]]
  95. === Installing multiple plugins
  96. Multiple plugins can be installed in one invocation as follows:
  97. [source,shell]
  98. -----------------------------------
  99. sudo bin/elasticsearch-plugin install [plugin_id] [plugin_id] ... [plugin_id]
  100. -----------------------------------
  101. Each `plugin_id` can be any valid form for installing a single plugin (e.g., the
  102. name of a core plugin, or a custom URL).
  103. For instance, to install the core <<analysis-icu,ICU plugin>>, run the following command:
  104. [source,shell]
  105. -----------------------------------
  106. sudo bin/elasticsearch-plugin install analysis-icu
  107. -----------------------------------
  108. This command will install the versions of the plugins that matches your
  109. Elasticsearch version. The installation will be treated as a transaction, so
  110. that all the plugins will be installed, or none of the plugins will be installed
  111. if any installation fails.
  112. [[mandatory-plugins]]
  113. === Mandatory Plugins
  114. If you rely on some plugins, you can define mandatory plugins by adding
  115. `plugin.mandatory` setting to the `config/elasticsearch.yml` file, for
  116. example:
  117. [source,yaml]
  118. --------------------------------------------------
  119. plugin.mandatory: analysis-icu,lang-js
  120. --------------------------------------------------
  121. For safety reasons, a node will not start if it is missing a mandatory plugin.
  122. [[listing-removing-updating]]
  123. === Listing, Removing and Updating Installed Plugins
  124. [discrete]
  125. === Listing plugins
  126. A list of the currently loaded plugins can be retrieved with the `list` option:
  127. [source,shell]
  128. -----------------------------------
  129. sudo bin/elasticsearch-plugin list
  130. -----------------------------------
  131. Alternatively, use the {ref}/cluster-nodes-info.html[node-info API] to find
  132. out which plugins are installed on each node in the cluster
  133. [discrete]
  134. === Removing plugins
  135. Plugins can be removed manually, by deleting the appropriate directory under
  136. `plugins/`, or using the public script:
  137. [source,shell]
  138. -----------------------------------
  139. sudo bin/elasticsearch-plugin remove [pluginname]
  140. -----------------------------------
  141. After a Java plugin has been removed, you will need to restart the node to
  142. complete the removal process.
  143. By default, plugin configuration files (if any) are preserved on disk; this is
  144. so that configuration is not lost while upgrading a plugin. If you wish to
  145. purge the configuration files while removing a plugin, use `-p` or `--purge`.
  146. This can option can be used after a plugin is removed to remove any lingering
  147. configuration files.
  148. [[removing-multiple-plugins]]
  149. === Removing multiple plugins
  150. Multiple plugins can be removed in one invocation as follows:
  151. [source,shell]
  152. -----------------------------------
  153. sudo bin/elasticsearch-plugin remove [pluginname] [pluginname] ... [pluginname]
  154. -----------------------------------
  155. [discrete]
  156. === Updating plugins
  157. Plugins are built for a specific version of Elasticsearch, and therefore must be reinstalled
  158. each time Elasticsearch is updated.
  159. [source,shell]
  160. -----------------------------------
  161. sudo bin/elasticsearch-plugin remove [pluginname]
  162. sudo bin/elasticsearch-plugin install [pluginname]
  163. -----------------------------------
  164. === Other command line parameters
  165. The `plugin` scripts supports a number of other command line parameters:
  166. [discrete]
  167. === Silent/Verbose mode
  168. The `--verbose` parameter outputs more debug information, while the `--silent`
  169. parameter turns off all output including the progress bar. The script may
  170. return the following exit codes:
  171. [horizontal]
  172. `0`:: everything was OK
  173. `64`:: unknown command or incorrect option parameter
  174. `74`:: IO error
  175. `70`:: any other error
  176. [discrete]
  177. === Batch mode
  178. Certain plugins require more privileges than those provided by default in core
  179. Elasticsearch. These plugins will list the required privileges and ask the
  180. user for confirmation before continuing with installation.
  181. When running the plugin install script from another program (e.g. install
  182. automation scripts), the plugin script should detect that it is not being
  183. called from the console and skip the confirmation response, automatically
  184. granting all requested permissions. If console detection fails, then batch
  185. mode can be forced by specifying `-b` or `--batch` as follows:
  186. [source,shell]
  187. -----------------------------------
  188. sudo bin/elasticsearch-plugin install --batch [pluginname]
  189. -----------------------------------
  190. [discrete]
  191. === Custom config directory
  192. If your `elasticsearch.yml` config file is in a custom location, you will need
  193. to specify the path to the config file when using the `plugin` script. You
  194. can do this as follows:
  195. [source,sh]
  196. ---------------------
  197. sudo ES_PATH_CONF=/path/to/conf/dir bin/elasticsearch-plugin install <plugin name>
  198. ---------------------
  199. [discrete]
  200. === Proxy settings
  201. To install a plugin via a proxy, you can add the proxy details to the
  202. `ES_JAVA_OPTS` environment variable with the Java settings `http.proxyHost`
  203. and `http.proxyPort` (or `https.proxyHost` and `https.proxyPort`):
  204. [source,shell]
  205. -----------------------------------
  206. 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
  207. -----------------------------------
  208. Or on Windows:
  209. [source,shell]
  210. ------------------------------------
  211. set ES_JAVA_OPTS="-Dhttp.proxyHost=host_name -Dhttp.proxyPort=port_number -Dhttps.proxyHost=host_name -Dhttps.proxyPort=https_port_number"
  212. bin\elasticsearch-plugin install analysis-icu
  213. ------------------------------------
  214. === Plugins directory
  215. The default location of the `plugins` directory depends on which package you install:
  216. * {ref}/targz.html#targz-layout[Directory layout of `.tar.gz` archives]
  217. * {ref}/zip-windows.html#windows-layout[Directory layout of Windows `.zip` archives]
  218. * {ref}/deb.html#deb-layout[Directory layout of Debian package]
  219. * {ref}/rpm.html#rpm-layout[Directory layout of RPM]
  220. [[manage-plugins-using-configuration-file]]
  221. === Manage plugins using a configuration file
  222. [IMPORTANT]
  223. .Docker only
  224. =====================
  225. This feature is only available for https://www.docker.elastic.co/[official {es}
  226. Docker images]. Other {es} distributions will not start with a
  227. plugin configuration file.
  228. =====================
  229. If you run {es} using Docker, you can manage plugins using a declarative configuration file.
  230. When {es} starts up, it will compare the plugins in the file with those
  231. that are currently installed, and add or remove plugins as required. {es}
  232. will also upgrade official plugins when you upgrade {es} itself.
  233. The file is called `elasticsearch-plugins.yml`, and must be placed in the
  234. Elasticsearch configuration directory, alongside `elasticsearch.yml`. Here
  235. is an example:
  236. [source,yaml]
  237. ----
  238. plugins:
  239. - id: analysis-icu
  240. - id: repository-azure
  241. - id: custom-mapper
  242. location: https://example.com/archive/custom-mapper-1.0.0.zip
  243. ----
  244. This example installs the official `analysis-icu` and
  245. `repository-azure` plugins, and one unofficial plugin. Every plugin must provide
  246. an `id`. Unofficial plugins must also provide a `location`. This is
  247. typically a URL, but Maven coordinates are also supported. The downloaded
  248. plugin's name must match the ID in the configuration file.
  249. While {es} will respect the
  250. https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html[standard
  251. Java proxy system properties] when downloading plugins, you can also configure an
  252. HTTP proxy to use explicitly in the configuration file. For example:
  253. [source,yaml]
  254. ----
  255. plugins:
  256. - id: custom-mapper
  257. location: https://example.com/archive/custom-mapper-1.0.0.zip
  258. proxy: proxy.example.com:8443
  259. ----