plugin-script.asciidoc 12 KB

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