zip-windows.asciidoc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. [[zip-windows]]
  2. === Install {es} with `.zip` on Windows
  3. {es} can be installed on Windows using the Windows `.zip` archive. This
  4. comes with a `elasticsearch-service.bat` command which will setup {es} to run as a
  5. service.
  6. include::license.asciidoc[]
  7. NOTE: On Windows the {es} {ml} feature requires the Microsoft Universal
  8. C Runtime library. This is built into Windows 10, Windows Server 2016 and more
  9. recent versions of Windows. For older versions of Windows it can be installed
  10. via Windows Update, or from a
  11. https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows[separate download].
  12. If you cannot install the Microsoft Universal C Runtime library you can still
  13. use the rest of {es} if you disable the {ml} feature.
  14. The latest stable version of {es} can be found on the
  15. link:/downloads/elasticsearch[Download {es}] page.
  16. Other versions can be found on the
  17. link:/downloads/past-releases[Past Releases page].
  18. NOTE: {es} includes a bundled version of https://openjdk.java.net[OpenJDK]
  19. from the JDK maintainers (GPLv2+CE). To use your own version of Java,
  20. see the <<jvm-version, JVM version requirements>>
  21. [[install-windows]]
  22. ==== Download and install the `.zip` package
  23. ifeval::["{release-state}"=="unreleased"]
  24. Version {version} of {es} has not yet been released.
  25. endif::[]
  26. ifeval::["{release-state}"!="unreleased"]
  27. Download the `.zip` archive for {es} {version} from: https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}-windows-x86_64.zip
  28. Unzip it with your favorite unzip tool. This will create a folder called
  29. +elasticsearch-{version}+, which we will refer to as `%ES_HOME%`. In a terminal
  30. window, `cd` to the `%ES_HOME%` directory, for instance:
  31. ["source","sh",subs="attributes"]
  32. ----------------------------
  33. cd C:\elasticsearch-{version}
  34. ----------------------------
  35. endif::[]
  36. ifdef::include-xpack[]
  37. [role="xpack"]
  38. [[windows-enable-indices]]
  39. ==== Enable automatic creation of system indices
  40. include::xpack-indices.asciidoc[]
  41. endif::include-xpack[]
  42. [[windows-running]]
  43. include::zip-windows-start.asciidoc[]
  44. [[windows-configuring]]
  45. ==== Configure {es} on the command line
  46. {es} loads its configuration from the `%ES_HOME%\config\elasticsearch.yml`
  47. file by default. The format of this config file is explained in
  48. <<settings>>.
  49. Any settings that can be specified in the config file can also be specified on
  50. the command line, using the `-E` syntax as follows:
  51. [source,sh]
  52. --------------------------------------------
  53. .\bin\elasticsearch.bat -Ecluster.name=my_cluster -Enode.name=node_1
  54. --------------------------------------------
  55. NOTE: Values that contain spaces must be surrounded with quotes. For instance `-Epath.logs="C:\My Logs\logs"`.
  56. TIP: Typically, any cluster-wide settings (like `cluster.name`) should be
  57. added to the `elasticsearch.yml` config file, while any node-specific settings
  58. such as `node.name` could be specified on the command line.
  59. :es-conf: %ES_HOME%\config
  60. :slash: \
  61. include::check-running.asciidoc[]
  62. [[windows-service]]
  63. ==== Install and run {es} as a service on Windows
  64. You can install {es} as a service that runs in the background or starts
  65. automatically at boot time without user interaction.
  66. . Install {es} as a service. The name of the service and the value of
  67. `ES_JAVA_HOME` will be made available during install:
  68. +
  69. ["source","sh",subs="attributes"]
  70. ----
  71. C:\elasticsearch-{version}{backslash}bin>elasticsearch-service.bat install
  72. Installing service : "elasticsearch-service-x64"
  73. Using ES_JAVA_HOME (64-bit): "C:\jvm\jdk1.8"
  74. The service 'elasticsearch-service-x64' has been installed.
  75. ----
  76. . Start {es} as a service. When {es} starts, authentication is enabled by
  77. default:
  78. +
  79. ["source","sh",subs="attributes"]
  80. ----
  81. C:\elasticsearch-{version}{backslash}bin>bin\elasticsearch-service.bat start
  82. ----
  83. +
  84. NOTE: TLS is not enabled or configured when you start {es} as a service.
  85. . Generate a password for the `elastic` user with the
  86. <<reset-password,`elasticsearch-reset-password`>> tool. The password is output
  87. to the command line.
  88. +
  89. ["source","sh",subs="attributes"]
  90. ----
  91. C:\elasticsearch-{version}{backslash}bin>\bin\elasticsearch-reset-password -u elastic
  92. ----
  93. NOTE: While a JRE can be used for the {es} service, due to its use of a client
  94. VM (as opposed to a server JVM which offers better performance for long-running
  95. applications) its usage is discouraged and a warning will be issued.
  96. NOTE: The system environment variable `ES_JAVA_HOME` should be set to the path
  97. of the JDK installation that you want the service to use. If you upgrade the
  98. JDK, you are not required to the reinstall the service but you must set the
  99. value of the system environment variable `ES_JAVA_HOME` to the path to the new
  100. JDK installation. However, upgrading across JVM types (e.g. JRE versus SE) is
  101. not supported, and does require the service to be reinstalled.
  102. [[windows-service-manage]]
  103. ===== Manage {es} as a service on Windows
  104. Run the `elasticsearch-service.bat` script in the `bin\` folder to install,
  105. remove, manage, or configure the service and potentially start and stop the
  106. service from the command line.
  107. ["source","sh",subs="attributes,callouts"]
  108. ----
  109. C:\elasticsearch-{version}{backslash}bin>elasticsearch-service.bat
  110. Usage: elasticsearch-service.bat install|remove|start|stop|manager [SERVICE_ID]
  111. ----
  112. The script requires one parameter (the command to execute), followed by an
  113. optional one indicating the service id (useful when installing multiple
  114. {es} services).
  115. The commands available are:
  116. --
  117. [horizontal]
  118. `install`:: Install {es} as a service
  119. `remove`:: Remove the installed {es} service (and stop the service if started)
  120. `start`:: Start the {es} service (if installed)
  121. `stop`:: Stop the {es} service (if started)
  122. `manager`:: Start a GUI for managing the installed service
  123. --
  124. [[windows-service-settings]]
  125. [discrete]
  126. === Customize service settings
  127. The {es} service can be configured prior to installation by setting the following environment variables (either using the https://technet.microsoft.com/en-us/library/cc754250(v=ws.10).aspx[set command] from the command line, or through the *System Properties->Environment Variables* GUI).
  128. [horizontal]
  129. `SERVICE_ID`::
  130. A unique identifier for the service. Useful if installing multiple instances
  131. on the same machine. Defaults to `elasticsearch-service-x64`.
  132. `SERVICE_USERNAME`::
  133. The user to run as, defaults to the local system account.
  134. `SERVICE_PASSWORD`::
  135. The password for the user specified in `%SERVICE_USERNAME%`.
  136. `SERVICE_DISPLAY_NAME`::
  137. The name of the service. Defaults to `{es} <version> %SERVICE_ID%`.
  138. `SERVICE_DESCRIPTION`::
  139. The description of the service. Defaults to `{es} <version> Windows Service - https://elastic.co`.
  140. `ES_JAVA_HOME`::
  141. The installation directory of the desired JVM to run the service under.
  142. `SERVICE_LOG_DIR`::
  143. Service log directory, defaults to `%ES_HOME%\logs`. Note that this does
  144. not control the path for the {es} logs; the path for these is set
  145. via the setting `path.logs` in the `elasticsearch.yml` configuration file,
  146. or on the command line.
  147. `ES_PATH_CONF`::
  148. Configuration file directory (which needs to include `elasticsearch.yml`,
  149. `jvm.options`, and `log4j2.properties` files), defaults to
  150. `%ES_HOME%\config`.
  151. `ES_JAVA_OPTS`::
  152. Any additional JVM system properties you may want to apply.
  153. `ES_START_TYPE`::
  154. Startup mode for the service. Can be either `auto` or `manual` (default).
  155. `ES_STOP_TIMEOUT`::
  156. The timeout in seconds that procrun waits for service to exit gracefully. Defaults to `0`.
  157. NOTE: At its core, `elasticsearch-service.bat` relies on https://commons.apache.org/proper/commons-daemon/[Apache Commons Daemon] project
  158. to install the service. Environment variables set prior to the service installation are copied and will be used during the service lifecycle. This means any changes made to them after the installation will not be picked up unless the service is reinstalled.
  159. [NOTE]
  160. ====
  161. By default, {es} automatically sizes JVM heap based on a node's
  162. <<node-roles,roles>> and total memory. We recommend this default sizing for most
  163. production environments. If needed, you can override default sizing by manually
  164. setting the heap size.
  165. When installing {es} on Windows as a service for the first time or running {es}
  166. from the command line, you can manually <<set-jvm-heap-size>>.
  167. To resize the heap for an already installed service,
  168. use the service manager: `bin\elasticsearch-service.bat manager`.
  169. ====
  170. NOTE: The service automatically configures a private temporary directory for use
  171. by {es} when it is running. This private temporary directory is
  172. configured as a sub-directory of the private temporary directory for the user
  173. running the installation. If the service will run under a different user, you
  174. can configure the location of the temporary directory that the service should
  175. use by setting the environment variable `ES_TMPDIR` to the preferred location
  176. before you execute the service installation.
  177. Using the Manager GUI::
  178. It is also possible to configure the service after it's been installed using the manager GUI (`elasticsearch-service-mgr.exe`), which offers insight into the installed service, including its status, startup type, JVM, start and stop settings amongst other things. Invoke `elasticsearch-service.bat manager` from the command-line to open the manager window.
  179. Most changes (like JVM settings) made through the manager GUI will require a restart of the service to take affect.
  180. include::connect-clients.asciidoc[]
  181. [[windows-layout]]
  182. ==== Directory layout of `.zip` archive
  183. The `.zip` package is entirely self-contained. All files and directories are,
  184. by default, contained within `%ES_HOME%` -- the directory created when
  185. unpacking the archive.
  186. This is very convenient because you don't have to create any directories to
  187. start using {es}, and uninstalling {es} is as easy as
  188. removing the `%ES_HOME%` directory. However, it is advisable to change the
  189. default locations of the config directory, the data directory, and the logs
  190. directory so that you do not delete important data later on.
  191. [cols="<h,<,<m,<m",options="header",]
  192. |=======================================================================
  193. | Type | Description | Default Location | Setting
  194. | home
  195. | {es} home directory or `%ES_HOME%`
  196. d| Directory created by unpacking the archive
  197. |
  198. | bin
  199. | Binary scripts including `elasticsearch` to start a node
  200. and `elasticsearch-plugin` to install plugins
  201. | %ES_HOME%\bin
  202. d|
  203. | conf
  204. | Configuration files including `elasticsearch.yml`
  205. | %ES_HOME%\config
  206. | <<config-files-location,ES_PATH_CONF>>
  207. | conf
  208. | Generated TLS keys and certificates for the transport and HTTP layer.
  209. | %ES_HOME%\config\certs
  210. d|
  211. | data
  212. | The location of the data files of each index / shard allocated
  213. on the node.
  214. | %ES_HOME%\data
  215. | path.data
  216. | logs
  217. | Log files location.
  218. | %ES_HOME%\logs
  219. | path.logs
  220. | plugins
  221. | Plugin files location. Each plugin will be contained in a subdirectory.
  222. | %ES_HOME%\plugins
  223. |
  224. | repo
  225. | Shared file system repository locations. Can hold multiple locations. A file system repository can be placed in to any subdirectory of any directory specified here.
  226. d| Not configured
  227. | path.repo
  228. |=======================================================================
  229. include::next-steps.asciidoc[]