0%

在macOS上面安装elasticsearch组件及问题解决

下载MAC版本安装包

进入页面https://www.elastic.co/downloads/apm ,选择mac平台的安装包 下载文件到/usr/local/elasticsearch/elasticsearch-6.4.2.tar.gz

解压文件

1
$ sudo tar -zxvf elasticsearch-6.4.2.tar.gz

运行

1
2
3
4
5
6
7
8
9
10
11
$ bin/elasticsearch
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-6.4.2/config/jvm.options
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:60)

权限不够,查看一下,登录用户是没有修改文件的权限的

1
2
3
4
5
6
7
8
9
10
11
$ ls -l elasticsearch-6.4.2

-rw-r--r--@ 1 root wheel 13675 Sep 26 21:30 LICENSE.txt
-rw-r--r--@ 1 root wheel 401465 Sep 26 21:38 NOTICE.txt
-rw-r--r--@ 1 root wheel 8511 Sep 26 21:30 README.textile
drwxr-xr-x@ 43 root wheel 1376 Sep 26 21:38 bin
drwxr-xr-x@ 9 root wheel 288 Sep 26 21:38 config
drwxr-xr-x@ 42 root wheel 1344 Sep 26 21:38 lib
drwxr-xr-x@ 2 root wheel 64 Sep 26 21:38 logs
drwxr-xr-x@ 27 root wheel 864 Sep 26 21:38 modules
drwxr-xr-x@ 2 root wheel 64 Sep 26 21:38 plugins

修改权限

1
$ sudo chown -R simon elasticsearch-6.4.2

再次启动elasticsearch程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$ bin/elasticsearch
[2018-10-17T10:04:22,029][INFO ][o.e.n.Node ] [] initializing ...
[2018-10-17T10:04:22,100][INFO ][o.e.e.NodeEnvironment ] [VhQno38] using [1] data paths, mounts [[/ (/dev/disk1s1)]], net usable_space [353.6gb], net total_space [465.6gb], types [apfs]
[2018-10-17T10:04:22,101][INFO ][o.e.e.NodeEnvironment ] [VhQno38] heap size [990.7mb], compressed ordinary object pointers [true]
[2018-10-17T10:04:22,104][INFO ][o.e.n.Node ] [VhQno38] node name derived from node ID [VhQno38hQfO03l3Sxt6Bnw]; set [node.name] to override
[2018-10-17T10:04:22,104][INFO ][o.e.n.Node ] [VhQno38] version[6.4.2], pid[12313], build[default/tar/04711c2/2018-09-26T13:34:09.098244Z], OS[Mac OS X/10.13.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_181/25.181-b13]
[2018-10-17T10:04:22,104][INFO ][o.e.n.Node ] [VhQno38] 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=/var/folders/2h/4vmz9_k14pb4x5338vs98nmw0000gn/T/elasticsearch.98Xlp9JQ, -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/elasticsearch/elasticsearch-6.4.2, -Des.path.conf=/usr/local/elasticsearch/elasticsearch-6.4.2/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2018-10-17T10:04:24,127][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [aggs-matrix-stats]
[2018-10-17T10:04:24,127][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [analysis-common]
[2018-10-17T10:04:24,127][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [ingest-common]
[2018-10-17T10:04:24,127][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [lang-expression]
[2018-10-17T10:04:24,127][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [lang-mustache]
[2018-10-17T10:04:24,128][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [lang-painless]
[2018-10-17T10:04:24,128][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [mapper-extras]
[2018-10-17T10:04:24,128][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [parent-join]
[2018-10-17T10:04:24,128][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [percolator]
[2018-10-17T10:04:24,128][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [rank-eval]
[2018-10-17T10:04:24,128][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [reindex]
[2018-10-17T10:04:24,128][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [repository-url]
[2018-10-17T10:04:24,129][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [transport-netty4]
[2018-10-17T10:04:24,129][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [tribe]
[2018-10-17T10:04:24,129][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-core]
[2018-10-17T10:04:24,130][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-deprecation]
[2018-10-17T10:04:24,130][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-graph]
[2018-10-17T10:04:24,130][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-logstash]
[2018-10-17T10:04:24,131][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-ml]
[2018-10-17T10:04:24,131][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-monitoring]
[2018-10-17T10:04:24,131][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-rollup]
[2018-10-17T10:04:24,131][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-security]
[2018-10-17T10:04:24,131][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-sql]
[2018-10-17T10:04:24,131][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-upgrade]
[2018-10-17T10:04:24,131][INFO ][o.e.p.PluginsService ] [VhQno38] loaded module [x-pack-watcher]
[2018-10-17T10:04:24,132][INFO ][o.e.p.PluginsService ] [VhQno38] no plugins loaded
[2018-10-17T10:04:27,786][INFO ][o.e.x.s.a.s.FileRolesStore] [VhQno38] parsed [0] roles from file [/usr/local/elasticsearch/elasticsearch-6.4.2/config/roles.yml]
[2018-10-17T10:04:28,270][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/12332] [Main.cc@109] controller (64 bit): Version 6.4.2 (Build 660eefe6f2ea55) Copyright (c) 2018 Elasticsearch BV
[2018-10-17T10:04:28,685][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2018-10-17T10:04:28,911][INFO ][o.e.d.DiscoveryModule ] [VhQno38] using discovery type [zen]
[2018-10-17T10:04:30,161][INFO ][o.e.n.Node ] [VhQno38] initialized
[2018-10-17T10:04:30,161][INFO ][o.e.n.Node ] [VhQno38] starting ...
[2018-10-17T10:04:30,380][INFO ][o.e.t.TransportService ] [VhQno38] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2018-10-17T10:04:33,445][INFO ][o.e.c.s.MasterService ] [VhQno38] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: new_master {VhQno38}{VhQno38hQfO03l3Sxt6Bnw}{jy1_1dpHToOxN2CCtH5ztw}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=8589934592, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2018-10-17T10:04:33,450][INFO ][o.e.c.s.ClusterApplierService] [VhQno38] new_master {VhQno38}{VhQno38hQfO03l3Sxt6Bnw}{jy1_1dpHToOxN2CCtH5ztw}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=8589934592, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {VhQno38}{VhQno38hQfO03l3Sxt6Bnw}{jy1_1dpHToOxN2CCtH5ztw}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=8589934592, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]])
[2018-10-17T10:04:33,473][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [VhQno38] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2018-10-17T10:04:33,474][INFO ][o.e.n.Node ] [VhQno38] started
[2018-10-17T10:04:33,482][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [VhQno38] Failed to clear cache for realms [[]]
[2018-10-17T10:04:33,536][INFO ][o.e.g.GatewayService ] [VhQno38] recovered [0] indices into cluster_state
[2018-10-17T10:04:33,699][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2018-10-17T10:04:33,721][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.watches] for index patterns [.watches*]
[2018-10-17T10:04:33,774][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2018-10-17T10:04:33,807][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
[2018-10-17T10:04:33,870][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
[2018-10-17T10:04:33,893][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
[2018-10-17T10:04:33,912][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
[2018-10-17T10:04:33,932][INFO ][o.e.c.m.MetaDataIndexTemplateService] [VhQno38] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
[2018-10-17T10:04:34,025][INFO ][o.e.l.LicenseService ] [VhQno38] license [b8e36ec7-af24-44d2-8e35-2a8c543c8aaf] mode [basic] - valid

当看到组件 started 后,代表elasticsearch已经成功启动。

1
[2018-10-17T10:04:33,474][INFO ][o.e.n.Node               ] [VhQno38] started