Elasticsearch: Difference between revisions

From DWIKI
Tony (talk | contribs)
Tag: wikieditor
Tony (talk | contribs)
Tag: wikieditor
 
(5 intermediate revisions by the same user not shown)
Line 6: Line 6:
==Configuration==
==Configuration==
*http://jprante.github.io/2012/11/28/Elasticsearch-Java-Virtual-Machine-settings-explained.html
*http://jprante.github.io/2012/11/28/Elasticsearch-Java-Virtual-Machine-settings-explained.html
===elasticsearch.yml===
====network.host====
Takes settings as documented in https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#network-interface-values
==Heap==
==Heap==
*https://www.elastic.co/blog/a-heap-of-trouble
*https://www.elastic.co/blog/a-heap-of-trouble
Line 18: Line 24:
*Old GC is processed quickly (within 1 second).
*Old GC is processed quickly (within 1 second).
*Old GC is not frequently executed (once per 10 minutes or more).
*Old GC is not frequently executed (once per 10 minutes or more).
==Upgrading Elasticsearch==
*[https://www.elastic.co/docs/deploy-manage/upgrade Upgrade your deployment, cluster, or orchestrator]


=HOWTO=
=HOWTO=
Line 29: Line 39:
==Start elasticsearch in safe mode==
==Start elasticsearch in safe mode==
  su -s /bin/bash elasticsearch -c "usr/share/elasticsearch/bin/elasticsearch -E node.ingest=false -E node.master=false -E node.data=false"
  su -s /bin/bash elasticsearch -c "usr/share/elasticsearch/bin/elasticsearch -E node.ingest=false -E node.master=false -E node.data=false"
==View contents==
curl -H 'Content-Type: application/json' -X GET http://localhost:9200/next_index/_search?pretty


=Monitoring elasticsearch=
=Monitoring elasticsearch=
Line 76: Line 89:
  /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment
  /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment


==low disk watermark [85%] exceeded==
Change cluster.routing.allocation.disk.watermark.low or make room


==Get version of active elasticsearch==
==Get version of active elasticsearch==
Line 81: Line 96:
or  
or  
  wget -q -O - http://localhost:9200/_cluster/stats | sed 's/^.*versions\":\[\"\(.*\)\"\].*$/\1\n/g'
  wget -q -O - http://localhost:9200/_cluster/stats | sed 's/^.*versions\":\[\"\(.*\)\"\].*$/\1\n/g'
==Error messages==
===org.elasticsearch.ElasticsearchException: Failed to bind service===
?
==Elasticsearch doesn't get restarted after apt upgrade==
Check
RESTART_ON_UPGRADE
in /etc/default/elasticsearch

Latest revision as of 11:23, 17 November 2025

Links

Documentation

Configuration


elasticsearch.yml

network.host

Takes settings as documented in https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#network-interface-values

Heap

Garbage collection

Ideally:

  • Young GC is processed quickly (within 50 ms).
  • Young GC is not frequently executed (about 10 seconds).
  • Old GC is processed quickly (within 1 second).
  • Old GC is not frequently executed (once per 10 minutes or more).


Upgrading Elasticsearch

HOWTO

Adjust log rotation

Is done in /etc/elasticsearch/log4j.properties

Number of logfiles to keep

appender.rolling.strategy.max


Start elasticsearch in safe mode

su -s /bin/bash elasticsearch -c "usr/share/elasticsearch/bin/elasticsearch -E node.ingest=false -E node.master=false -E node.data=false"

View contents

curl -H 'Content-Type: application/json' -X GET http://localhost:9200/next_index/_search?pretty

Monitoring elasticsearch

Things to monitor

heap size

  • node jvm.mem.heap_used_percent

garbage collection

Something like

node.jvm.uptime_in_millis/node.jvm.gc.collectors.young.collection_count

Query the web interface

Installing Elasticsearch

On Debian

deb https://artifacts.elastic.co/packages/oss-6.x/apt stable main

packages is called elasticsearch-oss now?

Terminology

shards

"blocks" of index data distributed over the nodes

Percolation

https://spinscale.de/posts/2021-09-15-understanding-elasticsearch-percolate-query.html


now throttling indexing for shard: segment writing can't keep up

FAQ

Status is yellow

and look for unassigned shards

Update ingest-attachment

/usr/share/elasticsearch/bin/elasticsearch-plugin remove ingest-attachment
/usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

low disk watermark [85%] exceeded

Change cluster.routing.allocation.disk.watermark.low or make room

Get version of active elasticsearch

wget -q -O - http://localhost:9200/_cluster/stats

or

wget -q -O - http://localhost:9200/_cluster/stats | sed 's/^.*versions\":\[\"\(.*\)\"\].*$/\1\n/g'


Error messages

org.elasticsearch.ElasticsearchException: Failed to bind service

?


Elasticsearch doesn't get restarted after apt upgrade

Check

RESTART_ON_UPGRADE

in /etc/default/elasticsearch