Commit e1b9ca11 authored by Nico Boyce's avatar Nico Boyce

Update elasticsearch.md

parent 18acd3f1
Pipeline #567 passed with stages
in 17 seconds
......@@ -6,12 +6,12 @@ The following guide explains how to use [Elasticsearch](https://www.elastic.co/p
Why you might need Elasticsearch
----
If you want to use Full-text search, you should setup Elasticsearch.
If you wish to enable full-text searching of, for example, a users own timeline or mentions, Elastisearch is the tool you want.
Installing Pre-required dependency
----
Elasticsearch is built using Java, and requires at least Java 8 in order to run.
Elasticsearch requires at least Java 8 in order to run.
Install Java 8:
......@@ -19,9 +19,9 @@ Install Java 8:
sudo apt install openjdk-8-jre-headless
```
> The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
> The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk (Java Development Kit) package.
You need to install the `apt-transport-https`.
If your version of APT is not at least 1.5, you need to install `apt-transport-https` for secure access to the Elasticsearch repository.
```bash
sudo apt install apt-transport-https
......@@ -33,6 +33,7 @@ Installing Elasticsearch
### Import the Elasticsearch PGP Keyedit
Download and install the public signing key:
```bash
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
```
......@@ -62,7 +63,7 @@ Start Elasticsearch:
sudo systemctl start elasticsearch
```
If you want to check Elasticsearch status, run the following commands:
If you want to check the status of Elasticsearch:
```bash
sudo systemctl status elasticsearch
......@@ -94,16 +95,11 @@ You now need to restart Mastodon.
***If you can't start Elasticsearch, It's probable that the allocated memory is insufficient.***
|RAM 1GB|RAM 4GB|
|:--:|:--:|
|![Elasticsearch-Guide-1GB](../images/Elasticsearch-Guide-1GB-status.png)|![Elasticsearch-Guide-4GB](../images/Elasticsearch-Guide-4GB-status.png)|
This guide may be useful if you can't start Elasticsearch, or if Elasticsearch uses too much memory.
First, Elasticsearch needs a lot of memory.
Elasticsearch can require substantial memory.
You should check [this page](https://www.elastic.co/guide/en/elasticsearch/guide/current/hardware.html).
But, as far as I can recollect, Mastodon does not require much memory for Elasticsearch.
When building Elasticsearch server on low memory VPS, It's necessary to change the configuration.
Change these lines in `/etc/elasticsearch/jvm.options`:
......@@ -116,38 +112,21 @@ Change these lines in `/etc/elasticsearch/jvm.options`:
-Xmx1g
```
#### Note: Are you worried about how much memory configuration need on your VPS? This list may be useful! In my opinion, It would be better to set it from 35% to 50% of the total memory.
|Memory|Xms|Xmx|
|:--:|:--:|:--:|
|1GB|256m|256m|
|2GB|512m|512m|
|3GB|1g|1g|
|4GB|2g|2g|
|RAM 1GB|RAM 4GB|
|:--:|:--:|
|![Elasticsearch-Guide-1GB](../images/Elasticsearch-Guide-1GB-htop.png)|![Elasticsearch-Guide-4GB](../images/Elasticsearch-Guide-4GB-htop.png)|
***Please don't forget! This isn't necessarily the best configuration.***
#### Warning: The memory in this list is for Elasticsearch. It's not the total memory of the VPS.
After changing any of these settings, start Elasticsearch:
```bash
sudo systemctl start elasticsearch
systemctl start elasticsearch
```
And check Elasticsearch status:
```bash
sudo systemctl status elasticsearch
systemctl status elasticsearch
```
#### Note: You can also configure Mastodon to use Elasticsearch on a different server.
If you want to use an Elasticsearch instance running on a different server, just include its address in `.env.production`
If you want to use an Elasticsearch instance running on a different server, include its address in `.env.production`
```
# Optional ElasticSearch configuration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment