windows.asciidoc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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. 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. [[download-msi]]
  18. ==== Download the `.msi` 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 `.msi` package for Elasticsearch v{version} from https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.msi
  24. endif::[]
  25. [[install-msi-gui]]
  26. ==== Install using the graphical user interface (GUI)
  27. Double-click the downloaded `.msi` package to launch a GUI wizard that will guide you through the
  28. installation process. You can view help on any step by clicking the `?` button, which reveals an
  29. aside panel with additional information for each input:
  30. [[msi-installer-help]]
  31. image::images/msi_installer/msi_installer_help.png[]
  32. Within the first screen, select the directory for the installation. In addition, select directories for where
  33. data, logs and configuration will be placed or <<msi-command-line-options,use the default locations>>:
  34. [[msi-installer-locations]]
  35. image::images/msi_installer/msi_installer_locations.png[]
  36. Then select whether to install as a service or start Elasticsearch manually as needed. When
  37. installing as a service, you can also configure the Windows account to run the service with,
  38. whether the service should be started after installation and the Windows startup behaviour:
  39. [[msi-installer-service]]
  40. image::images/msi_installer/msi_installer_service.png[]
  41. IMPORTANT: When selecting a Windows 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. Also
  43. ensure the account is able to run Windows services.
  44. Common configuration settings are exposed within the Configuration section, allowing the cluster
  45. name, node name and roles to be set, in addition to memory and network settings:
  46. [[msi-installer-configuration]]
  47. image::images/msi_installer/msi_installer_configuration.png[]
  48. A list of common plugins that can be downloaded and installed as part of the installation, with the option to configure an HTTPS proxy through which to download these plugins.
  49. TIP: Ensure the installation machine has access to the internet and that any corporate firewalls in place are configured to allow downloads from `artifacts.elastic.co`:
  50. [[msi-installer-selected-plugins]]
  51. image::images/msi_installer/msi_installer_selected_plugins.png[]
  52. As of version 6.3.0, {xpack} is now https://www.elastic.co/products/x-pack/open[bundled by default].
  53. The final step allows a choice of the type of license to install, in addition to
  54. security configuration and built-in user configuration:
  55. [[msi-installer-xpack]]
  56. image::images/msi_installer/msi_installer_xpack.png[]
  57. NOTE: {xpack} includes a choice of a Trial or Basic license. A Trial license is
  58. valid for 30 days, after which you can obtain one of the available subscriptions.
  59. The Basic license is free and perpetual. Consult the
  60. https://www.elastic.co/subscriptions[available subscriptions] for further
  61. details on which features are available under which license.
  62. After clicking the install button, the installation will begin:
  63. [[msi-installer-installing]]
  64. image::images/msi_installer/msi_installer_installing.png[]
  65. ...and will indicate when it has been successfully installed:
  66. [[msi-installer-success]]
  67. image::images/msi_installer/msi_installer_success.png[]
  68. [[install-msi-command-line]]
  69. ==== Install using the command line
  70. The `.msi` can also install Elasticsearch using the command line. The simplest installation
  71. using the same defaults as the GUI is achieved by first navigating to the download directory,
  72. then running:
  73. ["source","sh",subs="attributes,callouts"]
  74. --------------------------------------------
  75. msiexec.exe /i elasticsearch-{version}.msi /qn
  76. --------------------------------------------
  77. By default, `msiexec.exe` does not wait for the installation process to complete, since it runs in the
  78. Windows subsystem. To wait on the process to finish and ensure that `%ERRORLEVEL%` is set
  79. accordingly, it is recommended to use `start /wait` to create a process and wait for it to exit
  80. ["source","sh",subs="attributes,callouts"]
  81. --------------------------------------------
  82. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn
  83. --------------------------------------------
  84. As with any MSI installation package, a log file for the installation process can be found
  85. within the `%TEMP%` directory, with a randomly generated name adhering to the format
  86. `MSI<random>.LOG`. The path to a log file can be supplied using the `/l` command line argument
  87. ["source","sh",subs="attributes,callouts"]
  88. --------------------------------------------
  89. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn /l install.log
  90. --------------------------------------------
  91. Supported Windows Installer command line arguments can be viewed using
  92. ["source","sh",subs="attributes,callouts"]
  93. --------------------------------------------
  94. msiexec.exe /help
  95. --------------------------------------------
  96. ...or by consulting the https://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx[Windows Installer SDK Command-Line Options].
  97. [[msi-command-line-options]]
  98. ==== Command line options
  99. All settings exposed within the GUI are also available as command line arguments (referred to
  100. as _properties_ within Windows Installer documentation) that can be passed to `msiexec.exe`:
  101. [horizontal]
  102. `INSTALLDIR`::
  103. The installation directory. The final directory in the path **must**
  104. be the version of Elasticsearch.
  105. Defaults to ++%ProgramW6432%\Elastic\Elasticsearch{backslash}{version}++.
  106. `DATADIRECTORY`::
  107. The directory in which to store your data.
  108. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\data`
  109. `CONFIGDIRECTORY`::
  110. The directory in which to store your configuration.
  111. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\config`
  112. `LOGSDIRECTORY`::
  113. The directory in which to store your logs.
  114. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\logs`
  115. `PLACEWRITABLELOCATIONSINSAMEPATH`::
  116. Whether the data, configuration and logs directories
  117. should be created under the installation directory. Defaults to `false`
  118. `INSTALLASSERVICE`::
  119. Whether Elasticsearch is installed and configured as a Windows Service.
  120. Defaults to `true`
  121. `STARTAFTERINSTALL`::
  122. Whether the Windows Service is started after installation finishes.
  123. Defaults to `true`
  124. `STARTWHENWINDOWSSTARTS`::
  125. Whether the Windows Service is started when Windows is started.
  126. Defaults to `true`
  127. `USELOCALSYSTEM`::
  128. Whether the Windows service runs under the LocalSystem Account.
  129. Defaults to `true`
  130. `USENETWORKSERVICE`::
  131. Whether the Windows service runs under the NetworkService Account. Defaults
  132. to `false`
  133. `USEEXISTINGUSER`::
  134. Whether the Windows service runs under a specified existing account. Defaults
  135. to `false`
  136. `USER`::
  137. The username for the account under which the Windows service runs. Defaults to `""`
  138. `PASSWORD`::
  139. The password for the account under which the Windows service runs. Defaults to `""`
  140. `CLUSTERNAME`::
  141. The name of the cluster. Defaults to `elasticsearch`
  142. `NODENAME`::
  143. The name of the node. Defaults to `%COMPUTERNAME%`
  144. `MASTERNODE`::
  145. Whether Elasticsearch is configured as a master node. Defaults to `true`
  146. `DATANODE`::
  147. Whether Elasticsearch is configured as a data node. Defaults to `true`
  148. `INGESTNODE`::
  149. Whether Elasticsearch is configured as an ingest node. Defaults to `true`
  150. `SELECTEDMEMORY`::
  151. The amount of memory to allocate to the JVM heap for Elasticsearch.
  152. Defaults to `2048` unless the target machine has less than 4GB in total, in which case
  153. it defaults to 50% of total memory.
  154. `LOCKMEMORY`::
  155. Whether `bootstrap.memory_lock` should be used to try to lock the process
  156. address space into RAM. Defaults to `false`
  157. `UNICASTNODES`::
  158. A comma separated list of hosts in the form `host:port` or `host` to be used for
  159. unicast discovery. Defaults to `""`
  160. `MINIMUMMASTERNODES`::
  161. The minimum number of master-eligible nodes that must be visible
  162. in order to form a cluster. Defaults to `""`
  163. `NETWORKHOST`::
  164. The hostname or IP address to bind the node to and _publish_ (advertise) this
  165. host to other nodes in the cluster. Defaults to `""`
  166. `HTTPPORT`::
  167. The port to use for exposing Elasticsearch APIs over HTTP. Defaults to `9200`
  168. `TRANSPORTPORT`::
  169. The port to use for internal communication between nodes within the cluster.
  170. Defaults to `9300`
  171. `PLUGINS`::
  172. A comma separated list of the plugins to download and install as part of the
  173. installation. Defaults to `""`
  174. `HTTPSPROXYHOST`::
  175. The proxy host to use to download plugins over HTTPS. Defaults to `""`
  176. `HTTPSPROXYPORT`::
  177. The proxy port to use to download plugins over HTTPS. Defaults to `443`
  178. `HTTPPROXYHOST`::
  179. The proxy host to use to download plugins over HTTP. Defaults to `""`
  180. `HTTPPROXYPORT`::
  181. The proxy port to use to download plugins over HTTP. Defaults to `80`
  182. `XPACKLICENSE`::
  183. The type of license to install, either `Basic` or `Trial`. Defaults to `Basic`
  184. `XPACKSECURITYENABLED`::
  185. When installing with a `Trial` license, whether {security-features} are
  186. enabled. Defaults to `true`
  187. `BOOTSTRAPPASSWORD`::
  188. When installing with a `Trial` license and {security-features} are enabled,
  189. the password to used to bootstrap the cluster and persisted as the
  190. `bootstrap.password` setting in the keystore. Defaults to a randomized value.
  191. `SKIPSETTINGPASSWORDS`::
  192. When installing with a `Trial` license and {security-features} enabled,
  193. whether the installation should skip setting up the built-in users.
  194. Defaults to `false`
  195. `ELASTICUSERPASSWORD`::
  196. When installing with a `Trial` license and {security-features} are enabled,
  197. the password to use for the built-in user `elastic`. Defaults to `""`
  198. `KIBANAUSERPASSWORD`::
  199. When installing with a `Trial` license and {security-features} are enabled,
  200. the password to use for the built-in user `kibana`. Defaults to `""`
  201. `LOGSTASHSYSTEMUSERPASSWORD`::
  202. When installing with a `Trial` license and {security-features} are enabled,
  203. the password to use for the built-in user `logstash_system`. Defaults to `""`
  204. To pass a value, simply append the property name and value using the format
  205. `<PROPERTYNAME>="<VALUE>"` to the installation command. For example, to use a
  206. different installation directory to the default one:
  207. ["source","sh",subs="attributes,callouts"]
  208. --------------------------------------------
  209. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn INSTALLDIR="C:\Custom Install Directory\{version}"
  210. --------------------------------------------
  211. Consult the https://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx[Windows Installer SDK Command-Line Options]
  212. for additional rules related to values containing quotation marks.
  213. ifdef::include-xpack[]
  214. [[msi-installer-enable-indices]]
  215. ==== Enable automatic creation of {xpack} indices
  216. The {stack} features try to automatically create a number of indices within {es}.
  217. include::xpack-indices.asciidoc[]
  218. endif::include-xpack[]
  219. [[msi-installer-command-line-running]]
  220. include::msi-windows-start.asciidoc[]
  221. [[msi-installer-command-line-configuration]]
  222. ==== Configuring Elasticsearch on the command line
  223. Elasticsearch loads its configuration from the `%ES_PATH_CONF%\elasticsearch.yml`
  224. file by default. The format of this config file is explained in
  225. <<settings>>.
  226. Any settings that can be specified in the config file can also be specified on
  227. the command line, using the `-E` syntax as follows:
  228. ["source","sh",subs="attributes,callouts"]
  229. --------------------------------------------
  230. .\bin\elasticsearch.exe -E cluster.name=my_cluster -E node.name=node_1
  231. --------------------------------------------
  232. NOTE: Values that contain spaces must be surrounded with quotes. For instance `-E path.logs="C:\My Logs\logs"`.
  233. TIP: Typically, any cluster-wide settings (like `cluster.name`) should be
  234. added to the `elasticsearch.yml` config file, while any node-specific settings
  235. such as `node.name` could be specified on the command line.
  236. include::check-running.asciidoc[]
  237. [[msi-installer-windows-service]]
  238. ==== Installing Elasticsearch as a Service on Windows
  239. Elasticsearch can be installed as a service to run in the background or start
  240. automatically at boot time without any user interaction. This can be achieved upon installation
  241. using the following command line options
  242. * `INSTALLASSERVICE=true`
  243. * `STARTAFTERINSTALL=true`
  244. * `STARTWHENWINDOWSSTARTS=true`
  245. Once installed, Elasticsearch will appear within the Services control panel:
  246. [[msi-installer-installed-service]]
  247. image::images/msi_installer/msi_installer_installed_service.png[]
  248. and can be stopped and restarted from within the control panel, or from the command line using:
  249. with Command Prompt:
  250. [source,sh]
  251. --------------------------------------------
  252. sc.exe stop Elasticsearch
  253. sc.exe start Elasticsearch
  254. --------------------------------------------
  255. with PowerShell:
  256. [source,powershell]
  257. --------------------------------------------
  258. Get-Service Elasticsearch | Stop-Service
  259. Get-Service Elasticsearch | Start-Service
  260. --------------------------------------------
  261. Changes can be made to `jvm.options` and `elasticsearch.yml` configuration files to configure the
  262. service after installation. Most changes (like JVM settings) will require a restart of the
  263. service in order to take effect.
  264. [[upgrade-msi-gui]]
  265. ==== Upgrade using the graphical user interface (GUI)
  266. The `.msi` package supports upgrading an installed version of Elasticsearch to a newer
  267. version. The upgrade process through the GUI handles upgrading all
  268. installed plugins as well as retaining both your data and configuration.
  269. Downloading and double-clicking on a newer version of the `.msi` package will launch the GUI wizard.
  270. The first step will list the read-only properties from the previous installation:
  271. [[msi-installer-upgrade-notice]]
  272. image::images/msi_installer/msi_installer_upgrade_notice.png[]
  273. The next step allows certain configuration options to be changed:
  274. [[msi-installer-upgrade-configuration]]
  275. image::images/msi_installer/msi_installer_upgrade_configuration.png[]
  276. Finally, the plugins step allows currently installed plugins to be upgraded or removed, and
  277. for plugins not currently installed, to be downloaded and installed:
  278. [[msi-installer-upgrade-plugins]]
  279. image::images/msi_installer/msi_installer_upgrade_plugins.png[]
  280. [[upgrade-msi-command-line]]
  281. ==== Upgrade using the command line
  282. The `.msi` can also upgrade Elasticsearch using the command line.
  283. [IMPORTANT]
  284. ===========================================
  285. A command line upgrade requires passing the **same** command line properties as
  286. used at first install time; the Windows Installer does not remember these properties.
  287. For example, if you originally installed with the command line options `PLUGINS="ingest-geoip"` and
  288. `LOCKMEMORY="true"`, then you must pass these same values when performing an
  289. upgrade from the command line.
  290. The **exception** to this is the `INSTALLDIR` parameter (if originally specified), which must be a different directory to the
  291. current installation.
  292. If setting `INSTALLDIR`, the final directory in the path **must** be the version of Elasticsearch e.g.
  293. ++C:\Program Files\Elastic\Elasticsearch{backslash}{version}++
  294. ===========================================
  295. The simplest upgrade, assuming Elasticsearch was installed using all defaults,
  296. is achieved by first navigating to the download directory, then running:
  297. ["source","sh",subs="attributes,callouts"]
  298. --------------------------------------------
  299. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn
  300. --------------------------------------------
  301. Similar to the install process, a path to a log file for the upgrade process can
  302. be passed using the `/l` command line argument
  303. ["source","sh",subs="attributes,callouts"]
  304. --------------------------------------------
  305. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn /l upgrade.log
  306. --------------------------------------------
  307. [[uninstall-msi-gui]]
  308. ==== Uninstall using Add/Remove Programs
  309. The `.msi` package handles uninstallation of all directories and files added as part of installation.
  310. WARNING: Uninstallation will remove **all** contents created as part of
  311. installation, **except for data, config or logs directories**. It is recommended that you make a copy of your data directory before upgrading or consider using the snapshot API.
  312. MSI installer packages do not provide a GUI for uninstallation. An installed program can be uninstalled
  313. by pressing the Windows key and typing `add or remove programs` to open the system settings.
  314. Once opened, find the Elasticsearch installation within the list of installed applications, click
  315. and choose `Uninstall`:
  316. [[msi-installer-uninstall]]
  317. image::images/msi_installer/msi_installer_uninstall.png[]
  318. This will launch the uninstallation process.
  319. [[uninstall-msi-command-line]]
  320. ==== Uninstall using the command line
  321. Uninstallation can also be performed from the command line by navigating to the directory
  322. containing the `.msi` package and running:
  323. ["source","sh",subs="attributes,callouts"]
  324. --------------------------------------------
  325. start /wait msiexec.exe /x elasticsearch-{version}.msi /qn
  326. --------------------------------------------
  327. Similar to the install process, a path to a log file for the uninstallation process can
  328. be passed using the `/l` command line argument
  329. ["source","sh",subs="attributes,callouts"]
  330. --------------------------------------------
  331. start /wait msiexec.exe /x elasticsearch-{version}.msi /qn /l uninstall.log
  332. --------------------------------------------
  333. include::next-steps.asciidoc[]