Installation quickstart

To quickly get started using OpenSearch and OpenSearch Dashboards, deploy your containers using Docker. For all installation guides, see Install and upgrade OpenSearch.

Before proceeding, you need to install Docker and Docker Compose on your local machine.

The Docker Compose commands used in this guide are written with a hyphen (for example, docker-compose). If you installed Docker Desktop on your machine, which automatically installs a bundled version of Docker Compose, then you should remove the hyphen. For example, change docker-compose to docker compose.

Starting your cluster

You’ll need a special file, called a Compose file, that Docker Compose uses to define and create the containers in your cluster. The OpenSearch Project provides a sample Compose file that you can use to get started. Learn more about working with Compose files by reviewing the official Compose specification.

  1. Before running OpenSearch on your machine, you should disable memory paging and swapping performance on the host to improve performance and increase the number of memory maps available to OpenSearch.

    Disable memory paging and swapping:

    1. sudo swapoff -a

    copy

    Edit the sysctl config file that defines the host’s max map count:

    1. sudo vi /etc/sysctl.conf

    copy

    Set max map count to the recommended value of 262144:

    1. vm.max_map_count=262144

    copy

    Reload the kernel parameters:

    1. sudo sysctl -p

    copy

    For more information, see important system settings.

  2. Download the sample Compose file to your host. You can download the file with command line utilities like curl and wget, or you can manually copy docker-compose.yml from the OpenSearch Project documentation-website repository using a web browser.

    To use cURL, send the following request:

    1. curl -O https://raw.githubusercontent.com/opensearch-project/documentation-website/2.18/assets/examples/docker-compose.yml

    copy

    To use wget, send the following request:

    1. wget https://raw.githubusercontent.com/opensearch-project/documentation-website/2.18/assets/examples/docker-compose.yml

    copy

  3. In your terminal application, navigate to the directory containing the docker-compose.yml file you downloaded, set up a custom admin password, and run the following command to create and start the cluster as a background process:

    1. docker-compose up -d

    copy

  4. Confirm that the containers are running with the command docker-compose ps. You should see an output like the following:

    1. $ docker-compose ps
    2. NAME COMMAND SERVICE STATUS PORTS
    3. opensearch-dashboards "./opensearch-dashbo…" opensearch-dashboards running 0.0.0.0:5601->5601/tcp
    4. opensearch-node1 "./opensearch-docker…" opensearch-node1 running 0.0.0.0:9200->9200/tcp, 9300/tcp, 0.0.0.0:9600->9600/tcp, 9650/tcp
    5. opensearch-node2 "./opensearch-docker…" opensearch-node2 running 9200/tcp, 9300/tcp, 9600/tcp, 9650/tcp
  5. Query the OpenSearch REST API to verify that the service is running. You should use -k (also written as --insecure) to disable hostname checking because the default security configuration uses demo certificates. Use -u to pass the default username and password (admin:<custom-admin-password>):

    1. curl https://localhost:9200 -ku admin:<custom-admin-password>

    copy

    The response confirms that the installation was successful:

    1. {
    2. "name" : "opensearch-node1",
    3. "cluster_name" : "opensearch-cluster",
    4. "cluster_uuid" : "W0B8gPotTAajhMPbC9D4ww",
    5. "version" : {
    6. "distribution" : "opensearch",
    7. "number" : "2.6.0",
    8. "build_type" : "tar",
    9. "build_hash" : "7203a5af21a8a009aece1474446b437a3c674db6",
    10. "build_date" : "2023-02-24T18:58:37.352296474Z",
    11. "build_snapshot" : false,
    12. "lucene_version" : "9.5.0",
    13. "minimum_wire_compatibility_version" : "7.10.0",
    14. "minimum_index_compatibility_version" : "7.0.0"
    15. },
    16. "tagline" : "The OpenSearch Project: https://opensearch.org/"
    17. }
  6. Explore OpenSearch Dashboards by opening http://localhost:5601/ in a web browser on the same host that is running your OpenSearch cluster. The default username is admin and the default password is set in your docker-compose.yml file in the OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password> setting.

Common issues

Review these common issues and suggested solutions if your containers fail to start or exit unexpectedly.

Docker commands require elevated permissions

Eliminate the need for running your Docker commands with sudo by adding your user to the docker user group. See Docker’s Post-installation steps for Linux for more information.

  1. sudo usermod -aG docker $USER

Error message: “-bash: docker-compose: command not found”

If you installed Docker Desktop, then Docker Compose is already installed on your machine. Try docker compose (without the hyphen) instead of docker-compose. See Use Docker Compose.

Error message: “docker: ‘compose’ is not a docker command.”

If you installed Docker Engine, then you must install Docker Compose separately, and you will use the command docker-compose (with a hyphen). See Docker Compose.

Error message: “max virtual memory areas vm.max_map_count [65530] is too low”

OpenSearch will fail to start if your host’s vm.max_map_count is too low. Review the important system settings if you see the following errors in the service log, and set vm.max_map_count appropriately.

  1. opensearch-node1 | ERROR: [1] bootstrap checks failed
  2. opensearch-node1 | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  3. opensearch-node1 | ERROR: OpenSearch did not exit normally - check the logs at /usr/share/opensearch/logs/opensearch-cluster.log

Other installation types

In addition to Docker, you can install OpenSearch on various Linux distributions and on Windows. For all available installation guides, see Install and upgrade OpenSearch.

Further reading

You successfully deployed your own OpenSearch cluster with OpenSearch Dashboards and added some sample data. Now you’re ready to learn about configuration and functionality in more detail. Here are a few recommendations on where to begin:

Next steps