windows.asciidoc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. [[windows]]
  2. === Install Elasticsearch with Windows MSI Installer
  3. beta[]
  4. Elasticsearch can be installed on Windows using the `.msi` package. This can
  5. install Elasticsearch as a Windows service or allow it to be run manually using
  6. the included `elasticsearch.exe` executable.
  7. TIP: Elasticsearch has historically been installed on Windows using the <<zip-windows, .zip>> archive.
  8. You can continue using the `.zip` approach if you prefer.
  9. The latest stable version of Elasticsearch can be found on the
  10. link:/downloads/elasticsearch[Download Elasticsearch] page.
  11. Other versions can be found on the
  12. link:/downloads/past-releases[Past Releases page].
  13. NOTE: Elasticsearch requires Java 8 or later. Use the
  14. http://www.oracle.com/technetwork/java/javase/downloads/index.html[official Oracle distribution]
  15. or an open-source distribution such as http://openjdk.java.net[OpenJDK].
  16. [[download-msi]]
  17. ==== Download the `.msi` package
  18. ifeval::["{release-state}"=="unreleased"]
  19. Version {version} of Elasticsearch has not yet been released.
  20. endif::[]
  21. ifeval::["{release-state}"!="unreleased"]
  22. Download the `.msi` package for Elasticsearch v{version} from https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.msi
  23. endif::[]
  24. [[install-msi-gui]]
  25. ==== Install using the graphical user interface (GUI)
  26. Double-click the downloaded `.msi` package to launch a GUI wizard that will guide you through the
  27. installation process. You can view help on any step by clicking the `?` button, which reveals an
  28. aside panel with additional information for each input:
  29. [[msi-installer-help]]
  30. image::images/msi_installer/msi_installer_help.png[]
  31. Within the first screen, select the directory for the installation. In addition, select directories for where
  32. data, logs and configuration will reside or <<msi-command-line-options,roll with the default locations>>:
  33. [[msi-installer-locations]]
  34. image::images/msi_installer/msi_installer_locations.png[]
  35. Then select whether to install as a service or start Elasticsearch manually as needed. When
  36. installing as a service, you can also decide which account to run the service under as well
  37. as whether the service should be started after installation and when Windows is started or
  38. restarted:
  39. [[msi-installer-service]]
  40. image::images/msi_installer/msi_installer_service.png[]
  41. IMPORTANT: When selecting an account to run the service with, be sure that the chosen account
  42. has sufficient privileges to access the installation and other deployment directories chosen.
  43. Common configuration settings are exposed within the Configuration section, allowing the cluster
  44. name, node name and roles to be set, in addition to memory and network settings:
  45. [[msi-installer-configuration]]
  46. image::images/msi_installer/msi_installer_configuration.png[]
  47. Finally, the installer provides a list of common plugins that can be downloaded and installed as
  48. part of the installation:
  49. [[msi-installer-selected-plugins]]
  50. image::images/msi_installer/msi_installer_selected_plugins.png[]
  51. NOTE: X-Pack includes a trial license for 30 days. After that, you can obtain one of the https://www.elastic.co/subscriptions[available subscriptions] or {ref}/security-settings.html[disable Security]. The Basic license is free and includes the https://www.elastic.co/products/x-pack/monitoring[Monitoring] extension.
  52. After clicking the install button, Elasticsearch will be installed:
  53. [[msi-installer-success]]
  54. image::images/msi_installer/msi_installer_success.png[]
  55. [[install-msi-command-line]]
  56. ==== Install using the command line
  57. The `.msi` can also install Elasticsearch using the command line. The simplest installation
  58. using the same defaults as the GUI is achieved by first navigating to the download directory,
  59. then running:
  60. ["source","sh",subs="attributes,callouts"]
  61. --------------------------------------------
  62. msiexec.exe /i elasticsearch-{version}.msi /qn
  63. --------------------------------------------
  64. By default, msiexec does not wait for the installation process to complete, since it runs in the
  65. Windows subsystem. To wait on the process to finish and ensure that `%ERRORLEVEL%` is set
  66. accordingly, it is recommended to use `start /wait` to create a process and wait for it to exit
  67. ["source","sh",subs="attributes,callouts"]
  68. --------------------------------------------
  69. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn
  70. --------------------------------------------
  71. As with any MSI installation package, a log file for the installation process can be found
  72. within the `%TEMP%` directory, with a randomly generated name adhering to the format
  73. `MSI<random>.LOG`. The path to a log file can be supplied using the `/l` command line argument
  74. ["source","sh",subs="attributes,callouts"]
  75. --------------------------------------------
  76. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn /l install.log
  77. --------------------------------------------
  78. Supported Windows Installer command line arguments can be viewed using
  79. ["source","sh",subs="attributes,callouts"]
  80. --------------------------------------------
  81. msiexec.exe /help
  82. --------------------------------------------
  83. or by consulting the https://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx[Windows Installer SDK Command-Line Options].
  84. [[msi-command-line-options]]
  85. ==== Command line options
  86. All settings exposed within the GUI are also available as command line arguments (referred to
  87. as _properties_ within Windows Installer documentation) that can be passed to msiexec:
  88. [horizontal]
  89. `INSTALLDIR`::
  90. The installation directory. Defaults to `%ProgramW6432%\Elastic\Elasticsearch`
  91. `DATADIRECTORY`::
  92. The directory in which to store your data.
  93. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\data`
  94. `CONFIGDIRECTORY`::
  95. The directory in which to store your configuration.
  96. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\config`
  97. `LOGSDIRECTORY`::
  98. The directory in which to store your logs.
  99. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\logs`
  100. `PLACEWRITABLELOCATIONSINSAMEPATH`::
  101. Whether the data, configuration and logs directories
  102. should be created under the installation directory. Defaults to `false`
  103. `INSTALLASSERVICE`::
  104. Whether Elasticsearch is installed and configured as a Windows Service.
  105. Defaults to `true`
  106. `STARTAFTERINSTALL`::
  107. Whether the Windows Service is started after installation finishes.
  108. Defaults to `true`
  109. `STARTWHENWINDOWSSTARTS`::
  110. Whether the Windows Service is started when Windows is started.
  111. Defaults to `true`
  112. `USELOCALSYSTEM`::
  113. Whether the Windows service runs under the LocalSystem Account.
  114. Defaults to `true`
  115. `USENETWORKSERVICE`::
  116. Whether the Windows service runs under the NetworkService Account. Defaults
  117. to `false`
  118. `USEEXISTINGUSER`::
  119. Whether the Windows service runs under a specified existing account. Defaults
  120. to `false`
  121. `USER`::
  122. The username for the account under which the Windows service runs. Defaults to `""`
  123. `PASSWORD`::
  124. The password for the account under which the Windows service runs. Defaults to `""`
  125. `CLUSTERNAME`::
  126. The name of the cluster. Defaults to `elasticsearch`
  127. `NODENAME`::
  128. The name of the node. Defaults to `%COMPUTERNAME%`
  129. `MASTERNODE`::
  130. Whether Elasticsearch is configured as a master node. Defaults to `true`
  131. `DATANODE`::
  132. Whether Elasticsearch is configured as a data node. Defaults to `true`
  133. `INGESTNODE`::
  134. Whether Elasticsearch is configured as an ingest node. Defaults to `true`
  135. `SELECTEDMEMORY`::
  136. The amount of memory to allocate to the JVM heap for Elasticsearch.
  137. Defaults to `2048`. If the target machine has less than 4GB in total, defaults
  138. to 50% of total memory.
  139. `LOCKMEMORY`::
  140. Whether `bootstrap.memory_lock` should be used to try to lock the process
  141. address space into RAM. Defaults to `false`
  142. `UNICASTNODES`::
  143. A comma separated list of hosts in the form `host:port` or `host` to be used for
  144. unicast discovery. Defaults to `""`
  145. `MINIMUMMASTERNODES`::
  146. The minimum number of master-eligible nodes that must be visible
  147. in order to form a cluster. Defaults to `""`
  148. `NETWORKHOST`::
  149. The hostname or IP address to bind the node to and _publish_ (advertise) this
  150. host to other nodes in the cluster. Defaults to `""`
  151. `HTTPPORT`::
  152. The port to use for exposing Elasticsearch APIs over HTTP. Defaults to `9200`
  153. `TRANSPORTPORT`::
  154. The port to use for internal communication between nodes within the cluster.
  155. Defaults to `9300`
  156. `PLUGINS`::
  157. A comma separated list of the plugins to download and install as part of the installation. Defaults `""`
  158. To pass a value, simply append the property name and value using the format `<PROPERTYNAME>="<VALUE>"` to
  159. the installation command. For example, to use a different installation directory to the default one and to install https://www.elastic.co/products/x-pack[X-Pack]:
  160. ["source","sh",subs="attributes,callouts"]
  161. --------------------------------------------
  162. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn INSTALLDIR="C:\Custom Install Directory" PLUGINS="x-pack"
  163. --------------------------------------------
  164. Consult the https://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx[Windows Installer SDK Command-Line Options]
  165. for additional rules related to values containing quotation marks.
  166. [[msi-installer-command-line-running]]
  167. ==== Running Elasticsearch from the command line
  168. Once installed, Elasticsearch can be started from the command line, if not installed as a service
  169. and configured to start when installation completes, as follows:
  170. ["source","sh",subs="attributes,callouts"]
  171. --------------------------------------------
  172. .\bin\elasticsearch.exe
  173. --------------------------------------------
  174. The command line terminal will display output similar to the following:
  175. [[msi-installer-elasticsearch-exe]]
  176. image::images/msi_installer/elasticsearch_exe.png[]
  177. By default, Elasticsearch runs in the foreground, prints its logs to `STDOUT` in addition
  178. to the `<cluster name>.log` file within `LOGSDIRECTORY`, and can be stopped by pressing `Ctrl-C`.
  179. [[msi-installer-command-line-configuration]]
  180. ==== Configuring Elasticsearch on the command line
  181. Elasticsearch loads its configuration from the `%ES_HOME%\config\elasticsearch.yml`
  182. file by default. The format of this config file is explained in
  183. <<settings>>.
  184. Any settings that can be specified in the config file can also be specified on
  185. the command line, using the `-E` syntax as follows:
  186. ["source","sh",subs="attributes,callouts"]
  187. --------------------------------------------
  188. .\bin\elasticsearch.exe -E cluster.name=my_cluster -E node.name=node_1
  189. --------------------------------------------
  190. NOTE: Values that contain spaces must be surrounded with quotes. For instance `-E path.logs="C:\My Logs\logs"`.
  191. TIP: Typically, any cluster-wide settings (like `cluster.name`) should be
  192. added to the `elasticsearch.yml` config file, while any node-specific settings
  193. such as `node.name` could be specified on the command line.
  194. include::check-running.asciidoc[]
  195. [[msi-installer-windows-service]]
  196. ==== Installing Elasticsearch as a Service on Windows
  197. Elasticsearch can be installed as a service to run in the background or start
  198. automatically at boot time without any user interaction. This can be achieved upon installation
  199. using the following command line options
  200. * `INSTALLASSERVICE=true`
  201. * `STARTAFTERINSTALL=true`
  202. * `STARTWHENWINDOWSSTARTS=true`
  203. Once installed, Elasticsearch will appear within the Services control panel:
  204. [[msi-installer-installed-service]]
  205. image::images/msi_installer/msi_installer_installed_service.png[]
  206. and can be stopped and restarted from within the control panel, or from the command line using:
  207. with Command Prompt:
  208. [source,sh]
  209. --------------------------------------------
  210. sc.exe stop Elasticsearch
  211. sc.exe start Elasticsearch
  212. --------------------------------------------
  213. with PowerShell:
  214. [source,powershell]
  215. --------------------------------------------
  216. Get-Service Elasticsearch | Stop-Service | Start-Service
  217. --------------------------------------------
  218. Changes can be made to jvm.options and elasticsearch.yml configuration files to configure the
  219. service after installation. Most changes (like JVM settings) will require a restart of the
  220. service in order to take affect.
  221. [[upgrade-msi-gui]]
  222. ==== Upgrade using the graphical user interface (GUI)
  223. The `.msi` package supports upgrading an installed version of Elasticsearch to a newer
  224. version of Elasticsearch. The upgrade process through the GUI handles upgrading all
  225. installed plugins as well as retaining both your data and configuration.
  226. Downloading and clicking on a newer version of the `.msi` package will launch the GUI wizard.
  227. The first step will list the read only properties from the previous installation:
  228. [[msi-installer-upgrade-notice]]
  229. image::images/msi_installer/msi_installer_upgrade_notice.png[]
  230. The following configuration step allows certain configuration options to be changed:
  231. [[msi-installer-upgrade-configuration]]
  232. image::images/msi_installer/msi_installer_upgrade_configuration.png[]
  233. Finally, the plugins step allows currently installed plugins to be upgraded or removed, and
  234. for plugins not currently installed, to be downloaded and installed:
  235. [[msi-installer-upgrade-plugins]]
  236. image::images/msi_installer/msi_installer_upgrade_plugins.png[]
  237. [[upgrade-msi-command-line]]
  238. ==== Upgrade using the command line
  239. The `.msi` can also upgrade Elasticsearch using the command line.
  240. [IMPORTANT]
  241. ===========================================
  242. A command line upgrade requires passing the **same** command line properties as
  243. used at first install time; the Windows Installer does not remember these properties.
  244. For example, if you originally installed with the command line options `PLUGINS="x-pack"` and
  245. `LOCKMEMORY="true"`, then you must pass these same values when performing an
  246. upgrade from the command line.
  247. ===========================================
  248. The simplest upgrade, assuming Elasticsearch was installed using all defaults,
  249. is achieved by first navigating to the download directory, then running:
  250. ["source","sh",subs="attributes,callouts"]
  251. --------------------------------------------
  252. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn
  253. --------------------------------------------
  254. Similar to the install process, a path to a log file for the upgrade process can
  255. be passed using the `/l` command line argument
  256. ["source","sh",subs="attributes,callouts"]
  257. --------------------------------------------
  258. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn /l upgrade.log
  259. --------------------------------------------
  260. [[uninstall-msi-gui]]
  261. ==== Uninstall using Add/Remove Programs
  262. The `.msi` package handles uninstallation of all directories and files added as part of installation.
  263. WARNING: Uninstallation will remove all directories and their contents created as part of
  264. installation, including data within the data directory. If you wish to retain your data upon
  265. uninstallation, it is recommended that you make a copy of the data directory before uninstallation.
  266. MSI installer packages do not provide a GUI for uninstallation. An installed program can be uninstalled
  267. by pressing the Windows key and typing `add or remove programs` to open the system settings.
  268. Once opened, find the Elasticsearch installation within the list of installed applications, click
  269. and choose `Uninstall`:
  270. [[msi-installer-uninstall]]
  271. image::images/msi_installer/msi_installer_uninstall.png[]
  272. This will launch the uninstallation process.
  273. [[uninstall-msi-command-line]]
  274. ==== Uninstall using the command line
  275. Uninstallation can also be performed from the command line by navigating to the directory
  276. containing the `.msi` package and running:
  277. ["source","sh",subs="attributes,callouts"]
  278. --------------------------------------------
  279. start /wait msiexec.exe /x elasticsearch-{version}.msi /qn
  280. --------------------------------------------
  281. Similar to the install process, a path to a log file for the uninstallation process can
  282. be passed using the `/l` command line argument
  283. ["source","sh",subs="attributes,callouts"]
  284. --------------------------------------------
  285. start /wait msiexec.exe /x elasticsearch-{version}.msi /qn /l uninstall.log
  286. --------------------------------------------
  287. include::next-steps.asciidoc[]