请选择 进入手机版 | 继续访问电脑版

(四)ElasticSearch安装步骤

[复制链接]
东方龙头 发表于 2021-1-2 17:41:31 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
目次
1.下载安装包
2.开始安装
3.确认是否启动乐成
4.注意两点问题
前边先容过ElasticSearch是采取Java开辟,所以我们在安装ElasticSearch之前必须要先安装JDK。详细参考以下官方要求。
参考网址

JDK的安装我这里就不先容了,各人可以根据自己的情况搜索如何安装。这里我就假设各人安装了JDK8。下面我们开始安装ElasticSearch吧:
1.下载安装包

打开Elastic官方网站下载所在(https://www.elastic.co/cn/downloads/)。

 
点击下载,到Elasticsearch下载页。

 
根据自己使用的电脑实际的情况下载自己想要的安装包,我这边使用的是Mac电脑,所以我下载的是7.10.1版本的MACOS版。
如果想下载老版本,可以在页面下方找到一个“past releases”如下图所示:

 
大概输入所在“https://www.elastic.co/cn/downloads/past-releases#elasticsearch”

 
下载完之后我得到一个“elasticsearch-7.10.1-darwin-x86_64.tar.gz”的压缩包。我们解压,我的解压到/Users/hugengyong/tools/elasticsearch-7.10.1目次下。
OK,接下来我们开始安装启动elasticsearch。
2.开始安装

我们打开下令终端
  1. hugengyong@hugyMac ~ % cd /Users/hugengyong/tools/elasticsearch-7.10.1hugengyong@hugyMac elasticsearch-7.10.1 % ls                                             LICENSE.txt        README.asciidoc        config                jdk.app                logs                pluginsNOTICE.txt        bin                data                lib                moduleshugengyong@hugyMac elasticsearch-7.10.1 % cd bin   hugengyong@hugyMac bin % lselasticsearch                                elasticsearch-saml-metadataelasticsearch-certgen                        elasticsearch-setup-passwordselasticsearch-certutil                        elasticsearch-shardelasticsearch-cli                        elasticsearch-sql-clielasticsearch-croneval                        elasticsearch-sql-cli-7.10.1.jarelasticsearch-env                        elasticsearch-syskeygenelasticsearch-env-from-file                elasticsearch-userselasticsearch-keystore                        x-pack-envelasticsearch-migrate                        x-pack-security-envelasticsearch-node                        x-pack-watcher-envelasticsearch-pluginhugengyong@hugyMac bin % ./elasticsearch[2020-12-31T15:09:34,048][INFO ][o.e.n.Node               ] [hugyMac.local] version[7.10.1], pid[24746], build[default/tar/1c34507e66d7db1211f66f3513706fdf548736aa/2020-12-05T01:00:33.671820Z], OS[Mac OS X/10.16/x86_64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/15.0.1/15.0.1+9][2020-12-31T15:09:34,057][INFO ][o.e.n.Node               ] [hugyMac.local] JVM home [/Users/hugengyong/tools/elasticsearch-7.10.1/jdk.app/Contents/Home], using bundled JDK [true][2020-12-31T15:09:34,059][INFO ][o.e.n.Node               ] [hugyMac.local] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, -Xms1g, -Xmx1g, -XX:+UseG1GC, -XX:G1ReservePercent=25, -XX:InitiatingHeapOccupancyPercent=30, -Djava.io.tmpdir=/var/folders/9d/fyzzcyws0956dn53px5g06740000gn/T/elasticsearch-11523817319313888246, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/Users/hugengyong/tools/elasticsearch-7.10.1, -Des.path.conf=/Users/hugengyong/tools/elasticsearch-7.10.1/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true][2020-12-31T15:09:36,962][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [aggs-matrix-stats][2020-12-31T15:09:36,966][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [analysis-common][2020-12-31T15:09:36,966][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [constant-keyword][2020-12-31T15:09:36,968][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [flattened][2020-12-31T15:09:36,968][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [frozen-indices][2020-12-31T15:09:36,968][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [ingest-common][2020-12-31T15:09:36,968][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [ingest-geoip][2020-12-31T15:09:36,968][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [ingest-user-agent][2020-12-31T15:09:36,969][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [kibana][2020-12-31T15:09:36,969][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [lang-expression][2020-12-31T15:09:36,969][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [lang-mustache][2020-12-31T15:09:36,970][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [lang-painless][2020-12-31T15:09:36,970][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [mapper-extras][2020-12-31T15:09:36,971][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [mapper-version][2020-12-31T15:09:36,971][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [parent-join][2020-12-31T15:09:36,971][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [percolator][2020-12-31T15:09:36,972][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [rank-eval][2020-12-31T15:09:36,972][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [reindex][2020-12-31T15:09:36,972][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [repositories-metering-api][2020-12-31T15:09:36,973][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [repository-url][2020-12-31T15:09:36,973][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [search-business-rules][2020-12-31T15:09:36,973][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [searchable-snapshots][2020-12-31T15:09:36,973][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [spatial][2020-12-31T15:09:36,973][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [transform][2020-12-31T15:09:36,974][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [transport-netty4][2020-12-31T15:09:36,974][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [unsigned-long][2020-12-31T15:09:36,974][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [vectors][2020-12-31T15:09:36,974][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [wildcard][2020-12-31T15:09:36,976][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-analytics][2020-12-31T15:09:36,976][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-async][2020-12-31T15:09:36,976][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-async-search][2020-12-31T15:09:36,976][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-autoscaling][2020-12-31T15:09:36,977][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-ccr][2020-12-31T15:09:36,977][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-core][2020-12-31T15:09:36,977][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-data-streams][2020-12-31T15:09:36,977][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-deprecation][2020-12-31T15:09:36,977][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-enrich][2020-12-31T15:09:36,977][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-eql][2020-12-31T15:09:36,978][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-graph][2020-12-31T15:09:36,978][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-identity-provider][2020-12-31T15:09:36,978][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-ilm][2020-12-31T15:09:36,979][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-logstash][2020-12-31T15:09:36,979][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-ml][2020-12-31T15:09:36,979][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-monitoring][2020-12-31T15:09:36,979][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-ql][2020-12-31T15:09:36,980][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-rollup][2020-12-31T15:09:36,980][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-security][2020-12-31T15:09:36,980][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-sql][2020-12-31T15:09:36,980][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-stack][2020-12-31T15:09:36,981][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-voting-only-node][2020-12-31T15:09:36,981][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded module [x-pack-watcher][2020-12-31T15:09:36,981][INFO ][o.e.p.PluginsService     ] [hugyMac.local] loaded plugin [analysis-ik][2020-12-31T15:09:37,041][INFO ][o.e.e.NodeEnvironment    ] [hugyMac.local] using [1] data paths, mounts [[/System/Volumes/Data (/dev/disk3s5)]], net usable_space [97.7gb], net total_space [228.2gb], types [apfs][2020-12-31T15:09:37,042][INFO ][o.e.e.NodeEnvironment    ] [hugyMac.local] heap size [1gb], compressed ordinary object pointers [true][2020-12-31T15:09:37,171][INFO ][o.e.n.Node               ] [hugyMac.local] node name [hugyMac.local], node ID [0HJa65evT7mfBNX8sw7Vmg], cluster name [elasticsearch], roles [transform, master, remote_cluster_client, data, ml, data_content, data_hot, data_warm, data_cold, ingest][2020-12-31T15:09:40,839][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [hugyMac.local] [controller/24787] [Main.cc@114] controller (64 bit): Version 7.10.1 (Build 11e1ac84105757) Copyright (c) 2020 Elasticsearch BV[2020-12-31T15:09:41,530][INFO ][o.e.x.s.a.s.FileRolesStore] [hugyMac.local] parsed [0] roles from file [/Users/hugengyong/tools/elasticsearch-7.10.1/config/roles.yml][2020-12-31T15:09:42,584][INFO ][o.e.t.NettyAllocator     ] [hugyMac.local] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=256kb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=1mb, heap_size=1gb}][2020-12-31T15:09:42,645][INFO ][o.e.d.DiscoveryModule    ] [hugyMac.local] using discovery type [zen] and seed hosts providers [settings][2020-12-31T15:09:43,077][WARN ][o.e.g.DanglingIndicesState] [hugyMac.local] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually[2020-12-31T15:09:43,362][INFO ][o.e.n.Node               ] [hugyMac.local] initialized[2020-12-31T15:09:43,363][INFO ][o.e.n.Node               ] [hugyMac.local] starting ...[2020-12-31T15:09:48,527][INFO ][o.e.t.TransportService   ] [hugyMac.local] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}[2020-12-31T15:09:49,075][WARN ][o.e.b.BootstrapChecks    ] [hugyMac.local] the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured[2020-12-31T15:09:49,077][INFO ][o.e.c.c.Coordinator      ] [hugyMac.local] cluster UUID [hzKBC_gbTFu35E7enjxAzw][2020-12-31T15:09:49,084][INFO ][o.e.c.c.ClusterBootstrapService] [hugyMac.local] no discovery configuration found, will perform best-effort cluster bootstrapping after [3s] unless existing master is discovered[2020-12-31T15:09:49,427][INFO ][o.e.c.s.MasterService    ] [hugyMac.local] elected-as-master ([1] nodes joined)[{hugyMac.local}{0HJa65evT7mfBNX8sw7Vmg}{Z4PV8qePTZ6pD5YiO4tEiw}{127.0.0.1}{127.0.0.1:9300}{cdhilmrstw}{ml.machine_memory=17179869184, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 2, version: 87, delta: master node changed {previous [], current [{hugyMac.local}{0HJa65evT7mfBNX8sw7Vmg}{Z4PV8qePTZ6pD5YiO4tEiw}{127.0.0.1}{127.0.0.1:9300}{cdhilmrstw}{ml.machine_memory=17179869184, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}[2020-12-31T15:09:49,574][INFO ][o.e.c.s.ClusterApplierService] [hugyMac.local] master node changed {previous [], current [{hugyMac.local}{0HJa65evT7mfBNX8sw7Vmg}{Z4PV8qePTZ6pD5YiO4tEiw}{127.0.0.1}{127.0.0.1:9300}{cdhilmrstw}{ml.machine_memory=17179869184, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}, term: 2, version: 87, reason: Publication{term=2, version=87}[2020-12-31T15:09:49,610][INFO ][o.e.h.AbstractHttpServerTransport] [hugyMac.local] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}[2020-12-31T15:09:49,623][INFO ][o.e.n.Node               ] [hugyMac.local] started[2020-12-31T15:09:49,977][INFO ][o.e.l.LicenseService     ] [hugyMac.local] license [307763c8-c8c7-435c-93e9-f5954373ef6a] mode [basic] - valid[2020-12-31T15:09:49,981][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [hugyMac.local] Active license is now [BASIC]; Security is disabled[2020-12-31T15:09:49,987][INFO ][o.e.g.GatewayService     ] [hugyMac.local] recovered [7] indices into cluster_state[2020-12-31T15:09:50,276][INFO ][o.w.a.d.Dictionary       ] [hugyMac.local] try load config from /Users/hugengyong/tools/elasticsearch-7.10.1/config/analysis-ik/IKAnalyzer.cfg.xml[2020-12-31T15:09:50,281][INFO ][o.w.a.d.Dictionary       ] [hugyMac.local] try load config from /Users/hugengyong/tools/elasticsearch-7.10.1/plugins/elasticsearch-analysis-ik-7.10.1/config/IKAnalyzer.cfg.xml[2020-12-31T15:09:53,303][INFO ][o.e.c.r.a.AllocationService] [hugyMac.local] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[.kibana-event-log-7.10.1-000001][0], [ilm-history-3-000001][0]]]).
复制代码
看到上边的started了就说明已经启动了启动的默认所在是9200.
3.确认是否启动乐成

下面我们可以打开欣赏器输入http://127.0.0.1:9200/回车会看到如下界面
 

没错,就是这么简单,界面也就是这么Lower。这就说明我们的单机版ElasticSearch安装安成了 。到这里相信各人已经感受到ElasticSearch安装到底有多简单了,就像我们在启动一个启动一个Springboot的工程一样简单。
4.注意两点问题

我们需要知道ElasticSearch默认使用两个端口一个是9200,一个是9300。


  • 9200 是ES节点与外部通讯使用的端口。它是http协议的RESTful接口(各种CRUD操纵都是走的该端口,如查询:http://localhost:9200/user/_search)。
  • 9300是ES节点之间通讯使用的端口。它是tcp通讯端口,集群间和TCPclient都走的它。(java步伐中使用ES时,在设置文件中要设置该端口)
我们需要知道ElasticSearch默认使用两个端口一个是9200,一个是9300。
欣赏器中返回的json,cluster_name默认值为elasticsearch。这是我们默认的集群的名字,发起各人后续开辟、测试大概生产情况中按照情况创建差别的集群名称,如:es_dev\es_test\es_prod。
好了,ElasticSearch安装就完成了,下一篇我们来详细解读以下设置文件。

来源:https://blog.csdn.net/hugengyong/article/details/112017387
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


专注素材教程免费分享
全国免费热线电话

18768367769

周一至周日9:00-23:00

反馈建议

27428564@qq.com 在线QQ咨询

扫描二维码关注我们

Powered by Discuz! X3.4© 2001-2013 Comsenz Inc.( 蜀ICP备2021001884号-1 )