windows.asciidoc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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. A list of common plugins that can be downloaded and installed as
  48. part of the installation, with the option to configure a HTTPS proxy through which to download:
  49. [[msi-installer-selected-plugins]]
  50. image::images/msi_installer/msi_installer_selected_plugins.png[]
  51. Upon choosing to install X-Pack plugin, an additional step allows a choice of the type of X-Pack
  52. license to install, in addition to X-Pack Security configuration and built-in user configuration:
  53. [[msi-installer-xpack]]
  54. image::images/msi_installer/msi_installer_xpack.png[]
  55. NOTE: X-Pack includes a choice of a Trial or Basic license for 30 days. After that, you can obtain one of the
  56. https://www.elastic.co/subscriptions[available subscriptions] or {ref}/security-settings.html[disable Security].
  57. The Basic license is free and includes the https://www.elastic.co/products/x-pack/monitoring[Monitoring] extension.
  58. After clicking the install button, the installer will begin installation:
  59. [[msi-installer-installing]]
  60. image::images/msi_installer/msi_installer_installing.png[]
  61. and will indicate when it has been successfully installed:
  62. [[msi-installer-success]]
  63. image::images/msi_installer/msi_installer_success.png[]
  64. [[install-msi-command-line]]
  65. ==== Install using the command line
  66. The `.msi` can also install Elasticsearch using the command line. The simplest installation
  67. using the same defaults as the GUI is achieved by first navigating to the download directory,
  68. then running:
  69. ["source","sh",subs="attributes,callouts"]
  70. --------------------------------------------
  71. msiexec.exe /i elasticsearch-{version}.msi /qn
  72. --------------------------------------------
  73. By default, msiexec does not wait for the installation process to complete, since it runs in the
  74. Windows subsystem. To wait on the process to finish and ensure that `%ERRORLEVEL%` is set
  75. accordingly, it is recommended to use `start /wait` to create a process and wait for it to exit
  76. ["source","sh",subs="attributes,callouts"]
  77. --------------------------------------------
  78. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn
  79. --------------------------------------------
  80. As with any MSI installation package, a log file for the installation process can be found
  81. within the `%TEMP%` directory, with a randomly generated name adhering to the format
  82. `MSI<random>.LOG`. The path to a log file can be supplied using the `/l` command line argument
  83. ["source","sh",subs="attributes,callouts"]
  84. --------------------------------------------
  85. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn /l install.log
  86. --------------------------------------------
  87. Supported Windows Installer command line arguments can be viewed using
  88. ["source","sh",subs="attributes,callouts"]
  89. --------------------------------------------
  90. msiexec.exe /help
  91. --------------------------------------------
  92. or by consulting the https://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx[Windows Installer SDK Command-Line Options].
  93. [[msi-command-line-options]]
  94. ==== Command line options
  95. All settings exposed within the GUI are also available as command line arguments (referred to
  96. as _properties_ within Windows Installer documentation) that can be passed to msiexec:
  97. [horizontal]
  98. `INSTALLDIR`::
  99. The installation directory. The final directory in the path **must**
  100. be the version of Elasticsearch.
  101. Defaults to ++%ProgramW6432%\Elastic\Elasticsearch{backslash}{version}++.
  102. `DATADIRECTORY`::
  103. The directory in which to store your data.
  104. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\data`
  105. `CONFIGDIRECTORY`::
  106. The directory in which to store your configuration.
  107. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\config`
  108. `LOGSDIRECTORY`::
  109. The directory in which to store your logs.
  110. Defaults to `%ALLUSERSPROFILE%\Elastic\Elasticsearch\logs`
  111. `PLACEWRITABLELOCATIONSINSAMEPATH`::
  112. Whether the data, configuration and logs directories
  113. should be created under the installation directory. Defaults to `false`
  114. `INSTALLASSERVICE`::
  115. Whether Elasticsearch is installed and configured as a Windows Service.
  116. Defaults to `true`
  117. `STARTAFTERINSTALL`::
  118. Whether the Windows Service is started after installation finishes.
  119. Defaults to `true`
  120. `STARTWHENWINDOWSSTARTS`::
  121. Whether the Windows Service is started when Windows is started.
  122. Defaults to `true`
  123. `USELOCALSYSTEM`::
  124. Whether the Windows service runs under the LocalSystem Account.
  125. Defaults to `true`
  126. `USENETWORKSERVICE`::
  127. Whether the Windows service runs under the NetworkService Account. Defaults
  128. to `false`
  129. `USEEXISTINGUSER`::
  130. Whether the Windows service runs under a specified existing account. Defaults
  131. to `false`
  132. `USER`::
  133. The username for the account under which the Windows service runs. Defaults to `""`
  134. `PASSWORD`::
  135. The password for the account under which the Windows service runs. Defaults to `""`
  136. `CLUSTERNAME`::
  137. The name of the cluster. Defaults to `elasticsearch`
  138. `NODENAME`::
  139. The name of the node. Defaults to `%COMPUTERNAME%`
  140. `MASTERNODE`::
  141. Whether Elasticsearch is configured as a master node. Defaults to `true`
  142. `DATANODE`::
  143. Whether Elasticsearch is configured as a data node. Defaults to `true`
  144. `INGESTNODE`::
  145. Whether Elasticsearch is configured as an ingest node. Defaults to `true`
  146. `SELECTEDMEMORY`::
  147. The amount of memory to allocate to the JVM heap for Elasticsearch.
  148. Defaults to `2048` unless the target machine has less than 4GB in total, in which case
  149. it defaults to 50% of total memory.
  150. `LOCKMEMORY`::
  151. Whether `bootstrap.memory_lock` should be used to try to lock the process
  152. address space into RAM. Defaults to `false`
  153. `UNICASTNODES`::
  154. A comma separated list of hosts in the form `host:port` or `host` to be used for
  155. unicast discovery. Defaults to `""`
  156. `MINIMUMMASTERNODES`::
  157. The minimum number of master-eligible nodes that must be visible
  158. in order to form a cluster. Defaults to `""`
  159. `NETWORKHOST`::
  160. The hostname or IP address to bind the node to and _publish_ (advertise) this
  161. host to other nodes in the cluster. Defaults to `""`
  162. `HTTPPORT`::
  163. The port to use for exposing Elasticsearch APIs over HTTP. Defaults to `9200`
  164. `TRANSPORTPORT`::
  165. The port to use for internal communication between nodes within the cluster.
  166. Defaults to `9300`
  167. `PLUGINS`::
  168. A comma separated list of the plugins to download and install as part of the installation. Defaults to `""`
  169. `HTTPSPROXYHOST`::
  170. The proxy host to use to download plugins over HTTPS. Defaults to `""`
  171. `HTTPSPROXYPORT`::
  172. The proxy port to use to download plugins over HTTPS. Defaults to `443`
  173. `HTTPPROXYHOST`::
  174. The proxy host to use to download plugins over HTTP. Defaults to `""`
  175. `HTTPPROXYPORT`::
  176. The proxy port to use to download plugins over HTTP. Defaults to `80`
  177. `XPACKLICENSE`::
  178. When installing X-Pack plugin, the type of license to install,
  179. either `Basic` or `Trial`. Defaults to `Basic`
  180. `XPACKSECURITYENABLED`::
  181. When installing X-Pack plugin with a `Trial` license, whether X-Pack Security should be enabled.
  182. Defaults to `true`
  183. `BOOTSTRAPPASSWORD`::
  184. When installing X-Pack plugin with a `Trial` license and X-Pack Security enabled, the password to
  185. used to bootstrap the cluster and persisted as the `bootstrap.password` setting in the keystore.
  186. Defaults to a randomized value.
  187. `SKIPSETTINGPASSWORDS`::
  188. When installing X-Pack plugin with a `Trial` license and X-Pack Security enabled, whether the
  189. installation should skip setting up the built-in users `elastic`, `kibana` and `logstash_system`.
  190. Defaults to `false`
  191. `ELASTICUSERPASSWORD`::
  192. When installing X-Pack plugin with a `Trial` license and X-Pack Security enabled, the password
  193. to use for the built-in user `elastic`. Defaults to `""`
  194. `KIBANAUSERPASSWORD`::
  195. When installing X-Pack plugin with a `Trial` license and X-Pack Security enabled, the password
  196. to use for the built-in user `kibana`. Defaults to `""`
  197. `LOGSTASHSYSTEMUSERPASSWORD`::
  198. When installing X-Pack plugin with a `Trial` license and X-Pack Security enabled, the password
  199. to use for the built-in user `logstash_system`. Defaults to `""`
  200. To pass a value, simply append the property name and value using the format `<PROPERTYNAME>="<VALUE>"` to
  201. 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]:
  202. ["source","sh",subs="attributes,callouts"]
  203. --------------------------------------------
  204. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn INSTALLDIR="C:\Custom Install Directory" PLUGINS="x-pack"
  205. --------------------------------------------
  206. Consult the https://msdn.microsoft.com/en-us/library/windows/desktop/aa367988(v=vs.85).aspx[Windows Installer SDK Command-Line Options]
  207. for additional rules related to values containing quotation marks.
  208. [[msi-installer-command-line-running]]
  209. ==== Running Elasticsearch from the command line
  210. Once installed, Elasticsearch can be started from the command line, if not installed as a service
  211. and configured to start when installation completes, as follows:
  212. ["source","sh",subs="attributes,callouts"]
  213. --------------------------------------------
  214. .\bin\elasticsearch.exe
  215. --------------------------------------------
  216. The command line terminal will display output similar to the following:
  217. [[msi-installer-elasticsearch-exe]]
  218. image::images/msi_installer/elasticsearch_exe.png[]
  219. By default, Elasticsearch runs in the foreground, prints its logs to `STDOUT` in addition
  220. to the `<cluster name>.log` file within `LOGSDIRECTORY`, and can be stopped by pressing `Ctrl-C`.
  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 | Start-Service
  259. --------------------------------------------
  260. Changes can be made to jvm.options and elasticsearch.yml configuration files to configure the
  261. service after installation. Most changes (like JVM settings) will require a restart of the
  262. service in order to take effect.
  263. [[upgrade-msi-gui]]
  264. ==== Upgrade using the graphical user interface (GUI)
  265. The `.msi` package supports upgrading an installed version of Elasticsearch to a newer
  266. version of Elasticsearch. The upgrade process through the GUI handles upgrading all
  267. installed plugins as well as retaining both your data and configuration.
  268. Downloading and clicking on a newer version of the `.msi` package will launch the GUI wizard.
  269. The first step will list the read only properties from the previous installation:
  270. [[msi-installer-upgrade-notice]]
  271. image::images/msi_installer/msi_installer_upgrade_notice.png[]
  272. The following configuration step allows certain configuration options to be changed:
  273. [[msi-installer-upgrade-configuration]]
  274. image::images/msi_installer/msi_installer_upgrade_configuration.png[]
  275. Finally, the plugins step allows currently installed plugins to be upgraded or removed, and
  276. for plugins not currently installed, to be downloaded and installed:
  277. [[msi-installer-upgrade-plugins]]
  278. image::images/msi_installer/msi_installer_upgrade_plugins.png[]
  279. [[upgrade-msi-command-line]]
  280. ==== Upgrade using the command line
  281. The `.msi` can also upgrade Elasticsearch using the command line.
  282. [IMPORTANT]
  283. ===========================================
  284. A command line upgrade requires passing the **same** command line properties as
  285. used at first install time; the Windows Installer does not remember these properties.
  286. For example, if you originally installed with the command line options `PLUGINS="x-pack"` and
  287. `LOCKMEMORY="true"`, then you must pass these same values when performing an
  288. upgrade from the command line.
  289. The **exception** to this is `INSTALLDIR` (if originally specified), which must be a different directory to the
  290. current installation.
  291. If setting `INSTALLDIR`, the final directory in the path **must** be the version of Elasticsearch e.g.
  292. ++C:\Program Files\Elastic\Elasticsearch{backslash}{version}++
  293. ===========================================
  294. The simplest upgrade, assuming Elasticsearch was installed using all defaults,
  295. is achieved by first navigating to the download directory, then running:
  296. ["source","sh",subs="attributes,callouts"]
  297. --------------------------------------------
  298. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn
  299. --------------------------------------------
  300. Similar to the install process, a path to a log file for the upgrade process can
  301. be passed using the `/l` command line argument
  302. ["source","sh",subs="attributes,callouts"]
  303. --------------------------------------------
  304. start /wait msiexec.exe /i elasticsearch-{version}.msi /qn /l upgrade.log
  305. --------------------------------------------
  306. [[uninstall-msi-gui]]
  307. ==== Uninstall using Add/Remove Programs
  308. The `.msi` package handles uninstallation of all directories and files added as part of installation.
  309. WARNING: Uninstallation will remove **all** directories and their contents created as part of
  310. installation, **including data within the data directory**. If you wish to retain your data upon
  311. uninstallation, it is recommended that you make a copy of the data directory before uninstallation.
  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[]