RousselTMLEARNING

Observability

Installing OpenSearch and OpenSearch Dashboards

Install OpenSearch with Docker Compose or the archive: initial password, vm.max_map_count, demo certificates and JVM memory, with the errors encountered on version 3.9.

1. With Docker Compose #

A node and its console.

The stack #

Since version 2.12, a strong admin password is mandatory: without it, or if it is too weak, OpenSearch stops at startup. Put it in a .env file, out of Git.

OPENSEARCH_INITIAL_ADMIN_PASSWORD=Str0ng!Passw0rd-2026
services:
  opensearch:
    image: opensearchproject/opensearch:3
    environment:
      discovery.type: single-node
      OPENSEARCH_INITIAL_ADMIN_PASSWORD: ${OPENSEARCH_INITIAL_ADMIN_PASSWORD}
      OPENSEARCH_JAVA_OPTS: -Xms1g -Xmx1g
      path.repo: /usr/share/opensearch/data/snapshots
    ports:
      - "9200:9200"
    volumes:
      - os-data:/usr/share/opensearch/data

  dashboards:
    image: opensearchproject/opensearch-dashboards:3
    environment:
      OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
    ports:
      - "5601:5601"
    depends_on: [opensearch]

volumes:
  os-data:
sudo sysctl -w vm.max_map_count=262144
docker compose up -d
curl -sk -u 'admin:Str0ng!Passw0rd-2026' -H 'Content-Type: application/json' https://localhost:9200/_cat/health?v

The console is at http://localhost:5601 (user admin).

Host settings #

Does the container stop immediately? Check vm.max_map_count on the Linux host: the expected value is 262144. Make it permanent in /etc/sysctl.conf.

2. With the archive #

Without a container.

Installing on a server #

tar -xf opensearch-3.9.0-linux-x64.tar.gz && cd opensearch-3.9.0
echo 'discovery.type: single-node' >> config/opensearch.yml
export OPENSEARCH_INITIAL_ADMIN_PASSWORD='Str0ng!Passw0rd-2026'
./opensearch-tar-install.sh

The script installs demo certificates and starts the node over HTTPS, hence the -k option of curl. For real production, replace these certificates.

Multiple garbage collectors selected message? We hit it on 3.9 with the archive: it came from an OPENSEARCH_JAVA_OPTS exported in the environment. Set memory in config/jvm.options instead.

3. Sizing memory #

The most important setting.

The JVM heap #

Set -Xms and -Xmx to the same value, about half of the machine's memory, and no more than 32 GB. The rest serves the system cache, heavily used by Lucene.

-Xms4g
-Xmx4g

4. Configuring the node #

opensearch.yml, jvm.options and system settings.

The files #

Configuration files
cluster.name: logs-prod
node.name: os-node1
node.roles: [cluster_manager, data, ingest]
network.host: 0.0.0.0
discovery.seed_hosts: ["os-node1", "os-node2", "os-node3"]
cluster.initial_cluster_manager_nodes: ["os-node1", "os-node2", "os-node3"]
path.data: /var/lib/opensearch
path.logs: /var/log/opensearch
bootstrap.memory_lock: true

The settings that matter #

SettingRoleRecommended value
cluster.namenodes only join their clusterexplicit, never the default
discovery.seed_hostswhere to find the other nodescluster-manager-eligible nodes
cluster.initial_cluster_manager_nodesfirst start onlyremove once the cluster is formed
bootstrap.memory_lockprevents heap swappingtrue (+ ulimit memlock)
vm.max_map_countfiles mapped by Lucene262144
file descriptorsmany open segments65536

Running as a service #

With RPM or DEB packages, OpenSearch installs as a systemd service; configuration is in /etc/opensearch.

sudo systemctl enable --now opensearch
sudo systemctl status opensearch
sudo journalctl -u opensearch -f        # journaux du service
sudo tail -f /var/log/opensearch/logs-prod.log

5. Checking and troubleshooting #

The first reflexes.

Checking #

Checking a node

Frequent problems #

SymptomLikely causeFix
immediate stop, "max virtual memory areas"vm.max_map_countsysctl -w vm.max_map_count=262144
stop at startup, password messageadmin password missing or weakOPENSEARCH_INITIAL_ADMIN_PASSWORD
nodes do not see each otherport 9300 closed, different cluster.namefirewall, configuration
curl: (60) SSL certificate problemdemo certificates-k in test, real certificates in production
OutOfMemoryErrorheap too small or queries too heavyraise heap, limit aggregations
Common mistake : Never disable the security plugin to "make it work" on a lab exposed to a network: many open clusters get drained every year.

Commands to know #

Commands to know
  • sysctl -w vm.max_map_count=262144 : required kernel setting
  • systemctl status opensearch : service status
  • GET _cat/nodes?v&h=name,node.role,heap.percent,ram.percent : node roles and memory
  • GET _nodes/settings?filter_path=**.cluster.name : effective configuration

Related articles

The OpenSearch cluster in depth: nodes, shards and replication

Understanding how an OpenSearch cluster works inside: node roles, cluster manager election, shard allocation,…

Full-text search in OpenSearch: analyzers and relevance

Mastering full-text search: inverted index, analyzers (including French), the _analyze API, match, multi_matc…

Advanced aggregations, PPL and SQL in OpenSearch

Analyzing data in OpenSearch: bucket, metric and pipeline aggregations, date histograms, approximate cardinal…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!