zip-windows.asciidoc 11 KB

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