When I first tried to deploy Elasticsearch, I got stuck at
a bug. So, I restored from backup to get a clean system again. I tried again after a few days and it worked then.
Memory requirements: You should have 8GB of RAM. When I had 4GB, the Out Of Memory Manager kept killing the elasticsearch process. Also, if sidekiq complains about Faraday connection lost, it's elasticsearch down. You can check what the problem is with "systemctl status elasticsearch". Test with "live/bin/tootctl search deploy".
Follow the
documentation on joimastodon.org to get elasticsearch running.
There's no documentation on how to use a username & password in Mastodon for accessing Elasticsearch, but I managed to configure some basic security.
First, find the Elasticsearch configuration file:
find / -name elasticsearch.yml
Then edit the file and add the following lines:
discovery.type: single-node
xpack.security.enabled: true
Generate the passwords following the guide at
Set up minimal security for Elasticsearch (replace the version number in the link with your Elasticsearch version).
Then configure live/.env.production with:
ES_ENABLED true
ES_HOST my.instance.host.tld
ES_PASS somethingsafe
ES_PORT 9200
ES_USER elastic
Restart the service with
sudo systemctl restart elasticsearch and then test the setup with
live/bin/tootctl search deploy --only tags
Edit the
elasticsearch.yml file again and add this entry:
xpack.security.authc:
anonymous:
username: anonymous_user
roles: superuser
authz_exception: true
If you are running a cluster rather than just a local installation, refer to
Secure the Elastic Stack. I'm not running a cluster, so I have no experience to share about this.