Skip to content

ElasticSearch

Jake Jarvis edited this page Dec 21, 2022 · 8 revisions

Installation

ElasticSearch 8.x was a huge headache — stick with 7.x.

curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | gpg --dearmor -o /usr/share/keyrings/elastic.gpg
echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list

apt update
apt install openjdk-17-jre-headless elasticsearch

# configure as shown below

systemctl daemon-reload
systemctl enable --now elasticsearch
systemctl restart mastodon-web mastodon-sidekiq

cd /home/mastodon/live
sudo -u mastodon RAILS_ENV=production bin/tootctl search deploy

Config

/home/mastodon/live/.env.production

ES_ENABLED=true
ES_HOST=localhost
ES_PORT=9200

/etc/elasticsearch/jvm.options.d/heap-size.options

# conservative reserve for 8GB of RAM
-Xms1g
-Xmx1g

/etc/elasticsearch/elasticsearch.yml

path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
http.port: 9200

# shuts up constant warning logs about security (N/A because of strict firewall)
xpack.security.enabled: false
Clone this wiki locally