Elasticsearch

The next infrastructure service is Elasticsearch, which also has no dependencies on other services. It will be used by the message handler, which also uses the NATS message queue, so I will need to join all these services to the same Docker network. For Elasticsearch, I also want to limit the amount of memory it uses and use a volume for the data so it will be stored outside the container:

 elasticsearch:
image: sixeyed/elasticsearch:5.6.11-windowsservercore-ltsc2019
environment:
- ES_JAVA_OPTS=-Xms512m -Xmx512m
volumes:
-
es-data:C:data
networks:
- nd-net

Here, elasticsearch is the name of the service and sixeyed/elasticsearch is the name of the image, which is my public image on Docker Hub. I'm connecting the service to the same nd-net network, and I also mount a volume to a known location in the container. When Elasticsearch writes data to C:data on the container, it will actually be stored in a volume.

Just as with networks, volumes are first-class resources in the Docker Compose file. For Elasticsearch, I'm mapping a volume called es-data to the data location in the container. I'll specify how the es-data volume should be created later in the Compose file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.5.57