plugin-script.asciidoc 7.7 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. {ref}/setup-dir-layout.html[different location] if you installed Elasticsearch
  6. with an RPM or deb package.
  7. Run the following command to get usage instructions:
  8. [source,shell]
  9. -----------------------------------
  10. sudo bin/elasticsearch-plugin -h
  11. -----------------------------------
  12. [IMPORTANT]
  13. .Running as root
  14. =====================
  15. If Elasticsearch was installed using the deb or rpm package then run
  16. `bin/elasticsearch-plugin` as `root` so it can write to the appropriate files on disk.
  17. Otherwise run `bin/elasticsearch-plugin` as the user that owns all of the Elasticsearch
  18. files.
  19. =====================
  20. [[installation]]
  21. === Installing Plugins
  22. The documentation for each plugin usually includes specific installation
  23. instructions for that plugin, but below we document the various available
  24. options:
  25. [float]
  26. === Core Elasticsearch plugins
  27. Core Elasticsearch plugins can be installed as follows:
  28. [source,shell]
  29. -----------------------------------
  30. sudo bin/elasticsearch-plugin install [plugin_name]
  31. -----------------------------------
  32. For instance, to install the core <<analysis-icu,ICU plugin>>, just run the
  33. following command:
  34. [source,shell]
  35. -----------------------------------
  36. sudo bin/elasticsearch-plugin install analysis-icu
  37. -----------------------------------
  38. This command will install the version of the plugin that matches your
  39. Elasticsearch version.
  40. [float]
  41. === Community and non-core plugins
  42. Non-core plugins provided by Elasticsearch, or plugins provided by the
  43. community, can be installed from `download.elastic.co`, from Maven (Central
  44. and Sonatype), or from GitHub. In this case, the command is as follows:
  45. [source,shell]
  46. -----------------------------------
  47. sudo bin/elasticsearch-plugin install [org]/[user|component]/[version]
  48. -----------------------------------
  49. For instance, to install the https://github.com/lmenezes/elasticsearch-kopf[Kopf]
  50. plugin from GitHub, run one of the following commands:
  51. [source,shell]
  52. -----------------------------------
  53. sudo bin/elasticsearch-plugin install lmenezes/elasticsearch-kopf <1>
  54. sudo bin/elasticsearch-plugin install lmenezes/elasticsearch-kopf/2.x <2>
  55. -----------------------------------
  56. <1> Installs the latest version from GitHub.
  57. <2> Installs the 1.x version from GitHub.
  58. When installing from Maven Central/Sonatype, `[org]` should be replaced by
  59. the artifact `groupId`, and `[user|component]` by the `artifactId`. For
  60. instance, to install the {plugins}/mapper-attachments.html[`mapper-attachments`]
  61. plugin from Sonatype, run:
  62. [source,shell]
  63. -----------------------------------
  64. sudo bin/elasticsearch-plugin install org.elasticsearch.plugin/mapper-attachments/3.0.0 <1>
  65. -----------------------------------
  66. <1> When installing from `download.elastic.co` or from Maven Central/Sonatype, the
  67. version is required.
  68. [float]
  69. === Custom URL or file system
  70. A plugin can also be downloaded directly from a custom location by specifying the URL:
  71. [source,shell]
  72. -----------------------------------
  73. sudo bin/elasticsearch-plugin install [url] <1>
  74. -----------------------------------
  75. <1> must be a valid URL, the plugin name is determined from its descriptor.
  76. For instance, to install a plugin from your local file system, you could run:
  77. [source,shell]
  78. -----------------------------------
  79. sudo bin/elasticsearch-plugin install file:///path/to/plugin.zip
  80. -----------------------------------
  81. The plugin script will refuse to talk to an HTTPS URL with an untrusted
  82. certificate. To use a self-signed HTTPS cert, you will need to add the CA cert
  83. to a local Java truststore and pass the location to the script as follows:
  84. [source,shell]
  85. -----------------------------------
  86. sudo bin/elasticsearch-plugin -Djavax.net.ssl.trustStore=/path/to/trustStore.jks install https://....
  87. -----------------------------------
  88. [[listing-removing]]
  89. === Listing and Removing 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 complete the removal process.
  108. === Other command line parameters
  109. The `plugin` scripts supports a number of other command line parameters:
  110. [float]
  111. === Silent/Verbose mode
  112. The `--verbose` parameter outputs more debug information, while the `--silent`
  113. parameter turns off all output. The script may return the following exit
  114. codes:
  115. [horizontal]
  116. `0`:: everything was OK
  117. `64`:: unknown command or incorrect option parameter
  118. `74`:: IO error
  119. `70`:: any other error
  120. [float]
  121. === Custom config directory
  122. If your `elasticsearch.yml` config file is in a custom location, you will need
  123. to specify the path to the config file when using the `plugin` script. You
  124. can do this as follows:
  125. [source,sh]
  126. ---------------------
  127. sudo bin/elasticsearch-plugin -Des.path.conf=/path/to/custom/config/dir install <plugin name>
  128. ---------------------
  129. You can also set the `CONF_DIR` environment variable to the custom config
  130. directory path.
  131. [float]
  132. === Timeout settings
  133. By default, the `plugin` script will wait indefinitely when downloading before
  134. failing. The timeout parameter can be used to explicitly specify how long it
  135. waits. Here is some examples of setting it to different values:
  136. [source,shell]
  137. -----------------------------------
  138. # Wait for 30 seconds before failing
  139. sudo bin/elasticsearch-plugin install mobz/elasticsearch-head --timeout 30s
  140. # Wait for 1 minute before failing
  141. sudo bin/elasticsearch-plugin install mobz/elasticsearch-head --timeout 1m
  142. # Wait forever (default)
  143. sudo bin/elasticsearch-plugin install mobz/elasticsearch-head --timeout 0
  144. -----------------------------------
  145. [float]
  146. === Proxy settings
  147. To install a plugin via a proxy, you can pass the proxy details in with the
  148. Java settings `proxyHost` and `proxyPort`. On Unix based systems, these
  149. options can be set on the command line:
  150. [source,shell]
  151. -----------------------------------
  152. sudo bin/elasticsearch-plugin install mobz/elasticsearch-head -DproxyHost=host_name -DproxyPort=port_number
  153. -----------------------------------
  154. On Windows, they need to be added to the `JAVA_OPTS` environment variable:
  155. [source,shell]
  156. -----------------------------------
  157. set JAVA_OPTS="-DproxyHost=host_name -DproxyPort=port_number"
  158. bin/elasticsearch-plugin install mobz/elasticsearch-head
  159. -----------------------------------
  160. === Settings related to plugins
  161. [float]
  162. === Custom plugins directory
  163. The `plugins` directory can be changed from the default by adding the
  164. following to the `elasticsearch.yml` config file:
  165. [source,yml]
  166. ---------------------
  167. path.plugins: /path/to/custom/plugins/dir
  168. ---------------------
  169. The default location of the `plugins` directory depends on
  170. {ref}/setup-dir-layout.html[which package you install].
  171. [float]
  172. === Mandatory Plugins
  173. If you rely on some plugins, you can define mandatory plugins by adding
  174. `plugin.mandatory` setting to the `config/elasticsearch.yml` file, for
  175. example:
  176. [source,yaml]
  177. --------------------------------------------------
  178. plugin.mandatory: mapper-attachments,lang-python
  179. --------------------------------------------------
  180. For safety reasons, a node will not start if it is missing a mandatory plugin.