openbsd-ports/textproc/elasticsearch/pkg
ajacoutot c4096e6659 Stop using the daemon class in @newuser.
If we need to make an exception we can do it and properly document the
reason but by default we should just use the default login class.
rc.d uses daemon or the login class provided in login.conf.d so this has
no impact there.

discussed with sthen@, tb@ and robert@

praying that my grep/sed skills did not break anything and still
believing in portbump :-)
2022-11-08 11:16:56 +00:00
..
DESCR
elasticsearch.rc drop RCS Ids 2022-03-11 20:02:12 +00:00
PLIST Stop using the daemon class in @newuser. 2022-11-08 11:16:56 +00:00
README drop RCS Ids 2022-03-11 20:02:12 +00:00

+-----------------------------------------------------------------------
| Running ${PKGSTEM} 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 ${SYSCONFDIR}/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 \
		${TRUEPREFIX}/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