Elasticsearch 官网:https://www.elastic.co
Elasticsearch是一个封装了,所说的开箱即用,是说解压即可用。
创建用户
下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.1.tar.gz
解压
tar -zxvf elasticsearch-6.4.1.tar.gz
安装路径
/home/es/elasticsearch-6.4.1
启动服务端
进入ES安装目录,执行 ./bin/elasticsearch
[es@bogon ~]$ elasticsearch-6.4.1/bin/elasticsearch [2019-10-17T09:43:29,363][INFO ][o.e.n.Node ] [] initializing ... [2019-10-17T09:43:29,409][INFO ][o.e.e.NodeEnvironment ] [uyS3a_p] using [1] data paths, mounts [[/home (/dev/mapper/centos-home)]], net usable_space [140.6gb], net total_space [141.5gb], types [xfs] [2019-10-17T09:43:29,409][INFO ][o.e.e.NodeEnvironment ] [uyS3a_p] heap size [989.8mb], compressed ordinary object pointers [true] [2019-10-17T09:43:29,410][INFO ][o.e.n.Node ] [uyS3a_p] node name derived from node ID [uyS3a_pATBG5NwZNzfpWJQ]; set [node.name] to override [2019-10-17T09:43:29,410][INFO ][o.e.n.Node ] [uyS3a_p] version[6.4.1], pid[24171], build[default/tar/e36acdb/2018-09-13T22:18:07.696808Z], OS[Linux/3.10.0-957.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_181/25.181-b13] [2019-10-17T09:43:29,410][INFO ][o.e.n.Node ] [uyS3a_p] 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.kJBGHbPY, -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/es/elasticsearch-6.4.1, -Des.path.conf=/home/es/elasticsearch-6.4.1/config, -Des.distribution.flavor=default, -Des.distribution.type=tar] [2019-10-17T09:43:30,461][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [aggs-matrix-stats] [2019-10-17T09:43:30,461][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [analysis-common] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [ingest-common] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [lang-expression] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [lang-mustache] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [lang-painless] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [mapper-extras] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [parent-join] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [percolator] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [rank-eval] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [reindex] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [repository-url] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [transport-netty4] [2019-10-17T09:43:30,462][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [tribe] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-core] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-deprecation] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-graph] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-logstash] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-ml] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-monitoring] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-rollup] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-security] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-sql] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-upgrade] [2019-10-17T09:43:30,463][INFO ][o.e.p.PluginsService ] [uyS3a_p] loaded module [x-pack-watcher] [2019-10-17T09:43:30,464][INFO ][o.e.p.PluginsService ] [uyS3a_p] no plugins loaded [2019-10-17T09:43:33,206][INFO ][o.e.x.s.a.s.FileRolesStore] [uyS3a_p] parsed [0] roles from file [/home/es/elasticsearch-6.4.1/config/roles.yml] [2019-10-17T09:43:33,554][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/24250] [Main.cc@109] controller (64 bit): Version 6.4.1 (Build 1df3104bc26648) Copyright (c) 2018 Elasticsearch BV [2019-10-17T09:43:33,785][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security [2019-10-17T09:43:33,905][INFO ][o.e.d.DiscoveryModule ] [uyS3a_p] using discovery type [zen] [2019-10-17T09:43:34,339][INFO ][o.e.n.Node ] [uyS3a_p] initialized [2019-10-17T09:43:34,339][INFO ][o.e.n.Node ] [uyS3a_p] starting ... [2019-10-17T09:43:34,476][INFO ][o.e.t.TransportService ] [uyS3a_p] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300} [2019-10-17T09:43:37,551][INFO ][o.e.c.s.MasterService ] [uyS3a_p] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: new_master {uyS3a_p}{uyS3a_pATBG5NwZNzfpWJQ}{5saUm0dRTbK0825eT3pO7w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=16358428672, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} [2019-10-17T09:43:37,556][INFO ][o.e.c.s.ClusterApplierService] [uyS3a_p] new_master {uyS3a_p}{uyS3a_pATBG5NwZNzfpWJQ}{5saUm0dRTbK0825eT3pO7w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=16358428672, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {uyS3a_p}{uyS3a_pATBG5NwZNzfpWJQ}{5saUm0dRTbK0825eT3pO7w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=16358428672, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]]) [2019-10-17T09:43:37,569][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [uyS3a_p] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200} [2019-10-17T09:43:37,569][INFO ][o.e.n.Node ] [uyS3a_p] started [2019-10-17T09:43:37,583][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [uyS3a_p] Failed to clear cache for realms [[]] [2019-10-17T09:43:37,612][INFO ][o.e.g.GatewayService ] [uyS3a_p] recovered [0] indices into cluster_state [2019-10-17T09:43:37,715][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.watch-history-9] for index patterns [.watcher-history-9*] [2019-10-17T09:43:37,737][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.triggered_watches] for index patterns [.triggered_watches*] [2019-10-17T09:43:37,756][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.watches] for index patterns [.watches*] [2019-10-17T09:43:37,779][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*] [2019-10-17T09:43:37,803][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*] [2019-10-17T09:43:37,827][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*] [2019-10-17T09:43:37,845][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6] [2019-10-17T09:43:37,866][INFO ][o.e.c.m.MetaDataIndexTemplateService] [uyS3a_p] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*] [2019-10-17T09:43:37,953][INFO ][o.e.l.LicenseService ] [uyS3a_p] license [6e085e8f-9539-4f07-acdb-06ec3793e20e] mode [basic] - valid
调用RESTful API
ES默认在9200端口运行,打开另一个命令终端,发请求至该端口,会得到以下的jason返回:
[es@bogon elasticsearch-6.3.2]$ curl localhost:9200 { "name" : "uyS3a_p", "cluster_name" : "elasticsearch", "cluster_uuid" : "mg7654_-T7eUMmtn7RLznQ", "version" : { "number" : "6.4.1", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "e36acdb", "build_date" : "2018-09-13T22:18:07.696808Z", "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" }