如何在您的開發/生產環境中安裝和配置 Elasticsearch?
已發表: 2019-12-29 在本教程中,我們將介紹如何為您的開發和生產環境安裝和配置Elasticsearch
。
什麼是彈性搜索?
世界上最好的搜索和分析引擎之一。 Elasticsearch 是一個分佈式的、基於 JSON 的引擎,專為水平scalability
、最大reliability
和易於管理而設計。
彈性搜索集中存儲您的數據,以便您發現預期並發現意外。 您可以通過 Filebeat 將所有日誌發送到 ElasticSearch,並立即可視化指標。
如果您有以下任何問題,那麼您來對地方了:
- 如何在 Ubuntu 16.04 上安裝和配置 Elasticsearch
- Elasticsearch 設置和配置
- 安裝和配置 Elasticsearch
- 如何安裝和配置遠程 Elasticsearch 實例
步驟 1) 安裝 Elasticsearch
以下是在 Linux/Ubuntu 操作系統上安裝 Elasticsearch 的幾個簡單命令。
1 2 3 4 5 6 7 8 9 |
bash - 3.2 $ wget https : //artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz bash - 3.2 $ wget https : //artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz.sha512 bash - 3.2 $ shasum - a 512 - c elasticsearch - 6.7.0.tar.gz.sha512 bash - 3.2 $ tar - xzf elasticsearch - 6.7.0.tar.gz bash - 3.2 $ cd elasticsearch - 6.7.0 / |
就是這樣。 這是安裝日誌。
安裝日誌:
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
crunch@localhost:/$ cd tmp/ crunch@localhost:/tmp$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz --2019-03-30 14:41:25-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz Resolving artifacts.elastic.co (artifacts.elastic.co)... 2a04:4e42:a::734, 151.101.42.222 Connecting to artifacts.elastic.co (artifacts.elastic.co)|2a04:4e42:a::734|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 149006122 (142M) [application/x-gzip] Saving to: ‘elasticsearch-6.7.0.tar.gz’ elasticsearch-6.7.0.tar.gz 100%[=========================================================================>] 142.10M 215MB/s in 0.7s 2019-03-30 14:41:26 (215 MB/s) - ‘elasticsearch-6.7.0.tar.gz’ saved [149006122/149006122] crunch@localhost:/tmp$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz.sha512 --2019-03-30 14:41:26-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz.sha512 Resolving artifacts.elastic.co (artifacts.elastic.co)... 2a04:4e42:a::734, 151.101.42.222 Connecting to artifacts.elastic.co (artifacts.elastic.co)|2a04:4e42:a::734|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 156 [application/octet-stream] Saving to: ‘elasticsearch-6.7.0.tar.gz.sha512’ elasticsearch-6.7.0.tar.gz.sha512 100%[=========================================================================>] 156 --.-KB/s in 0s 2019-03-30 14:41:26 (24.2 MB/s) - ‘elasticsearch-6.7.0.tar.gz.sha512’ saved [156/156] crunch@localhost:/tmp$ shasum -a 512 -c elasticsearch-6.7.0.tar.gz.sha512 elasticsearch-6.7.0.tar.gz: OK crunch@localhost:/tmp$ tar -xzf elasticsearch-6.7.0.tar.gz crunch@localhost:/tmp$ cd elasticsearch-6.7.0/ crunch@localhost:/tmp/elasticsearch-6.7.0$ ./bin/elasticsearch warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=1 [2019-03-30T14:42:15,073][INFO ][o.e.e.NodeEnvironment ] [ZKsMkES] using [1] data paths, mounts [[/ (/dev/sda)]], net usable_space [69.8gb], net total_space [78.2gb], types [ext4] [2019-03-30T14:42:15,079][INFO ][o.e.e.NodeEnvironment ] [ZKsMkES] heap size [1007.3mb], compressed ordinary object pointers [true] [2019-03-30T14:42:15,084][INFO ][o.e.n.Node ] [ZKsMkES] node name derived from node ID [ZKsMkESwRL27iYEKUaBluQ]; set [node.name] to override [2019-03-30T14:42:15,084][INFO ][o.e.n.Node ] [ZKsMkES] version[6.7.0], pid[20094], build[default/tar/8453f77/2019-03-21T15:32:29.844721Z], OS[Linux/4.18.0-13-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.1/11.0.1+13-Ubuntu-3ubuntu3.18.10.1] [2019-03-30T14:42:15,084][INFO ][o.e.n.Node ] [ZKsMkES] 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=/tmp/elasticsearch-6051013812527326393, -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, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.path.home=/tmp/elasticsearch-6.7.0, -Des.path.conf=/tmp/elasticsearch-6.7.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar] [2019-03-30T14:42:17,459][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [aggs-matrix-stats] [2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [analysis-common] [2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [ingest-common] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [ingest-geoip] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [ingest-user-agent] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [lang-expression] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [lang-mustache] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [lang-painless] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [mapper-extras] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [parent-join] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [percolator] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [rank-eval] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [reindex] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [repository-url] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [transport-netty4] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [tribe] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-ccr] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-core] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-deprecation] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-graph] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-ilm] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-logstash] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-ml] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-monitoring] [2019-03-30T14:42:17,496][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-rollup] [2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-security] [2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-sql] [2019-03-30T14:42:17,498][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-upgrade] [2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-watcher] [2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService ] [ZKsMkES] no plugins loaded [2019-03-30T14:42:22,899][INFO ][o.e.x.s.a.s.FileRolesStore] [ZKsMkES] parsed [0] roles from file [/tmp/elasticsearch-6.7.0/config/roles.yml] [2019-03-30T14:42:24,035][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [ZKsMkES] [controller/20173] [Main.cc@109] controller (64 bit): Version 6.7.0 (Build d74ae2ac01b10d) Copyright (c) 2019 Elasticsearch BV [2019-03-30T14:42:24,565][DEBUG][o.e.a.ActionModule ] [ZKsMkES] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security [2019-03-30T14:42:24,896][INFO ][o.e.d.DiscoveryModule ] [ZKsMkES] using discovery type [zen] and host providers [settings] [2019-03-30T14:42:25,908][INFO ][o.e.n.Node ] [ZKsMkES] initialized [2019-03-30T14:42:25,908][INFO ][o.e.n.Node ] [ZKsMkES] starting ... [2019-03-30T14:42:26,087][INFO ][o.e.t.TransportService ] [ZKsMkES] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300} [2019-03-30T14:42:26,128][WARN ][o.e.b.BootstrapChecks ] [ZKsMkES] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] [2019-03-30T14:42:29,217][INFO ][o.e.c.s.MasterService ] [ZKsMkES] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} [2019-03-30T14:42:29,226][INFO ][o.e.c.s.ClusterApplierService] [ZKsMkES] new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]]) [2019-03-30T14:42:29,315][INFO ][o.e.h.n.Netty4HttpServerTransport] [ZKsMkES] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200} [2019-03-30T14:42:29,316][INFO ][o.e.n.Node ] [ZKsMkES] started [2019-03-30T14:42:29,322][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [ZKsMkES] Failed to clear cache for realms [[]] [2019-03-30T14:42:29,404][INFO ][o.e.g.GatewayService ] [ZKsMkES] recovered [0] indices into cluster_state [2019-03-30T14:42:29,692][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watches] for index patterns [.watches*] [2019-03-30T14:42:29,730][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.triggered_watches] for index patterns [.triggered_watches*] [2019-03-30T14:42:29,783][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watch-history-9] for index patterns [.watcher-history-9*] [2019-03-30T14:42:29,818][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*] [2019-03-30T14:42:29,866][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*] [2019-03-30T14:42:29,892][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6] [2019-03-30T14:42:29,957][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*] [2019-03-30T14:42:29,991][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*] [2019-03-30T14:42:30,116][INFO ][o.e.l.LicenseService ] [ZKsMkES] license [319113dd-7fb5-4ae5-8355-e2c7458b1532] mode [basic] - valid |
Step-2) 啟動 Elasticsearch 進程
您需要確保 JAVA_HOME 設置正確。
1 2 3 |
crunch @ localhost : / usr / lib / jvm / java - 11 - openjdk - amd64 / bin $ export JAVA_HOME =/ usr / lib / jvm / java - 11 - openjdk - amd64 / bin / crunch @ localhost : / usr / lib / jvm / java - 11 - openjdk - amd64 / bin $ echo $ JAVA_HOME / usr / lib / jvm / java - 11 - openjdk - amd64 / bin / |
啟動 ElasticSearch 進程命令:
1 |
. / bin / elasticsearch |
確保您需要使用normal user
啟動 Elastic Search。 ElasticSearch 不會以root user
身份啟動,如果您嘗試以 root 用戶身份運行它,您將看到以下錯誤。
1 |
java . lang . RuntimeException : can not run elasticsearch as root |
按照本教程了解如何添加非 root 用戶和登錄。
這是控制台結果輸出:
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 56 57 58 59 60 61 62 63 |
crunch@localhost:/tmp/elasticsearch-6.7.0$ ./bin/elasticsearch warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=1 [2019-03-30T14:42:15,073][INFO ][o.e.e.NodeEnvironment ] [ZKsMkES] using [1] data paths, mounts [[/ (/dev/sda)]], net usable_space [69.8gb], net total_space [78.2gb], types [ext4] [2019-03-30T14:42:15,079][INFO ][o.e.e.NodeEnvironment ] [ZKsMkES] heap size [1007.3mb], compressed ordinary object pointers [true] [2019-03-30T14:42:15,084][INFO ][o.e.n.Node ] [ZKsMkES] node name derived from node ID [ZKsMkESwRL27iYEKUaBluQ]; set [node.name] to override [2019-03-30T14:42:15,084][INFO ][o.e.n.Node ] [ZKsMkES] version[6.7.0], pid[20094], build[default/tar/8453f77/2019-03-21T15:32:29.844721Z], OS[Linux/4.18.0-13-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.1/11.0.1+13-Ubuntu-3ubuntu3.18.10.1] [2019-03-30T14:42:15,084][INFO ][o.e.n.Node ] [ZKsMkES] 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=/tmp/elasticsearch-6051013812527326393, -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, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.path.home=/tmp/elasticsearch-6.7.0, -Des.path.conf=/tmp/elasticsearch-6.7.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar] [2019-03-30T14:42:17,459][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [aggs-matrix-stats] [2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [analysis-common] [2019-03-30T14:42:17,460][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [ingest-common] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [ingest-geoip] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [ingest-user-agent] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [lang-expression] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [lang-mustache] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [lang-painless] [2019-03-30T14:42:17,487][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [mapper-extras] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [parent-join] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [percolator] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [rank-eval] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [reindex] [2019-03-30T14:42:17,488][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [repository-url] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [transport-netty4] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [tribe] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-ccr] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-core] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-deprecation] [2019-03-30T14:42:17,489][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-graph] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-ilm] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-logstash] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-ml] [2019-03-30T14:42:17,490][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-monitoring] [2019-03-30T14:42:17,496][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-rollup] [2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-security] [2019-03-30T14:42:17,497][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-sql] [2019-03-30T14:42:17,498][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-upgrade] [2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService ] [ZKsMkES] loaded module [x-pack-watcher] [2019-03-30T14:42:17,499][INFO ][o.e.p.PluginsService ] [ZKsMkES] no plugins loaded [2019-03-30T14:42:22,899][INFO ][o.e.x.s.a.s.FileRolesStore] [ZKsMkES] parsed [0] roles from file [/tmp/elasticsearch-6.7.0/config/roles.yml] [2019-03-30T14:42:24,035][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [ZKsMkES] [controller/20173] [Main.cc@109] controller (64 bit): Version 6.7.0 (Build d74ae2ac01b10d) Copyright (c) 2019 Elasticsearch BV [2019-03-30T14:42:24,565][DEBUG][o.e.a.ActionModule ] [ZKsMkES] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security [2019-03-30T14:42:24,896][INFO ][o.e.d.DiscoveryModule ] [ZKsMkES] using discovery type [zen] and host providers [settings] [2019-03-30T14:42:25,908][INFO ][o.e.n.Node ] [ZKsMkES] initialized [2019-03-30T14:42:25,908][INFO ][o.e.n.Node ] [ZKsMkES] starting ... [2019-03-30T14:42:26,087][INFO ][o.e.t.TransportService ] [ZKsMkES] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300} [2019-03-30T14:42:26,128][WARN ][o.e.b.BootstrapChecks ] [ZKsMkES] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] [2019-03-30T14:42:29,217][INFO ][o.e.c.s.MasterService ] [ZKsMkES] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} [2019-03-30T14:42:29,226][INFO ][o.e.c.s.ClusterApplierService] [ZKsMkES] new_master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {ZKsMkES}{ZKsMkESwRL27iYEKUaBluQ}{YYShNSkJT7Ctc-LFBTrO8w}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=4136235008, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]]) [2019-03-30T14:42:29,315][INFO ][o.e.h.n.Netty4HttpServerTransport] [ZKsMkES] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200} [2019-03-30T14:42:29,316][INFO ][o.e.n.Node ] [ZKsMkES] started [2019-03-30T14:42:29,322][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [ZKsMkES] Failed to clear cache for realms [[]] [2019-03-30T14:42:29,404][INFO ][o.e.g.GatewayService ] [ZKsMkES] recovered [0] indices into cluster_state [2019-03-30T14:42:29,692][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watches] for index patterns [.watches*] [2019-03-30T14:42:29,730][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.triggered_watches] for index patterns [.triggered_watches*] [2019-03-30T14:42:29,783][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.watch-history-9] for index patterns [.watcher-history-9*] [2019-03-30T14:42:29,818][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*] [2019-03-30T14:42:29,866][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*] [2019-03-30T14:42:29,892][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6] [2019-03-30T14:42:29,957][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*] [2019-03-30T14:42:29,991][INFO ][o.e.c.m.MetaDataIndexTemplateService] [ZKsMkES] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*] [2019-03-30T14:42:30,116][INFO ][o.e.l.LicenseService ] [ZKsMkES] license [319113dd-7fb5-4ae5-8355-e2c7458b1532] mode [basic] - valid |

Step-3) 檢查 Elasticsearchprocess 進程
如何確保 Elasticsearch 正在運行?
command:
ps -few | grep 彈性
1 2 3 4 |
crunch @ localhost : / tmp / elasticsearch - 6.7.0 $ ps - few | grep elastic crunch 20305 1 99 14 : 46 pts / 0 00 : 00 : 28 / usr / bin / java - 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 =/ tmp / elasticsearch - 5628366226360196103 - 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 - Djava . locale . providers = COMPAT - XX : UseAVX = 2 - Des . path . home =/ tmp / elasticsearch - 6.7.0 - Des . path . conf =/ tmp / elasticsearch - 6.7.0 / config - Des . distribution . flavor = default - Des . distribution . type = tar - cp / tmp / elasticsearch - 6.7.0 / lib /* org . elasticsearch . bootstrap . Elasticsearch - d crunch 20320 20305 0 14 : 46 pts / 0 00 : 00 : 00 / tmp / elasticsearch - 6.7.0 / modules / x - pack - ml / platform / linux - x86_64 / bin / controller crunch 20362 20062 0 14 : 46 pts / 0 00 : 00 : 00 grep -- color = auto elastic |
而已。 你已經準備好運行 ElasticSearch。
默認 elasticsearch 啟動文件:
1 2 3 4 |
crunch @ localhost : / tmp / elasticsearch - 6.7.0 / bin $ pwd / tmp / elasticsearch - 6.7.0 / bin crunch @ localhost : / tmp / elasticsearch - 6.7.0 / bin $ vi 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 |
source "`dirname " $ 0 "`" / elasticsearch - env ES_JVM_OPTIONS = "$ES_PATH_CONF" / jvm . options JVM_OPTIONS = ` "$JAVA" - cp "$ES_CLASSPATH" org . elasticsearch . tools . launchers . JvmOptionsParser "$ES_JVM_OPTIONS" ` ES_JAVA_OPTS = "${JVM_OPTIONS//\$\{ES_TMPDIR\}/$ES_TMPDIR} $ES_JAVA_OPTS" cd "$ES_HOME" # manual parsing to find out, if process should be detached if ! echo $ * | grep - E '(^-d |-d$| -d |--daemonize$|--daemonize )' > / dev / null ; then exec \ "$JAVA" \ $ ES_JAVA_OPTS \ - Des . path . home = "$ES_HOME" \ - Des . path . conf = "$ES_PATH_CONF" \ - Des . distribution . flavor = "$ES_DISTRIBUTION_FLAVOR" \ - Des . distribution . type = "$ES_DISTRIBUTION_TYPE" \ - cp "$ES_CLASSPATH" \ org . elasticsearch . bootstrap . Elasticsearch \ "$@" else exec \ "$JAVA" \ $ ES_JAVA_OPTS \ - Des . path . home = "$ES_HOME" \ - Des . path . conf = "$ES_PATH_CONF" \ - Des . distribution . flavor = "$ES_DISTRIBUTION_FLAVOR" \ - Des . distribution . type = "$ES_DISTRIBUTION_TYPE" \ - cp "$ES_CLASSPATH" \ org . elasticsearch . bootstrap . Elasticsearch \ "$@" \ < &- & retval=$? pid=$! [ $retval -eq 0 ] || exit $retval if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then sleep $ ES_STARTUP_SLEEP_TIME fi if ! ps - p $ pid > / dev / null ; then exit 1 fi exit 0 fi exit $ ? |
下一步是什麼? 設置 Filebeat。
如何安裝和配置 Filebeat? 用於開發/生產環境的輕量級日誌轉發器