| applies_to |
|
|||
|---|---|---|---|---|
| navigation_title | Multi-node cluster |
Use Docker Compose to start a three-node {{es}} cluster with {{kib}}. Docker Compose lets you start multiple containers with a single command.
:::{include} _snippets/wolfi.md :::
-
Install Docker Compose. Visit the Docker Compose docs to install Docker Compose for your environment.
If you’re using Docker Desktop, Docker Compose is installed automatically. Make sure to allocate at least 4GB of memory to Docker Desktop. You can adjust memory usage in Docker Desktop by going to Settings > Resources.
-
Create or navigate to an empty directory for the project.
-
Download and save the following files in the project directory:
-
In the
.envfile, specify a password for theELASTIC_PASSWORDandKIBANA_PASSWORDvariables.The passwords must be alphanumeric and can’t contain special characters, such as
!or@. The bash script included in thedocker-compose.ymlfile only works with alphanumeric characters. Example:# Password for the 'elastic' user (at least 6 characters) ELASTIC_PASSWORD=changeme # Password for the 'kibana_system' user (at least 6 characters) KIBANA_PASSWORD=changeme ...
-
In the
.envfile, setSTACK_VERSIONto the current {{stack}} version.... # Version of Elastic products STACK_VERSION={{stack-version}} ... -
By default, the Docker Compose configuration exposes port
9200on all network interfaces.To avoid exposing port
9200to external hosts, setES_PORTto127.0.0.1:9200in the.envfile. This ensures {{es}} is only accessible from the host machine.... # Port to expose {{es}} HTTP API to the host #ES_PORT=9200 ES_PORT=127.0.0.1:9200 ...
-
To start the cluster, run the following command from the project directory.
docker-compose up -d
-
After the cluster has started, open http://localhost:5601 in a web browser to access {{kib}}.
-
Log in to {{kib}} as the
elasticuser using theELASTIC_PASSWORDyou set earlier.
To stop the cluster, run docker-compose down. The data in the Docker volumes is preserved and loaded when you restart the cluster with docker-compose up.
docker-compose downTo delete the network, containers, and volumes when you stop the cluster, specify the -v option:
docker-compose down -vYou now have a test {{es}} environment set up. Before you start serious development or go into production with {{es}}, review the requirements and recommendations to apply when running {{es}} in Docker in production.