zip-windows.asciidoc 11 KB

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