windows.asciidoc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  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. 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}.msi
  27. endif::[]
  28. [[install-msi-gui]]
  29. ==== Install using the graphical user interface (GUI)
  30. Double-click the downloaded `.msi` package to launch a GUI wizard that will guide you through the
  31. installation process. You can view help on any step by clicking the `?` button, which reveals an
  32. aside panel with additional information for each input:
  33. [[msi-installer-help]]
  34. image::images/msi_installer/msi_installer_help.png[]
  35. Within the first screen, select the directory for the installation. In addition, select directories for where
  36. data, logs and configuration will reside or <<msi-command-line-options,roll with the default locations>>:
  37. [[msi-installer-locations]]
  38. image::images/msi_installer/msi_installer_locations.png[]
  39. Then select whether to install as a service or start Elasticsearch manually as needed. When
  40. installing as a service, you can also decide which account to run the service under as well
  41. as whether the service should be started after installation and when Windows is started or
  42. restarted:
  43. [[msi-installer-service]]
  44. image::images/msi_installer/msi_installer_service.png[]
  45. IMPORTANT: When selecting an account to run the service with, be sure that the chosen account
  46. has sufficient privileges to access the installation and other deployment directories chosen.
  47. Common configuration settings are exposed within the Configuration section, allowing the cluster
  48. name, node name and roles to be set, in addition to memory and network settings:
  49. [[msi-installer-configuration]]
  50. image::images/msi_installer/msi_installer_configuration.png[]
  51. A list of common plugins that can be downloaded and installed as
  52. part of the installation, with the option to configure a HTTPS proxy through which to download:
  53. [[msi-installer-selected-plugins]]
  54. image::images/msi_installer/msi_installer_selected_plugins.png[]
  55. Upon choosing to install {xpack} plugin, an additional step allows a choice of the type of {xpack}
  56. license to install, in addition to {security} configuration and built-in user configuration:
  57. [[msi-installer-xpack]]
  58. image::images/msi_installer/msi_installer_xpack.png[]
  59. NOTE: {xpack} includes a choice of a Trial or Basic license for 30 days. After that, you can obtain one of the
  60. https://www.elastic.co/subscriptions[available subscriptions] or {ref}/security-settings.html[disable Security].
  61. The Basic license is free and includes the https://www.elastic.co/products/x-pack/monitoring[Monitoring] extension.
  62. After clicking the install button, the installer will begin installation:
  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 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:
  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 installation. Defaults to `""`
  173. `HTTPSPROXYHOST`::
  174. The proxy host to use to download plugins over HTTPS. Defaults to `""`
  175. `HTTPSPROXYPORT`::
  176. The proxy port to use to download plugins over HTTPS. Defaults to `443`
  177. `HTTPPROXYHOST`::
  178. The proxy host to use to download plugins over HTTP. Defaults to `""`
  179. `HTTPPROXYPORT`::
  180. The proxy port to use to download plugins over HTTP. Defaults to `80`
  181. `XPACKLICENSE`::
  182. When installing {xpack} plugin, the type of license to install,
  183. either `Basic` or `Trial`. Defaults to `Basic`
  184. `XPACKSECURITYENABLED`::
  185. When installing {xpack} plugin with a `Trial` license, whether {security} should be enabled.
  186. Defaults to `true`
  187. `BOOTSTRAPPASSWORD`::
  188. When installing {xpack} plugin with a `Trial` license and {security} enabled, the password to
  189. used to bootstrap the cluster and persisted as the `bootstrap.password` setting in the keystore.
  190. Defaults to a randomized value.
  191. `SKIPSETTINGPASSWORDS`::
  192. When installing {xpack} plugin with a `Trial` license and {security} enabled, whether the
  193. installation should skip setting up the built-in users `elastic`, `kibana` and `logstash_system`.
  194. Defaults to `false`
  195. `ELASTICUSERPASSWORD`::
  196. When installing {xpack} plugin with a `Trial` license and {security} enabled, the password
  197. to use for the built-in user `elastic`. Defaults to `""`
  198. `KIBANAUSERPASSWORD`::
  199. When installing {xpack} plugin with a `Trial` license and {security} enabled, the password
  200. to use for the built-in user `kibana`. Defaults to `""`
  201. `LOGSTASHSYSTEMUSERPASSWORD`::
  202. When installing {xpack} plugin with a `Trial` license and {security} enabled, the password
  203. 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 `<PROPERTYNAME>="<VALUE>"` to
  205. 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[{xpack}]:
  206. ["source","sh",subs="attributes,callouts"]
  207. --------------------------------------------
  208. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn INSTALLDIR="C:\Custom Install Directory" PLUGINS="x-pack"
  209. --------------------------------------------
  210. Consult the https://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx[Windows Installer SDK Command-Line Options]
  211. for additional rules related to values containing quotation marks.
  212. ifdef::include-xpack[]
  213. [[msi-installer-enable-indices]]
  214. ==== Enable automatic creation of {xpack} indices
  215. {xpack} will try to automatically create a number of indices within {es}.
  216. include::{xes-repo-dir}/setup/xpack-indices.asciidoc[]
  217. endif::include-xpack[]
  218. [[msi-installer-command-line-running]]
  219. ==== Running Elasticsearch from the command line
  220. Once installed, Elasticsearch can be started from the command line, if not installed as a service
  221. and configured to start when installation completes, as follows:
  222. ["source","sh",subs="attributes,callouts"]
  223. --------------------------------------------
  224. .\bin\elasticsearch.exe
  225. --------------------------------------------
  226. The command line terminal will display output similar to the following:
  227. [[msi-installer-elasticsearch-exe]]
  228. image::images/msi_installer/elasticsearch_exe.png[]
  229. By default, Elasticsearch runs in the foreground, prints its logs to `STDOUT` in addition
  230. to the `<cluster name>.log` file within `LOGSDIRECTORY`, and can be stopped by pressing `Ctrl-C`.
  231. [[msi-installer-command-line-configuration]]
  232. ==== Configuring Elasticsearch on the command line
  233. Elasticsearch loads its configuration from the `%ES_PATH_CONF%\elasticsearch.yml`
  234. file by default. The format of this config file is explained in
  235. <<settings>>.
  236. Any settings that can be specified in the config file can also be specified on
  237. the command line, using the `-E` syntax as follows:
  238. ["source","sh",subs="attributes,callouts"]
  239. --------------------------------------------
  240. .\bin\elasticsearch.exe -E cluster.name=my_cluster -E node.name=node_1
  241. --------------------------------------------
  242. NOTE: Values that contain spaces must be surrounded with quotes. For instance `-E path.logs="C:\My Logs\logs"`.
  243. TIP: Typically, any cluster-wide settings (like `cluster.name`) should be
  244. added to the `elasticsearch.yml` config file, while any node-specific settings
  245. such as `node.name` could be specified on the command line.
  246. include::check-running.asciidoc[]
  247. [[msi-installer-windows-service]]
  248. ==== Installing Elasticsearch as a Service on Windows
  249. Elasticsearch can be installed as a service to run in the background or start
  250. automatically at boot time without any user interaction. This can be achieved upon installation
  251. using the following command line options
  252. * `INSTALLASSERVICE=true`
  253. * `STARTAFTERINSTALL=true`
  254. * `STARTWHENWINDOWSSTARTS=true`
  255. Once installed, Elasticsearch will appear within the Services control panel:
  256. [[msi-installer-installed-service]]
  257. image::images/msi_installer/msi_installer_installed_service.png[]
  258. and can be stopped and restarted from within the control panel, or from the command line using:
  259. with Command Prompt:
  260. [source,sh]
  261. --------------------------------------------
  262. sc.exe stop Elasticsearch
  263. sc.exe start Elasticsearch
  264. --------------------------------------------
  265. with PowerShell:
  266. [source,powershell]
  267. --------------------------------------------
  268. Get-Service Elasticsearch | Stop-Service | Start-Service
  269. --------------------------------------------
  270. Changes can be made to jvm.options and elasticsearch.yml configuration files to configure the
  271. service after installation. Most changes (like JVM settings) will require a restart of the
  272. service in order to take effect.
  273. [[upgrade-msi-gui]]
  274. ==== Upgrade using the graphical user interface (GUI)
  275. The `.msi` package supports upgrading an installed version of Elasticsearch to a newer
  276. version of Elasticsearch. The upgrade process through the GUI handles upgrading all
  277. installed plugins as well as retaining both your data and configuration.
  278. Downloading and clicking on a newer version of the `.msi` package will launch the GUI wizard.
  279. The first step will list the read only properties from the previous installation:
  280. [[msi-installer-upgrade-notice]]
  281. image::images/msi_installer/msi_installer_upgrade_notice.png[]
  282. The following configuration step allows certain configuration options to be changed:
  283. [[msi-installer-upgrade-configuration]]
  284. image::images/msi_installer/msi_installer_upgrade_configuration.png[]
  285. Finally, the plugins step allows currently installed plugins to be upgraded or removed, and
  286. for plugins not currently installed, to be downloaded and installed:
  287. [[msi-installer-upgrade-plugins]]
  288. image::images/msi_installer/msi_installer_upgrade_plugins.png[]
  289. [[upgrade-msi-command-line]]
  290. ==== Upgrade using the command line
  291. The `.msi` can also upgrade Elasticsearch using the command line.
  292. [IMPORTANT]
  293. ===========================================
  294. A command line upgrade requires passing the **same** command line properties as
  295. used at first install time; the Windows Installer does not remember these properties.
  296. For example, if you originally installed with the command line options `PLUGINS="x-pack"` and
  297. `LOCKMEMORY="true"`, then you must pass these same values when performing an
  298. upgrade from the command line.
  299. The **exception** to this is `INSTALLDIR` (if originally specified), which must be a different directory to the
  300. current installation.
  301. If setting `INSTALLDIR`, the final directory in the path **must** be the version of Elasticsearch e.g.
  302. ++C:\Program Files\Elastic\Elasticsearch{backslash}{version}++
  303. ===========================================
  304. The simplest upgrade, assuming Elasticsearch was installed using all defaults,
  305. is achieved by first navigating to the download directory, then running:
  306. ["source","sh",subs="attributes,callouts"]
  307. --------------------------------------------
  308. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn
  309. --------------------------------------------
  310. Similar to the install process, a path to a log file for the upgrade process can
  311. be passed using the `/l` command line argument
  312. ["source","sh",subs="attributes,callouts"]
  313. --------------------------------------------
  314. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn /l upgrade.log
  315. --------------------------------------------
  316. [[uninstall-msi-gui]]
  317. ==== Uninstall using Add/Remove Programs
  318. The `.msi` package handles uninstallation of all directories and files added as part of installation.
  319. WARNING: Uninstallation will remove **all** directories and their contents created as part of
  320. installation, **including data within the data directory**. If you wish to retain your data upon
  321. uninstallation, it is recommended that you make a copy of the data directory before uninstallation.
  322. MSI installer packages do not provide a GUI for uninstallation. An installed program can be uninstalled
  323. by pressing the Windows key and typing `add or remove programs` to open the system settings.
  324. Once opened, find the Elasticsearch installation within the list of installed applications, click
  325. and choose `Uninstall`:
  326. [[msi-installer-uninstall]]
  327. image::images/msi_installer/msi_installer_uninstall.png[]
  328. This will launch the uninstallation process.
  329. [[uninstall-msi-command-line]]
  330. ==== Uninstall using the command line
  331. Uninstallation can also be performed from the command line by navigating to the directory
  332. containing the `.msi` package and running:
  333. ["source","sh",subs="attributes,callouts"]
  334. --------------------------------------------
  335. start /wait msiexec.exe /x elasticsearch-{version}.msi /qn
  336. --------------------------------------------
  337. Similar to the install process, a path to a log file for the uninstallation process can
  338. be passed using the `/l` command line argument
  339. ["source","sh",subs="attributes,callouts"]
  340. --------------------------------------------
  341. start /wait msiexec.exe /x elasticsearch-{version}.msi /qn /l uninstall.log
  342. --------------------------------------------
  343. include::next-steps.asciidoc[]