After rebooting elasticsearch, I am now unable to restore it into a working state. Below are my startup logs, mostly to depict versions and JVM arguments.
What I'm seeing is the following:
-
as I restart elasticsearch,
-
elasticsearch shows all indexes as red and begins to recover,
curl 'http://localhost:9200/_cat/indices?v' health status index uuid pri rep docs.count docs.deleted store.size pri.store.size red open logstash-2017.12.07 ISsPMF-BS_-1XmbWblF6rQ 5 1 2582599 0 1.3gb 1.3gb red open logstash-2017.12.05 B6LD_FX2QmOjF2u32Hp-vg 5 1 red open logstash-2017.12.06 dTwfnFjmQY2OFwlLo-ADuw 5 1 906000 0 374.5mb 374.5mb red open .kibana YSrJaSkXQFifLErsBsq66Q 1 1
-
a few minutes into the recovery process, a Java error appears:
[2017-12-07T14:26:40,233][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [elasticsearch- logging-0] fatal error in thread [Thread-42], exiting java.lang.OutOfMemoryError: Java heap space ... huge stacktrack here, omitted for brevity ...
Then elasticsearch restarts and everything repeats over again (begin recovery, move along, catch java exception).
How can I fix this?
Random thoughts:
- my elasticsearch setup is about storing logs,
- I'm not interested in full-text search of my logs. I'm using elastcisearch/kibana to store & perform key/value search deelpy ("my_json.key.another_key.another_deep_key=some_value") inside json documents.
- shortly before the first elasticsearch crash, I had a spike in traffic to elasticsearch: a misconfigured log agent would go crazy and send tons of unnecessary logs.
- in particular,
logstash-2017.12.07
index grew to several gigabytes, while normally the daily index size is roughly 800 megabytes.
Naive ideas so far:
- try to increase the RAM cap for elasticsearch – is there an evidence this will help?,
- lower the amount of memory elasticsearch can use at a time (?) – this would probably increase the time to restore, but at least should not raise Java exception?,
- try to clean up unusually big index, by removing spammy logs from it – is this feasible? if yes, how?
- try to tune whatever Java or Elasticsearch tunable to aid this – this is a new territory for me, so any advice is hugely appreciated.
P. S. For what it's worth, I'm running an elasticsearch in Kubernetes.
Here's the startup log:
+ export NODE_NAME=elasticsearch-logging-0
+ NODE_NAME=elasticsearch-logging-0
+ export NODE_MASTER=true
+ NODE_MASTER=true
+ export NODE_DATA=true
+ NODE_DATA=true
+ export HTTP_PORT=9200
+ HTTP_PORT=9200
+ export TRANSPORT_PORT=9300
+ TRANSPORT_PORT=9300
+ export MINIMUM_MASTER_NODES=1
+ MINIMUM_MASTER_NODES=1
+ chown -R elasticsearch:elasticsearch /data
+ ./bin/elasticsearch_logging_discovery
+ exec su elasticsearch -c ./bin/es-docker
[2017-12-07T14:20:24,415][INFO ][o.e.n.Node ] [elasticsearch-logging-0] initializing ...
[2017-12-07T14:20:24,681][INFO ][o.e.e.NodeEnvironment ] [elasticsearch-logging-0] using [1] data paths, mounts [[/data (/dev/sdj)]], net usable_space [36.6gb], net total_space [48.9gb], spins? [possibly], types [ext4]
[2017-12-07T14:20:24,681][INFO ][o.e.e.NodeEnvironment ] [elasticsearch-logging-0] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-12-07T14:20:24,700][INFO ][o.e.n.Node ] [elasticsearch-logging-0] node name [elasticsearch-logging-0], node ID [EtmvkcJ3SA-Toa8P0qcAjA]
[2017-12-07T14:20:24,700][INFO ][o.e.n.Node ] [elasticsearch-logging-0] version[5.6.2], pid[16], build[57e20f3/2017-09-23T13:16:45.703Z], OS[Linux/4.4.64+/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_141/25.141-b16]
[2017-12-07T14:20:24,700][INFO ][o.e.n.Node ] [elasticsearch-logging-0] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch]
[2017-12-07T14:20:29,110][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [aggs-matrix-stats]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [ingest-common]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [lang-expression]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [lang-groovy]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [lang-mustache]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [lang-painless]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [parent-join]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [percolator]
[2017-12-07T14:20:29,111][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [reindex]
[2017-12-07T14:20:29,112][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [transport-netty3]
[2017-12-07T14:20:29,112][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded module [transport-netty4]
[2017-12-07T14:20:29,112][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded plugin [ingest-geoip]
[2017-12-07T14:20:29,112][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded plugin [ingest-user-agent]
[2017-12-07T14:20:29,112][INFO ][o.e.p.PluginsService ] [elasticsearch-logging-0] loaded plugin [x-pack]
[2017-12-07T14:20:36,218][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/65] [Main.cc@128] controller (64 bit): Version 5.6.2 (Build 228329870d1c63) Copyright (c) 2017 Elasticsearch BV
[2017-12-07T14:20:36,225][INFO ][o.e.d.DiscoveryModule ] [elasticsearch-logging-0] using discovery type [zen]
[2017-12-07T14:20:38,405][INFO ][o.e.n.Node ] [elasticsearch-logging-0] initialized
[2017-12-07T14:20:38,405][INFO ][o.e.n.Node ] [elasticsearch-logging-0] starting ...
[2017-12-07T14:20:38,814][INFO ][o.e.t.TransportService ] [elasticsearch-logging-0] publish_address {10.0.2.25:9300}, bound_addresses {[::]:9300}