When you install and run Elasticsearch or OpenSearch on FreeBSD you might find that after a few days your root volume starts to get full. This is caused by temporary files that are created by each of those search engines in the system's temporary directory.
Change the Path
One easy way to solve this problem is to tell Elasticsearch or OpenSearch to move the temporary directory to an alternate volume. I personally use a dedicated ZFS pool for my Elasticsearch/Opensearch data. We can have both Elasticsearch and OpenSearch write it's temporary files there instead by setting an environmental variable. I've tested this procedure on FreeBSD 12.x and 13.x
The variable is set using /etc/rc.conf. Run the following command to configure it:
sysrc elasticsearch_env="ES_TMPDIR=/var/db/elasticsearch/tmp"
sysrc opensearch_env="OPENSEARCH_TMPDIR=/var/db/opensearch/tmp"
Replace the paths above with your desired location. I'm using "/var/db/opensearch/tmp" or "/var/db/elasticsearch/tmp".
Then create the directory and set the correct permission
install -d -o elasticsearch -g elasticsearch /var/db/opensearch/tmp
install -d -o opensearch -g opensearch /var/db/opensearch/tmp
The restart the service:
service elasticsearch restart
service opensearch restart
- Log in to post comments