Elasticsearch requires at least Java 8. Specifically as of this writing, it is recommended that you use the Oracle JDK version 1.8.0_131. Java installation varies from platform to platform so we won’t go into those details here. Oracle’s recommended installation documentation can be found on Oracle’s website. Suffice to say, before you install Elasticsearch, please check your Java version first by running (and then install/upgrade accordingly if needed):
java -version
echo $JAVA_HOME
Once we have Java set up, we can then download and run Elasticsearch. The binaries are available from www.elastic.co/downloads
along with all the releases that have been made in the past. For each release, you have a choice among a zip
or tar
archive, a DEB
or RPM
package, or a Windows MSI
installation package.
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz
tar -xvf elasticsearch-6.2..tar.gz
cd elasticsearch-6.2./bin
./elasticsearch
Installation with Homebrew
使用Homebrewedit进行安装
On macOS, Elasticsearch can also be installed via Homebrew:
brew install elasticsearch
If installation succeeds, Homebrew will finish by saying that you can start Elasticsearch by entering elasticsearch
. Do that now. The expected response is described below, under Successfully running node
如果安装成功,Homebrew将说完你可以通过输入elasticsearch来启动Elasticsearch。现在就这样做。在成功运行nodeedit下,下面描述了预期的响应
Installation example with MSI Windows Installer
For Windows users, we recommend using the MSI Installer package. The package contains a graphical user interface (GUI) that guides you through the installation process.
By default, Elasticsearch will be installed at %PROGRAMFILES%\Elastic\Elasticsearch
. Navigate here and go into the bin directory as follows:
默认情况下,Elasticsearch将安装在%PROGRAMFILES%\ Elastic \ Elasticsearch中。在此处导航并进入bin目录,如下所示:
with Command Prompt:
cd %PROGRAMFILES%\Elastic\Elasticsearch\bin
cd $env:PROGRAMFILES\Elastic\Elasticsearch\bin
And now we are ready to start our node and single cluster:
.\elasticsearch.exe
Successfully running node
If everything goes well with installation, you should see a bunch of messages that look like below:
[--16T14::,][INFO ][o.e.n.Node ] [] initializing ...
[--16T14::,][INFO ][o.e.e.NodeEnvironment ] [-bjhwl] using [] data paths, mounts [[/ (/dev/sda1)]], net usable_space [.7gb], net total_space [.6gb], spins? [no], types [ext4]
[--16T14::,][INFO ][o.e.e.NodeEnvironment ] [-bjhwl] heap size [.9gb], compressed ordinary object pointers [true]
[--16T14::,][INFO ][o.e.n.Node ] [-bjhwl] node name [-bjhwl] derived from node ID; set [node.name] to override
[--16T14::,][INFO ][o.e.n.Node ] [-bjhwl] version[6.2.], pid[], build[f5daa16/--16T09::.346Z], OS[Linux/4.4.--generic/amd64], JVM[Oracle Corporation/Java HotSpot(TM) -Bit Server VM/1.8.0_60/25.60-b23]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [aggs-matrix-stats]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [ingest-common]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [lang-expression]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [lang-mustache]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [lang-painless]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [percolator]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [reindex]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [transport-netty3]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded module [transport-netty4]
[--16T14::,][INFO ][o.e.p.PluginsService ] [-bjhwl] loaded plugin [mapper-murmur3]
[--16T14::,][INFO ][o.e.n.Node ] [-bjhwl] initialized
[--16T14::,][INFO ][o.e.n.Node ] [-bjhwl] starting ...
[--16T14::,][INFO ][o.e.t.TransportService ] [-bjhwl] publish_address {192.168.8.112:}, bound_addresses {{192.168.8.112:}
[--16T14::,][WARN ][o.e.b.BootstrapCheck ] [-bjhwl] max virtual memory areas vm.max_map_count [] likely too low, increase to at least []
[--16T14::,][INFO ][o.e.h.HttpServer ] [-bjhwl] publish_address {192.168.8.112:}, bound_addresses {[::]:}, {192.168.8.112:}
[--16T14::,][INFO ][o.e.g.GatewayService ] [-bjhwl] recovered [] indices into cluster_state
[--16T14::,][INFO ][o.e.n.Node ] [-bjhwl] started
Without going too much into detail, we can see that our node named "6-bjhwl" (which will be a different set of characters in your case) has started and elected itself as a master in a single cluster. Don’t worry yet at the moment what master means. The main thing that is important here is that we have started one node within one cluster.
./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name
192.168.8.112
) and port (9200
) that our node is reachable from. By default, Elasticsearch uses port 9200
to provide access to its REST API. This port is configurable if necessary.