windows.asciidoc 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. [[windows]]
  2. === Install Elasticsearch on Windows
  3. Elasticsearch can be installed on Windows using the `.zip` package. This
  4. comes with a `service.bat` command which will setup Elasticsearch to run as a
  5. service.
  6. The latest stable version of Elasticsearch can be found on the
  7. link:/downloads/elasticsearch[Download Elasticsearch] page.
  8. Other versions can be found on the
  9. link:/downloads/past-releases[Past Releases page].
  10. [[install-windows]]
  11. ==== Download and install the `.zip` package
  12. Download the `.zip` archive for Elastisearch v{version} from: https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/{version}/elasticsearch-{version}.zip
  13. Unzip it with your favourite unzip tool. This will create a folder called
  14. +elasticsearch-{version}+, which we will refer to as `%ES_HOME%`. In a terminal
  15. window, `CD` to the `%ES_HOME%` directory, for instance:
  16. ["source","sh",subs="attributes"]
  17. ----------------------------
  18. CD c:\elasticsearch-{version}
  19. ----------------------------
  20. [[windows-running]]
  21. ==== Running Elasticsearch from the command line
  22. Elasticsearch can be started from the command line as follows:
  23. [source,sh]
  24. --------------------------------------------
  25. .\bin\elasticsearch
  26. --------------------------------------------
  27. By default, Elasticsearch runs in the foreground, prints its logs to `STDOUT`,
  28. and can be stopped by pressing `Ctrl-C`.
  29. [[windows-configuring]]
  30. ==== Configuring Elasticsearch on the command line
  31. Elasticsearch loads its configuration from the `%ES_HOME%/config/elasticsearch.yml`
  32. file by default. The format of this config file is explained in
  33. <<settings>>.
  34. Any settings that can be specified in the config file can also be specified on
  35. the command line, using the `-E` syntax, and prepending `es.` to the setting
  36. name, as follows:
  37. [source,sh]
  38. --------------------------------------------
  39. ./bin/elasticsearch -E es.cluster.name=my_cluster -E es.node.name=node_1
  40. --------------------------------------------
  41. NOTE: Values that contain spaces must be surrounded with qoutes. For instance `-E es.path.logs="C:\My Logs\logs"`.
  42. TIP: Typically, any cluster-wide settings (like `cluster.name`) should be
  43. added to the `elasticsearch.yml` config file, while any node-specific settings
  44. such as `node.name` could be specified on the command line.
  45. include::check-running.asciidoc[]
  46. [[windows-service]]
  47. ==== Installing Elasticsearch as a Service on Windows
  48. Elasticsearch can be installed as a service to run in the background or start
  49. automatically at boot time without any user interaction. This can be achieved
  50. through the `service.bat` script in the `bin\` folder which allows one to
  51. install, remove, manage or configure the service and potentially start and
  52. stop the service, all from the command-line.
  53. ["source","sh",subs="attributes,callouts"]
  54. --------------------------------------------------
  55. c:\elasticsearch-{version}{backslash}bin>service
  56. Usage: service.bat install|remove|start|stop|manager [SERVICE_ID]
  57. --------------------------------------------------
  58. The script requires one parameter (the command to execute) followed by an
  59. optional one indicating the service id (useful when installing multiple
  60. Elasticsearch services).
  61. The commands available are:
  62. [horizontal]
  63. `install`:: Install Elasticsearch as a service
  64. `remove`:: Remove the installed Elasticsearch service (and stop the service if started)
  65. `start`:: Start the Elasticsearch service (if installed)
  66. `stop`:: Stop the Elasticsearch service (if started)
  67. `manager`:: Start a GUI for managing the installed service
  68. Based on the architecture of the available JDK/JRE (set through `JAVA_HOME`),
  69. the appropriate 64-bit(x64) or 32-bit(x86) service will be installed. This
  70. information is made available during install:
  71. ["source","sh",subs="attributes"]
  72. --------------------------------------------------
  73. c:\elasticsearch-{version}{backslash}bin>service install
  74. Installing service : "elasticsearch-service-x64"
  75. Using JAVA_HOME (64-bit): "c:\jvm\jdk1.8"
  76. The service 'elasticsearch-service-x64' has been installed.
  77. --------------------------------------------------
  78. 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.
  79. NOTE: Upgrading (or downgrading) JVM versions does not require the service to be reinstalled. However, upgrading across JVM types (e.g. JRE versus SE) is not supported, and does require the service to be reinstalled.
  80. [[windows-service-settings]]
  81. [float]
  82. === Customizing service settings
  83. The Elasticsearch service can be configured prior to installation by setting the 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).
  84. [horizontal]
  85. `SERVICE_ID`::
  86. A unique identifier for the service. Useful if installing multiple instances on the same machine. Defaults to `elasticsearch-service-x86` (on 32-bit Windows) or `elasticsearch-service-x64` (on 64-bit Windows).
  87. `SERVICE_USERNAME`::
  88. The user to run as, defaults to the local system account.
  89. `SERVICE_PASSWORD`::
  90. The password for the user specified in `%SERVICE_USERNAME%`.
  91. `SERVICE_DISPLAY_NAME`::
  92. The name of the service. Defaults to `Elasticsearch <version> %SERVICE_ID%`.
  93. `SERVICE_DESCRIPTION`::
  94. The description of the service. Defaults to `Elasticsearch <version> Windows Service - https://elastic.co`.
  95. `JAVA_HOME`::
  96. The installation directory of the desired JVM to run the service under.
  97. `ES_HEAP_SIZE`::
  98. The heap size to start with.
  99. `ES_MIN_MEM`::
  100. The initial memory allocation pool for the JVM (`Xms`). Defaults to `256m`, overriden by `%ES_HEAP_SIZE%`.
  101. `ES_MAX_MEM`::
  102. The maxmimum memory allocation pool for the JVM (`Xmx`). Defaults to `1g`, overriden by `%ES_HEAP_SIZE%`.
  103. `LOG_DIR`::
  104. Log directory, defaults to `%ES_HOME%\logs`.
  105. `DATA_DIR`::
  106. Data directory, defaults to `%ES_HOME%\data`.
  107. `CONF_DIR`::
  108. Configuration file directory (which needs to include `elasticsearch.yml`
  109. and `logging.yml` files), defaults to `%ES_HOME%\conf`.
  110. `ES_JAVA_OPTS`::
  111. Any additional JVM system properties you may want to apply.
  112. `ES_START_TYPE`::
  113. Startup mode for the service. Can be either `auto` or `manual` (default).
  114. `ES_STOP_TIMEOUT` ::
  115. The timeout in seconds that procrun waits for service to exit gracefully. Defaults to `0`.
  116. NOTE: At its core, `service.bat` relies on http://commons.apache.org/proper/commons-daemon/[Apache Commons Daemon] project
  117. 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.
  118. Using the Manager GUI::
  119. 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 `service.bat manager` from the command-line will open up the manager window:
  120. image::images/service-manager-win.png["Windows Service Manager GUI",align="center"]
  121. Most changes (like JVM settings) made through the manager GUI will require a restart of the service in order to take affect.
  122. [[windows-layout]]
  123. ==== Directory layout of `.zip` archive
  124. The `.zip` package is entirely self-contained. All files and directories are,
  125. by default, contained within `%ES_HOME%` -- the directory created when
  126. unpacking the archive.
  127. This is very convenient because you don't have to create any directories to
  128. start using Elasticsearch, and uninstalling Elasticsearch is as easy as
  129. removing the `%ES_HOME%` directory. However, it is advisable to change the
  130. default locations of the config directory, the data directory, and the logs
  131. directory so that you do not delete important data later on.
  132. [cols="<h,<,<m,<m",options="header",]
  133. |=======================================================================
  134. | Type | Description | Default Location | Setting
  135. | home
  136. | Elasticsearch home directory or `%ES_HOME%`
  137. d| Directory created by unpacking the archive
  138. |
  139. | bin
  140. | Binary scripts including `elasticsearch` to start a node
  141. and `elasticsearch-plugin` to install plugins
  142. | %ES_HOME%\bin
  143. d|
  144. | conf
  145. | Configuration files including `elasticsearch.yml`
  146. | %ES_HOME%\config
  147. | path.conf
  148. | data
  149. | The location of the data files of each index / shard allocated
  150. on the node. Can hold multiple locations.
  151. | %ES_HOME%\data
  152. | path.data
  153. | logs
  154. | Log files location.
  155. | %ES_HOME%\logs
  156. | path.logs
  157. | plugins
  158. | Plugin files location. Each plugin will be contained in a subdirectory.
  159. | %ES_HOME%\plugins
  160. | path.plugins
  161. | repo
  162. | 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.
  163. d| Not configured
  164. | path.repo
  165. | script
  166. | Location of script files.
  167. | %ES_HOME%\scripts
  168. | path.script
  169. |=======================================================================
  170. include::next-steps.asciidoc[]