This is the snap for OpenSearch, a community-driven, Apache 2.0-licensed open source search and analytics suite that makes it easy to ingest, search, visualize, and analyze data.
or:
sudo snap install opensearch --channel=2/candidate
sudo snap connect opensearch:process-control
OpenSearch has a set of pre-requisites to function properly, they can be set as follows:
sudo sysctl -w vm.swappiness=0
sudo sysctl -w vm.max_map_count=262144
sudo sysctl -w net.ipv4.tcp_retries2=5
# create the certificates
sudo snap run opensearch.setup \
--node-name cm0 \
--node-roles cluster_manager,data \
--tls-priv-key-root-pass root1234 \
--tls-priv-key-admin-pass admin1234 \
--tls-priv-key-node-pass node1234 \
--tls-init-setup yes # this creates the root and admin certs as well.
sudo snap start opensearch.daemon
sudo snap run opensearch.security-init --tls-priv-key-admin-pass=admin1234
You can either consume the REST API yourself or see if the below commands succeed, and you see that the tests "PASSED"
successfully:
# Check if cluster is healthy (green):
sudo snap run opensearch.test-cluster-health-green
> ....
> PASSED
# Check if node is up:
sudo snap run opensearch.test-node-up
> ....
> PASSED
# Check if the security index is well initialised:
sudo snap run opensearch.test-security-index-created
> ....
> PASSED
or:
sudo cp /var/snap/opensearch/current/etc/opensearch/certificates/node-cm0.pem ./
curl --cacert node-cm0.pem -XGET https://admin:admin@localhost:9200/_cluster/health?pretty
> {
"cluster_name": "opensearch-cluster",
"status": "green",
"timed_out": false,
"number_of_nodes": 1,
"number_of_data_nodes": 1,
"discovered_master": true,
"discovered_cluster_manager": true,
"active_primary_shards": 2,
"active_shards": 2,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 100
}
In some cases, users may need to run cli commands that are not exposed by the OpenSearch snap. To achieve this, those commands must be run as the snap_daemon
user with the required environment variables passed:
$ sudo -u snap_daemon \
OPENSEARCH_JAVA_HOME=/snap/opensearch/current/usr/lib/jvm/java-21-openjdk-amd64 \
OPENSEARCH_PATH_CONF=/var/snap/opensearch/current/etc/opensearch \
OPENSEARCH_HOME=/var/snap/opensearch/current/usr/share/opensearch \
OPENSEARCH_LIB=/var/snap/opensearch/current/usr/share/opensearch/lib \
OPENSEARCH_PATH_CERTS=/var/snap/opensearch/current/etc/opensearch/certificates \
/snap/opensearch/current/usr/share/opensearch/bin/<command> [options]
The Opensearch Snap is free software, distributed under the Apache Software License, version 2.0. See LICENSE for more information.