1、Elasticsearch7.2.1版本启动报错
1 [elsearch@localhost elasticsearch-7.2.1]$ ./bin/elasticsearch
2 OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
3 [2021-08-12T18:38:53,338][INFO ][o.e.e.NodeEnvironment ] [localhost.localdomain] using [1] data paths, mounts [[/ (/dev/sda3)]], net usable_space [30gb], net total_space [37.6gb], types [xfs]
4 [2021-08-12T18:38:53,354][INFO ][o.e.e.NodeEnvironment ] [localhost.localdomain] heap size [990.7mb], compressed ordinary object pointers [true]
5 [2021-08-12T18:38:53,373][INFO ][o.e.n.Node ] [localhost.localdomain] node name [localhost.localdomain], node ID [jLtJ3zHOTJ61FW_nyfKoUg], cluster name [elasticsearch]
6 [2021-08-12T18:38:53,377][INFO ][o.e.n.Node ] [localhost.localdomain] version[7.2.1], pid[2052], build[default/tar/fe6cb20/2019-07-24T17:58:29.979462Z], OS[Linux/3.10.0-1160.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/12.0.1/12.0.1+12]
7 [2021-08-12T18:38:53,381][INFO ][o.e.n.Node ] [localhost.localdomain] JVM home [/data/elasticsearch-7.2.1/jdk]
8 [2021-08-12T18:38:53,384][INFO ][o.e.n.Node ] [localhost.localdomain] 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-1614378231614604452, -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, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/data/elasticsearch-7.2.1, -Des.path.conf=/data/elasticsearch-7.2.1/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
9 [2021-08-12T18:38:58,232][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [aggs-matrix-stats]
10 [2021-08-12T18:38:58,233][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [analysis-common]
11 [2021-08-12T18:38:58,234][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [data-frame]
12 [2021-08-12T18:38:58,235][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [ingest-common]
13 [2021-08-12T18:38:58,235][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [ingest-geoip]
14 [2021-08-12T18:38:58,236][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [ingest-user-agent]
15 [2021-08-12T18:38:58,236][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [lang-expression]
16 [2021-08-12T18:38:58,238][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [lang-mustache]
17 [2021-08-12T18:38:58,239][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [lang-painless]
18 [2021-08-12T18:38:58,239][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [mapper-extras]
19 [2021-08-12T18:38:58,240][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [parent-join]
20 [2021-08-12T18:38:58,241][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [percolator]
21 [2021-08-12T18:38:58,241][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [rank-eval]
22 [2021-08-12T18:38:58,242][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [reindex]
23 [2021-08-12T18:38:58,243][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [repository-url]
24 [2021-08-12T18:38:58,244][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [transport-netty4]
25 [2021-08-12T18:38:58,246][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-ccr]
26 [2021-08-12T18:38:58,247][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-core]
27 [2021-08-12T18:38:58,247][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-deprecation]
28 [2021-08-12T18:38:58,248][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-graph]
29 [2021-08-12T18:38:58,249][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-ilm]
30 [2021-08-12T18:38:58,250][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-logstash]
31 [2021-08-12T18:38:58,252][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-ml]
32 [2021-08-12T18:38:58,253][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-monitoring]
33 [2021-08-12T18:38:58,254][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-rollup]
34 [2021-08-12T18:38:58,255][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-security]
35 [2021-08-12T18:38:58,257][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-sql]
36 [2021-08-12T18:38:58,258][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [x-pack-watcher]
37 [2021-08-12T18:38:58,263][INFO ][o.e.p.PluginsService ] [localhost.localdomain] no plugins loaded
38 [2021-08-12T18:39:07,821][INFO ][o.e.x.s.a.s.FileRolesStore] [localhost.localdomain] parsed [0] roles from file [/data/elasticsearch-7.2.1/config/roles.yml]
39 [2021-08-12T18:39:09,377][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [localhost.localdomain] [controller/2147] [Main.cc@110] controller (64 bit): Version 7.2.1 (Build 4ad685337be7fd) Copyright (c) 2019 Elasticsearch BV
40 [2021-08-12T18:39:10,940][DEBUG][o.e.a.ActionModule ] [localhost.localdomain] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
41 [2021-08-12T18:39:12,066][INFO ][o.e.d.DiscoveryModule ] [localhost.localdomain] using discovery type [zen] and seed hosts providers [settings]
42 [2021-08-12T18:39:14,806][INFO ][o.e.n.Node ] [localhost.localdomain] initialized
43 [2021-08-12T18:39:14,807][INFO ][o.e.n.Node ] [localhost.localdomain] starting ...
44 [2021-08-12T18:39:15,273][INFO ][o.e.t.TransportService ] [localhost.localdomain] publish_address {192.168.110.133:9300}, bound_addresses {[::]:9300}
45 [2021-08-12T18:39:15,306][INFO ][o.e.b.BootstrapChecks ] [localhost.localdomain] bound or publishing to a non-loopback address, enforcing bootstrap checks
46 ERROR: [1] bootstrap checks failed
47 [1]: 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
48 [2021-08-12T18:39:15,390][INFO ][o.e.n.Node ] [localhost.localdomain] stopping ...
49 [2021-08-12T18:39:15,463][INFO ][o.e.n.Node ] [localhost.localdomain] stopped
50 [2021-08-12T18:39:15,464][INFO ][o.e.n.Node ] [localhost.localdomain] closing ...
51 [2021-08-12T18:39:15,517][INFO ][o.e.n.Node ] [localhost.localdomain] closed
52 [2021-08-12T18:39:15,522][INFO ][o.e.x.m.p.NativeController] [localhost.localdomain] Native controller process has stopped - no new native processes can be started
53 [elsearch@localhost elasticsearch-7.2.1]$
2、解决方法,如下所示:
看报错提示可知:缺少默认配置,至少需要配置discovery.seed_hosts、discovery.seed_providers、cluster.initial_master_nodes中的一个参数,解释,如下所示:
1 discovery.seed_hosts: 集群主机列表
2 discovery.seed_providers: 基于配置文件配置集群主机列表
3 cluster.initial_master_nodes: 启动时初始化的参与选主的node,生产环境必填
具体,配置,如下所示:
1 # --------------------------------- Discovery ----------------------------------
2 #
3 # Pass an initial list of hosts to perform discovery when this node is started:
4 # The default list of hosts is ["127.0.0.1", "[::1]"]
5 #
6 #discovery.seed_hosts: ["host1", "host2"]
7 discovery.seed_hosts: ["192.168.110.133"]
8 #
9 # Bootstrap the cluster using an initial set of master-eligible nodes:
10 #
11 #cluster.initial_master_nodes: ["node-1", "node-2"]
12 cluster.initial_master_nodes: ["master"]
13 #
14 # For more information, consult the discovery and cluster formation module documentation.
15 #