$OpenBSD: README,v 1.9 2020/05/19 08:33:55 bentley Exp $

+-----------------------------------------------------------------------
| Running elasticsearch on OpenBSD
+-----------------------------------------------------------------------

OpenBSD-specific Limitations
============================
1. OpenBSD is not on the list of supported platforms:
https://www.elastic.co/support/matrix

Initial Node/Cluster Configuration
==================================
Configuration files are located in /etc/elasticsearch

By default, elasticsearch binds to localhost addresses. Since OpenBSD does not
support IPv4 to IPv6 address mapping, either IPv4 or IPv6 can be used, but not
both of them (see JDK/JRE package README for more details).

Thus by default elasticsearch will bind to 127.0.0.1 and will not be useful
for anything except testing.

After configuring network.host to non-default localhost address, elasticsearch
will assume it's in "production" mode and will enforce bootstrap checks, one
of which is the limit for maximum number of open file descriptors (openfiles).

Resource Limits: File Descriptors
=================================
The minimum number of openfiles required for production Elasticsearch node
is 65536. Elasticsearch will not start if openfiles limit is lower than this.

OpenBSD's defaults are very conservative in allocation of system resources.
In order to run Elasticsearch, the following steps required:

1. Adjust kern.maxfiles:

	# sysctl kern.maxfiles=65536
	# echo "kern.maxfiles=65536" >> /etc/sysctl.conf

2. Configure elasticsearch login class in /etc/login.conf

	elasticsearch:\
		:openfiles=65536:\
		:tc=daemon:

For busy elasticsearch node with lots of indexes, openfiles limit should be
increased even more, e.g. 131070.

You can query the number of number of open file descriptors along with
maximum allowed by running:

	$ ftp -o - "http://localhost:9200/_nodes/stats/process?pretty"

and searching for "open_file_descriptors" and "max_file_descriptors" values.

Resource Limits: Maximum Number of File Locks
=============================================
If you are getting "java.io.IOException: No locks available" errors, increase
kern.maxlocksperuid over the default of 1024:

	# sysctl kern.maxlocksperuid=2048
	# echo "kern.maxlocksperuid=2048" >> /etc/sysctl.conf

Elasticsearch Plugins Management
================================
Elasticsearch plugins management involves running Java code which can download
and execute arbitrary code from the Internet. To avoid running these tasks
as root, use doas(1):

	# doas -u _elasticsearch \
		/usr/local/elasticsearch/bin/elasticsearch-plugin install <plugin>

Upgrading ElasticSearch
=======================
Please refer to the upstream documentation when performing upgrades:
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html
