Elasticsearch实战(三)-MacOS下载安装启动Elasticserch、Kibana

2021-02-22 12:00:23 浏览数 (1)

1 安装JDK

至少1.8.0_73以上版本

代码语言:javascript复制
java -version

2 下载

代码语言:javascript复制
brew install elasticsearch

启动Elasticsearch

es本身特点之一就是开箱即用,如果是中小型应用,数据量少,操作不是很复杂,直接启动就可以用了

代码语言:javascript复制
elasticsearch
代码语言:javascript复制
elasticsearch --version
代码语言:javascript复制
[2020-11-22T14:57:44,933][INFO ][o.e.n.Node               ] [AppledeMac-mini.local] version[7.9.2-SNAPSHOT], pid[16495], build[oss/tar/unknown/2020-10-03T08:22:40.976826Z], OS[Mac OS X/10.15.7/x86_64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/14.0.1/14.0.1 14]
[2020-11-22T14:57:44,936][INFO ][o.e.n.Node               ] [AppledeMac-mini.local] JVM home [/usr/local/Cellar/openjdk/14.0.1/libexec/openjdk.jdk/Contents/Home]
[2020-11-22T14:57:44,937][INFO ][o.e.n.Node               ] [AppledeMac-mini.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/gd/7v6l67j50mx_bvxd4w04fh9h0000gn/T/elasticsearch-2351844098276453547, -XX: HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc age=trace,safepoint:file=/usr/local/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/usr/local/Cellar/elasticsearch/7.9.2/libexec, -Des.path.conf=/usr/local/etc/elasticsearch, -Des.distribution.flavor=oss, -Des.distribution.type=tar, -Des.bundled_jdk=false]
[2020-11-22T14:57:44,937][WARN ][o.e.n.Node               ] [AppledeMac-mini.local] version [7.9.2-SNAPSHOT] is a pre-release version of Elasticsearch and is not suitable for production
[2020-11-22T14:57:45,731][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [aggs-matrix-stats]
[2020-11-22T14:57:45,731][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [analysis-common]
[2020-11-22T14:57:45,731][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [geo]
[2020-11-22T14:57:45,732][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [ingest-common]
[2020-11-22T14:57:45,732][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [ingest-geoip]
[2020-11-22T14:57:45,732][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [ingest-user-agent]
[2020-11-22T14:57:45,732][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [kibana]
[2020-11-22T14:57:45,732][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [lang-expression]
[2020-11-22T14:57:45,733][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [lang-mustache]
[2020-11-22T14:57:45,733][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [lang-painless]
[2020-11-22T14:57:45,733][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [mapper-extras]
[2020-11-22T14:57:45,733][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [parent-join]
[2020-11-22T14:57:45,733][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [percolator]
[2020-11-22T14:57:45,734][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [rank-eval]
[2020-11-22T14:57:45,734][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [reindex]
[2020-11-22T14:57:45,734][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [repository-url]
[2020-11-22T14:57:45,734][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [tasks]
[2020-11-22T14:57:45,735][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] loaded module [transport-netty4]
[2020-11-22T14:57:45,735][INFO ][o.e.p.PluginsService     ] [AppledeMac-mini.local] no plugins loaded
[2020-11-22T14:57:45,776][INFO ][o.e.e.NodeEnvironment    ] [AppledeMac-mini.local] using [1] data paths, mounts [[/System/Volumes/Data (/dev/disk1s2)]], net usable_space [332.2gb], net total_space [465.6gb], types [apfs]
[2020-11-22T14:57:45,777][INFO ][o.e.e.NodeEnvironment    ] [AppledeMac-mini.local] heap size [1gb], compressed ordinary object pointers [true]
[2020-11-22T14:57:45,823][INFO ][o.e.n.Node               ] [AppledeMac-mini.local] node name [AppledeMac-mini.local], node ID [jHttjUoGRumT-noY43O0pA], cluster name [elasticsearch_brew]
[2020-11-22T14:57:48,070][INFO ][o.e.t.NettyAllocator     ] [AppledeMac-mini.local] creating NettyAllocator with the following configs: [name=unpooled, factors={es.unsafe.use_unpooled_allocator=false, g1gc_enabled=true, g1gc_region_size=1mb, heap_size=1gb}]
[2020-11-22T14:57:48,119][INFO ][o.e.d.DiscoveryModule    ] [AppledeMac-mini.local] using discovery type [zen] and seed hosts providers [settings]
[2020-11-22T14:57:48,297][WARN ][o.e.g.DanglingIndicesState] [AppledeMac-mini.local] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
[2020-11-22T14:57:48,403][INFO ][o.e.n.Node               ] [AppledeMac-mini.local] initialized
[2020-11-22T14:57:48,403][INFO ][o.e.n.Node               ] [AppledeMac-mini.local] starting ...
[2020-11-22T14:57:48,520][INFO ][o.e.t.TransportService   ] [AppledeMac-mini.local] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2020-11-22T14:57:48,699][WARN ][o.e.b.BootstrapChecks    ] [AppledeMac-mini.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-11-22T14:57:48,708][INFO ][o.e.c.c.ClusterBootstrapService] [AppledeMac-mini.local] no discovery configuration found, will perform best-effort cluster bootstrapping after [3s] unless existing master is discovered
[2020-11-22T14:57:51,712][INFO ][o.e.c.c.Coordinator      ] [AppledeMac-mini.local] setting initial configuration to VotingConfiguration{jHttjUoGRumT-noY43O0pA}
[2020-11-22T14:57:51,823][INFO ][o.e.c.s.MasterService    ] [AppledeMac-mini.local] elected-as-master ([1] nodes joined)[{AppledeMac-mini.local}{jHttjUoGRumT-noY43O0pA}{M0fYmhtVRMS_n0dsGytG5g}{127.0.0.1}{127.0.0.1:9300}{dimr} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{AppledeMac-mini.local}{jHttjUoGRumT-noY43O0pA}{M0fYmhtVRMS_n0dsGytG5g}{127.0.0.1}{127.0.0.1:9300}{dimr}]}
[2020-11-22T14:57:51,875][INFO ][o.e.c.c.CoordinationState] [AppledeMac-mini.local] cluster UUID set to [VxIeMldTRDS2C47jc_Y7Jg]
[2020-11-22T14:57:51,935][INFO ][o.e.c.s.ClusterApplierService] [AppledeMac-mini.local] master node changed {previous [], current [{AppledeMac-mini.local}{jHttjUoGRumT-noY43O0pA}{M0fYmhtVRMS_n0dsGytG5g}{127.0.0.1}{127.0.0.1:9300}{dimr}]}, term: 1, version: 1, reason: Publication{term=1, version=1}
[2020-11-22T14:57:51,954][INFO ][o.e.h.AbstractHttpServerTransport] [AppledeMac-mini.local] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2020-11-22T14:57:51,954][INFO ][o.e.n.Node               ] [AppledeMac-mini.local] started
[2020-11-22T14:57:51,984][INFO ][o.e.g.GatewayService     ] [AppledeMac-mini.local] recovered [0] indices into cluster_state
[2020-11-22T14:58:09,209][INFO ][o.e.c.m.MetadataCreateIndexService] [AppledeMac-mini.local] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1]
[2020-11-22T14:58:09,218][INFO ][o.e.c.r.a.AllocationService] [AppledeMac-mini.local] updating number_of_replicas to [0] for indices [.kibana_1]
[2020-11-22T14:58:09,582][INFO ][o.e.c.r.a.AllocationService] [AppledeMac-mini.local] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.kibana_1][0]]]).
[2020-11-22T14:58:56,633][INFO ][o.e.c.m.MetadataCreateIndexService] [AppledeMac-mini.local] [kibana_sample_data_ecommerce] creating index, cause [api], templates [], shards [1]/[1]
[2020-11-22T14:58:56,635][INFO ][o.e.c.r.a.AllocationService] [AppledeMac-mini.local] updating number_of_replicas to [0] for indices [kibana_sample_data_ecommerce]
[2020-11-22T14:58:56,901][INFO ][o.e.c.r.a.AllocationService] [AppledeMac-mini.local] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[kibana_sample_data_ecommerce][0]]]).
[2020-11-22T14:59:00,388][INFO ][o.e.c.m.MetadataMappingService] [AppledeMac-mini.local] [.kibana_1/FRGMCYCXT66CQEP5lLVleQ] update_mapping [_doc]
[2020-11-22T14:59:00,452][INFO ][o.e.c.m.MetadataMappingService] [AppledeMac-mini.local] [.kibana_1/FRGMCYCXT66CQEP5lLVleQ] update_mapping [_doc]
[2020-11-22T14:59:00,509][INFO ][o.e.c.m.MetadataMappingService] [AppledeMac-mini.local] [.kibana_1/FRGMCYCXT66CQEP5lLVleQ] update_mapping [_doc]
[2020-11-22T14:59:00,567][INFO ][o.e.c.m.MetadataMappingService] [AppledeMac-mini.local] [.kibana_1/FRGMCYCXT66CQEP5lLVleQ] update_mapping [_doc]
[2020-11-22T14:59:01,663][INFO ][o.e.c.m.MetadataMappingService] [AppledeMac-mini.local] [.kibana_1/FRGMCYCXT66CQEP5lLVleQ] update_mapping [_doc]

4 检查ES是否启动成功:http://localhost:9200/?pretty

name: node名称 cluster_name: 集群名称(默认的集群名称就是elasticsearch) version.number: 5.2.0,es版本号

5 修改集群名称:elasticsearch.yml

6 安装Kibana

使用里面的开发界面,去操作elasticsearch,作为我们学习es知识点的一个主要的界面入口

Kibana是ES的一个配套工具,让用户在网页中可以直接与ES进行交互。 安装命令:

代码语言:javascript复制
brew install kibana
代码语言:javascript复制
➜  ~ brew install kibana
==> Downloading https://homebrew.bintray.com/bottles/icu4c-67.1.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/2d1e91b5127f66e7941790c004817c94c892725c88f84f1e4c37297fcbc0c72f?res
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/node@10-10.22.1.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/19bbe37c6f2500673abd3c527df1bb70ea377d9830af32455b4992c94ab592d8?res
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/kibana-7.8.1_1.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/ab4ebbdabe531a35369b61b5770d0b7a0028a21ec8cdd1dfc7070041c1fa358e?res
######################################################################## 100.0%
==> Installing dependencies for kibana: icu4c and node@10
==> Installing kibana dependency: icu4c
==> Pouring icu4c-67.1.catalina.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

==> Summary

0 人点赞