1
0

plugin-script.asciidoc 9.2 KB

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