参考文档:Elasticsearch: 权威指南
- 下载Elasticsearch 安装包:
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz
image.png
- 解压
tar -xvf elasticsearch-6.4.2.tar.gz
image.png
3.进入bin目录:
cd elasticsearch-6.4.2/bin/
4.执行启动脚本,目前在本机是只有一个节点的单集群:
./elasticsearch
启动结果:
linyk3@linyk3-aliyun:~/elasticsearch-6.4.2/bin$ ./elasticsearch
[2018-11-06T11:44:21,500][INFO ][o.e.n.Node ] [] initializing ...
[2018-11-06T11:44:21,658][INFO ][o.e.e.NodeEnvironment ] [pJU2v8-] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [33gb], net total_space [39.2gb], types [ext4]
[2018-11-06T11:44:21,661][INFO ][o.e.e.NodeEnvironment ] [pJU2v8-] heap size [1015.6mb], compressed ordinary object pointers [true]
[2018-11-06T11:44:21,663][INFO ][o.e.n.Node ] [pJU2v8-] node name derived from node ID [pJU2v8-WTK-G8Q9M6TRgTA]; set [node.name] to override
[2018-11-06T11:44:21,665][INFO ][o.e.n.Node ] [pJU2v8-] version[6.4.2], pid[2816], build[default/tar/04711c2/2018-09-26T13:34:09.098244Z], OS[Linux/4.4.0-105-generic/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_161/25.161-b12]
[2018-11-06T11:44:21,665][INFO ][o.e.n.Node ] [pJU2v8-] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.1aHUkGvm, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/home/linyk3/elasticsearch-6.4.2, -Des.path.conf=/home/linyk3/elasticsearch-6.4.2/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2018-11-06T11:44:25,705][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [aggs-matrix-stats]
[2018-11-06T11:44:25,705][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [analysis-common]
[2018-11-06T11:44:25,707][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [ingest-common]
[2018-11-06T11:44:25,707][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [lang-expression]
[2018-11-06T11:44:25,707][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [lang-mustache]
[2018-11-06T11:44:25,707][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [lang-painless]
[2018-11-06T11:44:25,708][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [mapper-extras]
[2018-11-06T11:44:25,708][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [parent-join]
[2018-11-06T11:44:25,708][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [percolator]
[2018-11-06T11:44:25,708][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [rank-eval]
[2018-11-06T11:44:25,708][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [reindex]
[2018-11-06T11:44:25,708][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [repository-url]
[2018-11-06T11:44:25,708][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [transport-netty4]
[2018-11-06T11:44:25,709][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [tribe]
[2018-11-06T11:44:25,709][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-core]
[2018-11-06T11:44:25,953][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-deprecation]
[2018-11-06T11:44:25,954][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-graph]
[2018-11-06T11:44:25,954][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-logstash]
[2018-11-06T11:44:25,955][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-ml]
[2018-11-06T11:44:25,955][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-monitoring]
[2018-11-06T11:44:25,955][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-rollup]
[2018-11-06T11:44:25,955][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-security]
[2018-11-06T11:44:25,956][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-sql]
[2018-11-06T11:44:25,956][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-upgrade]
[2018-11-06T11:44:25,956][INFO ][o.e.p.PluginsService ] [pJU2v8-] loaded module [x-pack-watcher]
[2018-11-06T11:44:25,957][INFO ][o.e.p.PluginsService ] [pJU2v8-] no plugins loaded
[2018-11-06T11:44:35,331][INFO ][o.e.x.s.a.s.FileRolesStore] [pJU2v8-] parsed [0] roles from file [/home/linyk3/elasticsearch-6.4.2/config/roles.yml]
[2018-11-06T11:44:36,783][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/2865] [Main.cc@109] controller (64 bit): Version 6.4.2 (Build 660eefe6f2ea55) Copyright (c) 2018 Elasticsearch BV
[2018-11-06T11:44:37,664][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2018-11-06T11:44:38,227][INFO ][o.e.d.DiscoveryModule ] [pJU2v8-] using discovery type [zen]
[2018-11-06T11:44:40,183][INFO ][o.e.n.Node ] [pJU2v8-] initialized
[2018-11-06T11:44:40,184][INFO ][o.e.n.Node ] [pJU2v8-] starting ...
[2018-11-06T11:44:40,600][INFO ][o.e.t.TransportService ] [pJU2v8-] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2018-11-06T11:44:40,659][WARN ][o.e.b.BootstrapChecks ] [pJU2v8-] max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2018-11-06T11:44:40,662][WARN ][o.e.b.BootstrapChecks ] [pJU2v8-] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2018-11-06T11:44:43,779][INFO ][o.e.c.s.MasterService ] [pJU2v8-] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: new_master {pJU2v8-}{pJU2v8-WTK-G8Q9M6TRgTA}{P3K4ss1ITpec8B-teIwR4Q}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=2097369088, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2018-11-06T11:44:43,789][INFO ][o.e.c.s.ClusterApplierService] [pJU2v8-] new_master {pJU2v8-}{pJU2v8-WTK-G8Q9M6TRgTA}{P3K4ss1ITpec8B-teIwR4Q}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=2097369088, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {pJU2v8-}{pJU2v8-WTK-G8Q9M6TRgTA}{P3K4ss1ITpec8B-teIwR4Q}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=2097369088, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]])
[2018-11-06T11:44:43,883][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [pJU2v8-] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2018-11-06T11:44:43,883][INFO ][o.e.n.Node ] [pJU2v8-] started
[2018-11-06T11:44:43,956][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [pJU2v8-] Failed to clear cache for realms [[]]
[2018-11-06T11:44:44,147][INFO ][o.e.g.GatewayService ] [pJU2v8-] recovered [0] indices into cluster_state
[2018-11-06T11:44:44,662][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.watches] for index patterns [.watches*]
[2018-11-06T11:44:44,736][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2018-11-06T11:44:44,858][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2018-11-06T11:44:44,931][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
[2018-11-06T11:44:45,031][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
[2018-11-06T11:44:45,095][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
[2018-11-06T11:44:45,142][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
[2018-11-06T11:44:45,195][INFO ][o.e.c.m.MetaDataIndexTemplateService] [pJU2v8-] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
[2018-11-06T11:44:45,395][INFO ][o.e.l.LicenseService ] [pJU2v8-] license [40cfe699-c835-4e30-ae0e-60c0a3c360f2] mode [basic] - valid
备注:
4.1. 如果你想把 Elasticsearch 作为一个守护进程在后台运行,那么可以在后面添加参数 -d
。
./elasticsearch -d
4.2. 如果你是在 Windows 上面运行 Elasticseach,你应该运行 bin\elasticsearch.bat
而不是 bin\elasticsearch
。
- 检验是否启动成功:
linyk3@linyk3-aliyun:~/elasticsearch-6.4.2/bin$ curl 'http://localhost:9200/?pretty'
{
"name" : "pJU2v8-",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Q3bZoaq0Qt6F2FXvSXd4Jw",
"version" : {
"number" : "6.4.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "04711c2",
"build_date" : "2018-09-26T13:34:09.098244Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
如果出现上面的信息,说明已经启动并运行一个 Elasticsearch 节点了。