plugin-script.asciidoc 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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/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/plugin` as `root` so it can write to the appropriate files on disk.
  17. Otherwise run `bin/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/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/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/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/plugin install lmenezes/elasticsearch-kopf <1>
  54. sudo bin/plugin install lmenezes/elasticsearch-kopf/1.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
  61. https://github.com/elastic/elasticsearch-mapper-attachments[mapper attachment]
  62. plugin from Sonatype, run:
  63. [source,shell]
  64. -----------------------------------
  65. sudo bin/plugin install org.elasticsearch/elasticsearch-mapper-attachments/2.6.0 <1>
  66. -----------------------------------
  67. <1> When installing from `download.elastic.co` or from Maven Central/Sonatype, the
  68. version is required.
  69. [float]
  70. === Custom URL or file system
  71. A plugin can also be downloaded directly from a custom location by specifying the URL:
  72. [source,shell]
  73. -----------------------------------
  74. sudo bin/plugin install [url] <1>
  75. -----------------------------------
  76. <1> must be a valid URL, the plugin name is determined from its descriptor.
  77. For instance, to install a plugin from your local file system, you could run:
  78. [source,shell]
  79. -----------------------------------
  80. sudo bin/plugin install file:///path/to/plugin.zip
  81. -----------------------------------
  82. [[listing-removing]]
  83. === Listing and Removing Installed Plugins
  84. [float]
  85. === Listing plugins
  86. A list of the currently loaded plugins can be retrieved with the `list` option:
  87. [source,shell]
  88. -----------------------------------
  89. sudo bin/plugin list
  90. -----------------------------------
  91. Alternatively, use the {ref}/cluster-nodes-info.html[node-info API] to find
  92. out which plugins are installed on each node in the cluster
  93. [float]
  94. === Removing plugins
  95. Plugins can be removed manually, by deleting the appropriate directory under
  96. `plugins/`, or using the public script:
  97. [source,shell]
  98. -----------------------------------
  99. sudo bin/plugin remove [pluginname]
  100. -----------------------------------
  101. After a Java plugin has been removed, you will need to restart the node to complete the removal process.
  102. === Other command line parameters
  103. The `plugin` scripts supports a number of other command line parameters:
  104. [float]
  105. === Silent/Verbose mode
  106. The `--verbose` parameter outputs more debug information, while the `--silent`
  107. parameter turns off all output. The script may return the following exit
  108. codes:
  109. [horizontal]
  110. `0`:: everything was OK
  111. `64`:: unknown command or incorrect option parameter
  112. `74`:: IO error
  113. `70`:: any other error
  114. [float]
  115. === Custom config directory
  116. If your `elasticsearch.yml` config file is in a custom location, you will need
  117. to specify the path to the config file when using the `plugin` script. You
  118. can do this as follows:
  119. [source,sh]
  120. ---------------------
  121. sudo bin/plugin -Des.path.conf=/path/to/custom/config/dir install <plugin name>
  122. ---------------------
  123. You can also set the `CONF_DIR` environment variable to the custom config
  124. directory path.
  125. [float]
  126. === Timeout settings
  127. By default, the `plugin` script will wait indefinitely when downloading before
  128. failing. The timeout parameter can be used to explicitly specify how long it
  129. waits. Here is some examples of setting it to different values:
  130. [source,shell]
  131. -----------------------------------
  132. # Wait for 30 seconds before failing
  133. sudo bin/plugin install mobz/elasticsearch-head --timeout 30s
  134. # Wait for 1 minute before failing
  135. sudo bin/plugin install mobz/elasticsearch-head --timeout 1m
  136. # Wait forever (default)
  137. sudo bin/plugin install mobz/elasticsearch-head --timeout 0
  138. -----------------------------------
  139. [float]
  140. === Proxy settings
  141. To install a plugin via a proxy, you can pass the proxy details in with the
  142. Java settings `proxyHost` and `proxyPort`. On Unix based systems, these
  143. options can be set on the command line:
  144. [source,shell]
  145. -----------------------------------
  146. sudo bin/plugin install mobz/elasticsearch-head -DproxyHost=host_name -DproxyPort=port_number
  147. -----------------------------------
  148. On Windows, they need to be added to the `JAVA_OPTS` environment variable:
  149. [source,shell]
  150. -----------------------------------
  151. set JAVA_OPTS="-DproxyHost=host_name -DproxyPort=port_number"
  152. bin/plugin install mobz/elasticsearch-head
  153. -----------------------------------
  154. === Settings related to plugins
  155. [float]
  156. === Custom plugins directory
  157. The `plugins` directory can be changed from the default by adding the
  158. following to the `elasticsearch.yml` config file:
  159. [source,yml]
  160. ---------------------
  161. path.plugins: /path/to/custom/plugins/dir
  162. ---------------------
  163. The default location of the `plugins` directory depends on
  164. {ref}/setup-dir-layout.html[which package you install].
  165. [float]
  166. === Mandatory Plugins
  167. If you rely on some plugins, you can define mandatory plugins by adding
  168. `plugin.mandatory` setting to the `config/elasticsearch.yml` file, for
  169. example:
  170. [source,yaml]
  171. --------------------------------------------------
  172. plugin.mandatory: mapper-attachments,lang-python
  173. --------------------------------------------------
  174. For safety reasons, a node will not start if it is missing a mandatory plugin.