summaryrefslogtreecommitdiff
path: root/docs/reference/setup/install/zip-windows.asciidoc
blob: e19fe27d5f5ffefbadb0e92e941b57f41cb9083b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
[[zip-windows]]
=== Install Elasticsearch with `.zip` on Windows

Elasticsearch can be installed on Windows using the `.zip` package.  This
comes with a `elasticsearch-service.bat` command which will setup Elasticsearch to run as a
service.

TIP: Elasticsearch has historically been installed on Windows using the `.zip` archive.
An <<windows, MSI installer package>> is available that provides the easiest getting started
experience for Windows. You can continue using the `.zip` approach if you prefer.

The latest stable version of Elasticsearch can be found on the
link:/downloads/elasticsearch[Download Elasticsearch] page.
Other versions can be found on the
link:/downloads/past-releases[Past Releases page].

NOTE: Elasticsearch requires Java 8 or later. Use the
http://www.oracle.com/technetwork/java/javase/downloads/index.html[official Oracle distribution]
or an open-source distribution such as http://openjdk.java.net[OpenJDK].

[[install-windows]]
==== Download and install the `.zip` package

ifeval::["{release-state}"=="unreleased"]

Version {version} of Elasticsearch has not yet been released.

endif::[]

ifeval::["{release-state}"!="unreleased"]

Download the `.zip` archive for Elasticsearch v{version} from: https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{version}.zip

Unzip it with your favourite unzip tool.  This will create a folder called
+elasticsearch-{version}+, which we will refer to as `%ES_HOME%`. In a terminal
window, `cd` to the `%ES_HOME%` directory, for instance:

["source","sh",subs="attributes"]
----------------------------
cd c:\elasticsearch-{version}
----------------------------

endif::[]

[[windows-running]]
==== Running Elasticsearch from the command line

Elasticsearch can be started from the command line as follows:

[source,sh]
--------------------------------------------
.\bin\elasticsearch.bat
--------------------------------------------

By default, Elasticsearch runs in the foreground, prints its logs to `STDOUT`,
and can be stopped by pressing `Ctrl-C`.

[[windows-configuring]]
==== Configuring Elasticsearch on the command line

Elasticsearch loads its configuration from the `%ES_HOME%\config\elasticsearch.yml`
file by default.  The format of this config file is explained in
<<settings>>.

Any settings that can be specified in the config file can also be specified on
the command line, using the `-E` syntax as follows:

[source,sh]
--------------------------------------------
.\bin\elasticsearch.bat -Ecluster.name=my_cluster -Enode.name=node_1
--------------------------------------------

NOTE: Values that contain spaces must be surrounded with quotes.  For instance `-Epath.logs="C:\My Logs\logs"`.

TIP: Typically, any cluster-wide settings (like `cluster.name`) should be
added to the `elasticsearch.yml` config file, while any node-specific settings
such as `node.name` could be specified on the command line.

include::check-running.asciidoc[]

[[windows-service]]
==== Installing Elasticsearch as a Service on Windows

Elasticsearch can be installed as a service to run in the background or start
automatically at boot time without any user interaction. This can be achieved
through the `elasticsearch-service.bat` script in the `bin\` folder which allows one to
install, remove, manage or configure the service and potentially start and
stop the service, all from the command-line.

["source","sh",subs="attributes,callouts"]
--------------------------------------------------
c:\elasticsearch-{version}{backslash}bin>elasticsearch-service.bat

Usage: elasticsearch-service.bat install|remove|start|stop|manager [SERVICE_ID]
--------------------------------------------------

The script requires one parameter (the command to execute) followed by an
optional one indicating the service id (useful when installing multiple
Elasticsearch services).

The commands available are:

[horizontal]
`install`:: Install Elasticsearch as a service

`remove`:: Remove the installed Elasticsearch service (and stop the service if started)

`start`:: Start the Elasticsearch service (if installed)

`stop`:: Stop the Elasticsearch service (if started)

`manager`:: Start a GUI for managing the installed service

The name of the service and the value of `JAVA_HOME` will be made available during install:

["source","sh",subs="attributes"]
--------------------------------------------------
c:\elasticsearch-{version}{backslash}bin>elasticsearch-service.bat install
Installing service      :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  "c:\jvm\jdk1.8"
The service 'elasticsearch-service-x64' has been installed.
--------------------------------------------------

NOTE: While a JRE can be used for the Elasticsearch service, due to its use of a client VM (as opposed to a server JVM which offers better performance for long-running applications) its usage is discouraged and a warning will be issued.

NOTE: The system environment variable `JAVA_HOME` should be set to the path to
the JDK installation that you want the service to use. If you upgrade the JDK,
you are not required to the reinstall the service but you must set the value of
the system environment variable `JAVA_HOME` to the path to the new JDK
installation. However, upgrading across JVM types (e.g. JRE versus SE) is not
supported, and does require the service to be reinstalled.

[[windows-service-settings]]
[float]
=== Customizing service settings

The Elasticsearch service can be configured prior to installation by setting the following environment variables (either using the https://technet.microsoft.com/en-us/library/cc754250(v=ws.10).aspx[set command] from the command line, or through the `System Properties->Environment Variables` GUI).

[horizontal]
`SERVICE_ID`::

  A unique identifier for the service. Useful if installing multiple instances
  on the same machine. Defaults to `elasticsearch-service-x64`.

`SERVICE_USERNAME`::

  The user to run as, defaults to the local system account.

`SERVICE_PASSWORD`::

  The password for the user specified in `%SERVICE_USERNAME%`.

`SERVICE_DISPLAY_NAME`::

  The name of the service.  Defaults to `Elasticsearch <version> %SERVICE_ID%`.

`SERVICE_DESCRIPTION`::

  The description of the service.  Defaults to `Elasticsearch <version> Windows Service - https://elastic.co`.

`JAVA_HOME`::

  The installation directory of the desired JVM to run the service under.

`SERVICE_LOG_DIR`::

    Service log directory, defaults to `%ES_HOME%\logs`. Note that this does
    not control the path for the Elasticsearch logs; the path for these is set
    via the setting `path.logs` in the `elasticsearch.yml` configuration file,
    or on the command line.

`CONF_DIR`::

    Configuration file directory (which needs to include `elasticsearch.yml`
    and `log4j2.properties` files), defaults to `%ES_HOME%\conf`.

`ES_JAVA_OPTS`::

    Any additional JVM system properties you may want to apply.

`ES_START_TYPE`::

    Startup mode for the service.  Can be either `auto` or `manual` (default).

`ES_STOP_TIMEOUT` ::

  The timeout in seconds that procrun waits for service to exit gracefully.  Defaults to `0`.

NOTE: At its core, `elasticsearch-service.bat` relies on http://commons.apache.org/proper/commons-daemon/[Apache Commons Daemon] project
to install the service. Environment variables set prior to the service installation are copied and will be used during the service lifecycle. This means any changes made to them after the installation will not be picked up unless the service is reinstalled.

NOTE: On Windows, the <<heap-size,heap size>> can be configured as for
any other Elasticsearch installation when running Elasticsearch from the
command line, or when installing Elasticsearch as a service for the
first time. To adjust the heap size for an already installed service,
use the service manager: `bin\elasticsearch-service.bat manager`.

Using the Manager GUI::

It is also possible to configure the service after it's been installed using the manager GUI (`elasticsearch-service-mgr.exe`), which offers insight into the installed service, including its status, startup type, JVM, start and stop settings amongst other things.  Simply invoking `elasticsearch-service.bat manager` from the command-line will open up the manager window:

image::images/service-manager-win.png["Windows Service Manager GUI",align="center"]

Most changes (like JVM settings) made through the manager GUI will require a restart of the service in order to take affect.

[[windows-layout]]
==== Directory layout of `.zip` archive

The `.zip` package is entirely self-contained. All files and directories are,
by default, contained within `%ES_HOME%` -- the directory created when
unpacking the archive.

This is very convenient because you don't have to create any directories to
start using Elasticsearch, and uninstalling Elasticsearch is as easy as
removing the `%ES_HOME%` directory.  However, it is advisable to change the
default locations of the config directory, the data directory, and the logs
directory so that you do not delete important data later on.


[cols="<h,<,<m,<m",options="header",]
|=======================================================================
| Type | Description | Default Location | Setting
| home
  | Elasticsearch home directory or `%ES_HOME%`
 d| Directory created by unpacking the archive
  |

| bin
  | Binary scripts including `elasticsearch` to start a node
    and `elasticsearch-plugin` to install plugins
  | %ES_HOME%\bin
 d|

| conf
  | Configuration files including `elasticsearch.yml`
  | %ES_HOME%\config
  | path.conf

| data
  | The location of the data files of each index / shard allocated
    on the node. Can hold multiple locations.
  | %ES_HOME%\data
  | path.data

| logs
  | Log files location.
  | %ES_HOME%\logs
  | path.logs

| plugins
  | Plugin files location. Each plugin will be contained in a subdirectory.
  | %ES_HOME%\plugins
  |

| repo
  | Shared file system repository locations. Can hold multiple locations. A file system repository can be placed in to any subdirectory of any directory specified here.
 d| Not configured
  | path.repo

| script
  | Location of script files.
  | %ES_HOME%\scripts
  | path.scripts

|=======================================================================

include::next-steps.asciidoc[]