plugin-script.asciidoc 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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}/zip-targz.html#zip-targz-layout[Directory layout of `.zip` and `.tar.gz` archives]
  7. * {ref}/deb.html#deb-layout[Directory layout of Debian package]
  8. * {ref}/rpm.html#rpm-layout[Directory layout of RPM]
  9. Run the following command to get usage instructions:
  10. [source,shell]
  11. -----------------------------------
  12. sudo bin/elasticsearch-plugin -h
  13. -----------------------------------
  14. [IMPORTANT]
  15. .Running as root
  16. =====================
  17. If Elasticsearch was installed using the deb or rpm package then run
  18. `/usr/share/elasticsearch-plugin` as `root` so it can write to the appropriate files on disk.
  19. Otherwise run `bin/elasticsearch-plugin` as the user that owns all of the Elasticsearch
  20. files.
  21. =====================
  22. [[installation]]
  23. === Installing Plugins
  24. The documentation for each plugin usually includes specific installation
  25. instructions for that plugin, but below we document the various available
  26. options:
  27. [float]
  28. === Core Elasticsearch plugins
  29. Core Elasticsearch plugins can be installed as follows:
  30. [source,shell]
  31. -----------------------------------
  32. sudo bin/elasticsearch-plugin install [plugin_name]
  33. -----------------------------------
  34. For instance, to install the core <<analysis-icu,ICU plugin>>, just run the
  35. following command:
  36. [source,shell]
  37. -----------------------------------
  38. sudo bin/elasticsearch-plugin install analysis-icu
  39. -----------------------------------
  40. This command will install the version of the plugin that matches your
  41. Elasticsearch version.
  42. [float]
  43. === Custom URL or file system
  44. A plugin can also be downloaded directly from a custom location by specifying the URL:
  45. [source,shell]
  46. -----------------------------------
  47. sudo bin/elasticsearch-plugin install [url] <1>
  48. -----------------------------------
  49. <1> must be a valid URL, the plugin name is determined from its descriptor.
  50. For instance, to install a plugin from your local file system, you could run:
  51. [source,shell]
  52. -----------------------------------
  53. sudo bin/elasticsearch-plugin install file:///path/to/plugin.zip
  54. -----------------------------------
  55. The plugin script will refuse to talk to an HTTPS URL with an untrusted
  56. certificate. To use a self-signed HTTPS cert, you will need to add the CA cert
  57. to a local Java truststore and pass the location to the script as follows:
  58. [source,shell]
  59. -----------------------------------
  60. sudo ES_JAVA_OPTS="-Djavax.net.ssl.trustStore=/path/to/trustStore.jks" bin/elasticsearch-plugin install https://....
  61. -----------------------------------
  62. [[listing-removing]]
  63. === Listing and Removing Installed Plugins
  64. [float]
  65. === Listing plugins
  66. A list of the currently loaded plugins can be retrieved with the `list` option:
  67. [source,shell]
  68. -----------------------------------
  69. sudo bin/elasticsearch-plugin list
  70. -----------------------------------
  71. Alternatively, use the {ref}/cluster-nodes-info.html[node-info API] to find
  72. out which plugins are installed on each node in the cluster
  73. [float]
  74. === Removing plugins
  75. Plugins can be removed manually, by deleting the appropriate directory under
  76. `plugins/`, or using the public script:
  77. [source,shell]
  78. -----------------------------------
  79. sudo bin/elasticsearch-plugin remove [pluginname]
  80. -----------------------------------
  81. After a Java plugin has been removed, you will need to restart the node to complete the removal process.
  82. === Other command line parameters
  83. The `plugin` scripts supports a number of other command line parameters:
  84. [float]
  85. === Silent/Verbose mode
  86. The `--verbose` parameter outputs more debug information, while the `--silent`
  87. parameter turns off all output. The script may return the following exit
  88. codes:
  89. [horizontal]
  90. `0`:: everything was OK
  91. `64`:: unknown command or incorrect option parameter
  92. `74`:: IO error
  93. `70`:: any other error
  94. [float]
  95. === Custom config directory
  96. If your `elasticsearch.yml` config file is in a custom location, you will need
  97. to specify the path to the config file when using the `plugin` script. You
  98. can do this as follows:
  99. [source,sh]
  100. ---------------------
  101. sudo bin/elasticsearch-plugin -Ees.path.conf=/path/to/custom/config/dir install <plugin name>
  102. ---------------------
  103. You can also set the `CONF_DIR` environment variable to the custom config
  104. directory path.
  105. [float]
  106. === Timeout settings
  107. By default, the `plugin` script will wait indefinitely when downloading before
  108. failing. The timeout parameter can be used to explicitly specify how long it
  109. waits. Here is some examples of setting it to different values:
  110. [source,shell]
  111. -----------------------------------
  112. # Wait for 30 seconds before failing
  113. sudo bin/elasticsearch-plugin install analysis-icu --timeout 30s
  114. # Wait for 1 minute before failing
  115. sudo bin/elasticsearch-plugin install analysis-icu --timeout 1m
  116. # Wait forever (default)
  117. sudo bin/elasticsearch-plugin install analysis-icu --timeout 0
  118. -----------------------------------
  119. [float]
  120. === Proxy settings
  121. To install a plugin via a proxy, you can pass the proxy details in with the
  122. Java settings `proxyHost` and `proxyPort`. On Unix based systems, these
  123. options can be set on the command line:
  124. [source,shell]
  125. -----------------------------------
  126. sudo ES_JAVA_OPTS="-DproxyHost=host_name -DproxyPort=port_number" bin/elasticsearch-plugin install mobz/elasticsearch-head
  127. -----------------------------------
  128. On Windows, they need to be added to the `ES_JAVA_OPTS` environment variable:
  129. [source,shell]
  130. -----------------------------------
  131. set ES_JAVA_OPTS="-DproxyHost=host_name -DproxyPort=port_number"
  132. bin/elasticsearch-plugin install analysis-icu
  133. -----------------------------------
  134. === Settings related to plugins
  135. [float]
  136. === Custom plugins directory
  137. The `plugins` directory can be changed from the default by adding the
  138. following to the `elasticsearch.yml` config file:
  139. [source,yml]
  140. ---------------------
  141. path.plugins: /path/to/custom/plugins/dir
  142. ---------------------
  143. The default location of the `plugins` directory depends on which package you install:
  144. * {ref}/zip-targz.html#zip-targz-layout[Directory layout of `.zip` and `.tar.gz` archives]
  145. * {ref}/deb.html#deb-layout[Directory layout of Debian package]
  146. * {ref}/rpm.html#rpm-layout[Directory layout of RPM]
  147. [float]
  148. === Mandatory Plugins
  149. If you rely on some plugins, you can define mandatory plugins by adding
  150. `plugin.mandatory` setting to the `config/elasticsearch.yml` file, for
  151. example:
  152. [source,yaml]
  153. --------------------------------------------------
  154. plugin.mandatory: analysis-icu,lang-js
  155. --------------------------------------------------
  156. For safety reasons, a node will not start if it is missing a mandatory plugin.