MAC 安装ES(Elastic Search)及Kibana
关于ES这里先不多介绍了,先看下怎么安装ES吧。这里安装的ES是基于JDK 1.8,需要先安装JDK1.8,否则会提示requirement is not satisfied。安装JDK 1.81. 下载JDK1.8可以到https://www.oracle.com/java/technologies/javase-jdk8-downloads.html下载,但是Oracle需要登......
关于ES这里先不多介绍了,先看下怎么安装ES吧。
这里安装的ES是基于JDK 1.8,需要先安装JDK1.8,否则会提示requirement is not satisfied。
安装JDK 1.8
1. 下载JDK1.8
可以到Java Downloads | Oracle下载,但是Oracle需要登录或者注册,然后才能下载,注册一个就好了。
2. 在Mac上下载后可以直接点击安装,然后一路向下,安装完成。
3. 查看下当前JAVA HOME对应的Java版本
(base) ➜ ~ /usr/libexec/java_home -v
java_home: option requires an argument -- v
/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
发现我这里的JAVA HOME是jdk-13.0.1.jdk,这个不是我们刚才安装的。可以看一下我们安装的所有版本:
(base) ➜ ~ ls /Library/Java/JavaVirtualMachines/
jdk-13.0.1.jdk jdk1.8.0_241.jdk
我们已经安装了jdk1.8.0_241.jdk,我们要做的是修改JAVA_HOME的路径
4. 修改JAVA HOME
打开~/.bash_profile,然后添加export修改环境变量。
(base) ➜ ~ vim ~/.bash_profile
然后添加如下命令
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
下次打开bash的时候会自动加载~/.bash_profile,为了不关闭命令行窗口,我们之间让配置生效即可。
(base) ➜ ~ source ~/.bash_profile
5. 查看当前的JAVA HOME和Java 版本
(base) ➜ ~ java -version
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
(base) ➜ ~ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
安装ES
1. Mac上安装ES方法比较简单,直接用brew安装即可。
brew install elasticsearch
2. 安装完后可以查看ES的版本
(base) ➜ search elasticsearch -version
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to No such file or directoryVersion: 6.8.7, Build: oss/tar/c63e621/2020-02-26T14:38:01.193138Z, JVM: 1.8.0_241
3. 启动ES,默认使用的9300端口号,我这里端口号被转成了9200
(base) ➜ search elasticsearch
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to No such file or directory[2020-03-22T16:34:14,643][INFO ][o.e.e.NodeEnvironment ] [0UvsR30] using [1] data paths, mounts [[/ (/dev/disk1s1)]], net usable_space [29.7gb], net total_space [233.4gb], types [apfs]
[2020-03-22T16:34:14,646][INFO ][o.e.e.NodeEnvironment ] [0UvsR30] heap size [989.8mb], compressed ordinary object pointers [true]
[2020-03-22T16:34:14,648][INFO ][o.e.n.Node ] [0UvsR30] node name derived from node ID [0UvsR30TQoqrXJryAaEXmw]; set [node.name] to override
[2020-03-22T16:34:14,648][INFO ][o.e.n.Node ] [0UvsR30] version[6.8.7], pid[43162], build[oss/tar/c63e621/2020-02-26T14:38:01.193138Z], OS[Mac OS X/10.14.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_241/25.241-b07]
[2020-03-22T16:34:14,649][INFO ][o.e.n.Node ] [0UvsR30] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/var/folders/nj/m2nwd8f51f7gmxhrcbhxr0380000gp/T/elasticsearch-9015270051828581519, -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=/usr/local/Cellar/elasticsearch/6.8.7/libexec, -Des.path.conf=/usr/local/etc/elasticsearch, -Des.distribution.flavor=oss, -Des.distribution.type=tar]
[2020-03-22T16:34:15,560][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [aggs-matrix-stats]
[2020-03-22T16:34:15,560][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [analysis-common]
[2020-03-22T16:34:15,560][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [ingest-common]
[2020-03-22T16:34:15,560][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [ingest-geoip]
[2020-03-22T16:34:15,560][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [ingest-user-agent]
[2020-03-22T16:34:15,561][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [lang-expression]
[2020-03-22T16:34:15,561][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [lang-mustache]
[2020-03-22T16:34:15,561][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [lang-painless]
[2020-03-22T16:34:15,561][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [mapper-extras]
[2020-03-22T16:34:15,562][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [parent-join]
[2020-03-22T16:34:15,562][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [percolator]
[2020-03-22T16:34:15,562][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [rank-eval]
[2020-03-22T16:34:15,562][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [reindex]
[2020-03-22T16:34:15,562][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [repository-url]
[2020-03-22T16:34:15,562][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [transport-netty4]
[2020-03-22T16:34:15,562][INFO ][o.e.p.PluginsService ] [0UvsR30] loaded module [tribe]
[2020-03-22T16:34:15,563][INFO ][o.e.p.PluginsService ] [0UvsR30] no plugins loaded
[2020-03-22T16:34:18,382][INFO ][o.e.d.DiscoveryModule ] [0UvsR30] using discovery type [zen] and host providers [settings]
[2020-03-22T16:34:18,830][INFO ][o.e.n.Node ] [0UvsR30] initialized
[2020-03-22T16:34:18,831][INFO ][o.e.n.Node ] [0UvsR30] starting ...
[2020-03-22T16:34:19,030][INFO ][o.e.t.TransportService ] [0UvsR30] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2020-03-22T16:34:22,099][INFO ][o.e.c.s.MasterService ] [0UvsR30] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {0UvsR30}{0UvsR30TQoqrXJryAaEXmw}{zqh2xNbBR_OTUcqBdBNq1A}{127.0.0.1}{127.0.0.1:9300}[2020-03-22T16:34:22,104][INFO ][o.e.c.s.ClusterApplierService] [0UvsR30] new_master {0UvsR30}{0UvsR30TQoqrXJryAaEXmw}{zqh2xNbBR_OTUcqBdBNq1A}{127.0.0.1}{127.0.0.1:9300}, reason: apply cluster state (from master [master {0UvsR30}{0UvsR30TQoqrXJryAaEXmw}{zqh2xNbBR_OTUcqBdBNq1A}{127.0.0.1}{127.0.0.1:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2020-03-22T16:34:22,122][INFO ][o.e.h.n.Netty4HttpServerTransport] [0UvsR30] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
4. 可以在浏览器里看到本地启动的ES的信息
Kibana安装
可以直接用kibana连接ES,kibana是一种数据看板,可以不同的数据库,方便数据展示及索引。
1. 安装kibana
(base) ➜ search brew install kibana
2. 启动kibana,kibana会自动连接ES,当没有启动ES的时候,会提示warning,我们在另外一个窗口启动ES后,会自动连接上。
(base) ➜ search kibana
log [09:09:58.124] [info][status][plugin:kibana@6.8.7] Status changed from uninitialized to green - Ready
log [09:09:58.152] [info][status][plugin:elasticsearch@6.8.7] Status changed from uninitialized to yellow - Waiting for Elasticsearch
log [09:09:58.156] [info][status][plugin:console@6.8.7] Status changed from uninitialized to green - Ready
log [09:09:58.159] [info][status][plugin:interpreter@6.8.7] Status changed from uninitialized to green - Ready
log [09:09:58.165] [info][status][plugin:metrics@6.8.7] Status changed from uninitialized to green - Ready
log [09:09:58.170] [info][status][plugin:tile_map@6.8.7] Status changed from uninitialized to green - Ready
log [09:09:58.304] [info][status][plugin:timelion@6.8.7] Status changed from uninitialized to green - Ready
log [09:09:58.320] [error][admin][elasticsearch] Request error, retrying
HEAD http://localhost:9200/ => connect ECONNREFUSED 127.0.0.1:9200
log [09:09:58.323] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:09:58.324] [warning][admin][elasticsearch] No living connections
log [09:09:58.326] [error][status][plugin:elasticsearch@6.8.7] Status changed from yellow to red - Unable to connect to Elasticsearch.
log [09:10:00.832] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:00.833] [warning][admin][elasticsearch] No living connections
log [09:10:03.339] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:03.340] [warning][admin][elasticsearch] No living connections
log [09:10:05.847] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:05.848] [warning][admin][elasticsearch] No living connections
log [09:10:08.352] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:08.353] [warning][admin][elasticsearch] No living connections
log [09:10:10.858] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:10.859] [warning][admin][elasticsearch] No living connections
log [09:10:13.365] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:13.365] [warning][admin][elasticsearch] No living connections
log [09:10:15.868] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:15.868] [warning][admin][elasticsearch] No living connections
log [09:10:18.374] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:18.375] [warning][admin][elasticsearch] No living connections
log [09:10:20.881] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:20.881] [warning][admin][elasticsearch] No living connections
log [09:10:23.386] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:23.386] [warning][admin][elasticsearch] No living connections
log [09:10:25.890] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:25.891] [warning][admin][elasticsearch] No living connections
log [09:10:28.398] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:28.399] [warning][admin][elasticsearch] No living connections
log [09:10:30.907] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:30.908] [warning][admin][elasticsearch] No living connections
log [09:10:33.414] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:33.414] [warning][admin][elasticsearch] No living connections
log [09:10:35.917] [warning][admin][elasticsearch] Unable to revive connection: http://localhost:9200/
log [09:10:35.917] [warning][admin][elasticsearch] No living connections
log [09:10:38.559] [info][status][plugin:elasticsearch@6.8.7] Status changed from red to green - Ready
log [09:10:38.582] [info][migrations] Creating index .kibana_1.
log [09:10:38.951] [info][migrations] Pointing alias .kibana to .kibana_1.
log [09:10:38.986] [info][migrations] Finished in 405ms.
log [09:10:38.987] [info][listening] Server running at http://localhost:5601
参考文献:LiveToolkit
更多推荐
所有评论(0)