Elasticsearch
Problem
I needed a newer version of Elasticsearch [1] after an upgrade to mediawiki 1.43 and bluntly followed the instructions for that. It appeared I upgraded the software from version 6.8. to 8.17 and that is not supported. Consequently it refused to start. In the logs it report:
Caused by: org.elasticsearch.gateway.CorruptStateException: Format version is not supported. Upgrading to \[8.17.1\] is only supported from version \[7.17.0\].
Results from duckduckgo[2] told me downgrading is not possible. That may be true from a running version, mine has never run on v8, I managed to downgrade to v7 like this.
Configure apt to have the 7.x repository
cd /etc/apt/sources.list.d echo deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main > elastic-7.x.list apt install elasticsearch=7.17.26
This puts the software back, starting is not possible due to configuration issues. Restore /etc/elasticsearch from a backup.
Still no luck the logfile has:
[ERROR][o.e.b.Bootstrap ] [elast] node validation exception [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. bootstrap check failure [1] of [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
In /etc/elasticsearch/elasticsearch.yml I added
cluster.initial_master_nodes: ["IP of my node"]
Note that I run a single elasticsearch server only I guess this would work for other configuration too but did not test that
Now it starts.
Make sure to have the v8 repository in /etc/apt/sources.list.d and an upgrade to that is possible:
apt update apt full-upgrade
Unfortunately now it again does not start as:
java.lang.IllegalStateException: Cannot start this node because it holds metadata for indices with version [6.8.23] with which this node of version [8.17.1] is incompatible. Revert this node to version [7.17.27] and delete any indices with versions earlier than [7.0.0] before upgrading to version [8.17.1]. If all such indices have already been deleted, revert this node to version [7.17.27] and wait for it to join the cluster to clean up any older indices from its metadata.
As mediawiki Cirrussearch[3] is working I decided to stay on v7 for now.
Fixing it
Trying to clear the entire database for a fresh start after the upgrade to version 8
- Remove everytrhing under /var/lib/elasticsearch
- In /etc/elasticsearch/elasticsearch.yml add
_aliases?pretty=true
Now elasticsearch start with a number of error messages, the search continues.
Some endpoints on http://<server>:9200
- /
- Version information
- /_alliases
- All available indices
- /<indexname>