plugin-script.asciidoc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. === Other command line parameters
  102. The `plugin` scripts supports a number of other command line parameters:
  103. [float]
  104. === Silent/Verbose mode
  105. The `--verbose` parameter outputs more debug information, while the `--silent`
  106. parameter turns off all output. The script may return the following exit
  107. codes:
  108. [horizontal]
  109. `0`:: everything was OK
  110. `64`:: unknown command or incorrect option parameter
  111. `74`:: IO error
  112. `70`:: any other error
  113. [float]
  114. === Custom config directory
  115. If your `elasticsearch.yml` config file is in a custom location, you will need
  116. to specify the path to the config file when using the `plugin` script. You
  117. can do this as follows:
  118. [source,sh]
  119. ---------------------
  120. sudo bin/plugin -Des.path.conf=/path/to/custom/config/dir install <plugin name>
  121. ---------------------
  122. You can also set the `CONF_DIR` environment variable to the custom config
  123. directory path.
  124. [float]
  125. === Timeout settings
  126. By default, the `plugin` script will wait indefinitely when downloading before
  127. failing. The timeout parameter can be used to explicitly specify how long it
  128. waits. Here is some examples of setting it to different values:
  129. [source,shell]
  130. -----------------------------------
  131. # Wait for 30 seconds before failing
  132. sudo bin/plugin install mobz/elasticsearch-head --timeout 30s
  133. # Wait for 1 minute before failing
  134. sudo bin/plugin install mobz/elasticsearch-head --timeout 1m
  135. # Wait forever (default)
  136. sudo bin/plugin install mobz/elasticsearch-head --timeout 0
  137. -----------------------------------
  138. [float]
  139. === Proxy settings
  140. To install a plugin via a proxy, you can pass the proxy details in with the
  141. Java settings `proxyHost` and `proxyPort`. On Unix based systems, these
  142. options can be set on the command line:
  143. [source,shell]
  144. -----------------------------------
  145. sudo bin/plugin install mobz/elasticsearch-head -DproxyHost=host_name -DproxyPort=port_number
  146. -----------------------------------
  147. On Windows, they need to be added to the `JAVA_OPTS` environment variable:
  148. [source,shell]
  149. -----------------------------------
  150. set JAVA_OPTS="-DproxyHost=host_name -DproxyPort=port_number"
  151. bin/plugin install mobz/elasticsearch-head
  152. -----------------------------------
  153. === Settings related to plugins
  154. [float]
  155. === Custom plugins directory
  156. The `plugins` directory can be changed from the default by adding the
  157. following to the `elasticsearch.yml` config file:
  158. [source,yml]
  159. ---------------------
  160. path.plugins: /path/to/custom/plugins/dir
  161. ---------------------
  162. The default location of the `plugins` directory depends on
  163. {ref}/setup-dir-layout.html[which package you install].
  164. [float]
  165. === Mandatory Plugins
  166. If you rely on some plugins, you can define mandatory plugins by adding
  167. `plugin.mandatory` setting to the `config/elasticsearch.yml` file, for
  168. example:
  169. [source,yaml]
  170. --------------------------------------------------
  171. plugin.mandatory: mapper-attachments,lang-groovy
  172. --------------------------------------------------
  173. For safety reasons, a node will not start if it is missing a mandatory plugin.