Elasticsearch 入门:安装及启动Elasticsearch

参考文档:Elasticsearch: 权威指南

  1. 下载Elasticsearch 安装包:
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz
image.png
  1. 解压
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

  1. 检验是否启动成功:
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 节点了。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 217,657评论 6 505
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,889评论 3 394
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,057评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,509评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,562评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,443评论 1 302
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,251评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,129评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,561评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,779评论 3 335
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,902评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,621评论 5 345
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,220评论 3 328
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,838评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,971评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,025评论 2 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,843评论 2 354

推荐阅读更多精彩内容