Elasticsearch 至少需要Java 8。在撰写本文时,建议你使用Oracle JDK版本1.8.0_131。Java安装因平台而异,所以在这里不再赘述。Oracle的推荐安装文档可以在Oracle的网站上找到。在安装 Elasticsearch 之前,请先检查您的Java版本,然后再运行(如果需要,请相应地进行安装/升级):
java -version echo $JAVA_HOME
安装了Java之后,下载并运行 Elasticsearch 。这些二进制文件可以在下载,与过去所有的所有版本一起提供。对于每个版本,您可以选择一个zip、tar、DEB或RPM包。
为了简单起见,下载Elasticsearch 5.4.1 tar,方式如下(window用户下载Elasticsearch 5.4.1 zip)
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.tar.gz
然后解压缩如下
tar -xvf elasticsearch-5.4.1.tar.gz
然后进入bin目录
cd elasticsearch-5.4.1 / bin
现在准备启动我们的节点和单个集群(Windows用户应该运行 Elasticsearch.bat文件)
./elasticsearch
如果一切顺利,您应该会看到一堆如下所示的消息:
[2017-06-09T12:11:37,851][INFO ][o.e.n.Node ] [] initializing ... [2017-06-09T12:11:38,117][INFO ][o.e.e.NodeEnvironment ] [9fzvF2H] using [1]data paths, mounts [[(D:)]], net usable_space [111.8gb], net total_space [123.5gb], spins? [unknown], types [NTFS] [2017-06-09T12:11:38,117][INFO ][o.e.e.NodeEnvironment ] [9fzvF2H] heap size[1.9gb], compressed ordinary object pointers [true] [2017-06-09T12:11:38,117][INFO ][o.e.n.Node ] node name [9fzvF2H]derived from node ID [9fzvF2HKTverLyZwFl6w0w]; set [node.name] to override [2017-06-09T12:11:38,117][INFO ][o.e.n.Node ] version[5.4.1], pid[3964], build[2cfe0df/2017-05-29T16:05:51.443Z], OS[Windows 7/6.1/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_131/25.131-b11] [2017-06-09T12:11:38,117][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionSUSECanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Delasticsearch, -Des.path.home=D:\ProgramFiles\elasticsearch-5.4.1] [2017-06-09T12:11:39,193][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [aggs-matrix-stats] [2017-06-09T12:11:39,193][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [ingest-common] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-expression] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-groovy] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-mustache] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-painless] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [percolator] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [reindex] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [transport-netty3] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [transport-netty4] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] no plugins loaded [2017-06-09T12:11:41,471][INFO ][o.e.d.DiscoveryModule ] [9fzvF2H] using discovery type [zen] [2017-06-09T12:11:42,032][INFO ][o.e.n.Node ] initialized [2017-06-09T12:11:42,032][INFO ][o.e.n.Node ] [9fzvF2H] starting ... [2017-06-09T12:11:43,171][INFO ][o.e.t.TransportService ] [9fzvF2H] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300} [2017-06-09T12:11:46,248][INFO ][o.e.c.s.ClusterService ] [9fzvF2H] new_master{9fzvF2H}{9fzvF2HKTverLyZwFl6w0w}{yMmmD0nORKqEmQ0lrqKu3Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) [2017-06-09T12:11:46,280][INFO ][o.e.g.GatewayService ] [9fzvF2H] recovered[0] indices into cluster_state [2017-06-09T12:11:46,919][INFO ][o.e.h.n.Netty4HttpServerTransport] [9fzvF2H] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200} [2017-06-09T12:11:46,919][INFO ][o.e.n.Node ] [9fzvF2H] started