windows.asciidoc 16 KB

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