Nitendra
Nitendra

Reputation: 494

How to connect elastic cluster from application running in docker

I am trying to migrate my python application into docker image. current code is crawling data from web and inserting in elastic search cluster running on different machines.

how do define url of external ip of es cluster in docker-compose

Upvotes: 0

Views: 140

Answers (1)

AmaHacka
AmaHacka

Reputation: 104

You can pass external es ip as environment variable in docker-compose:

  your-python-service:
    image: ...
    ...
    environment:
      ES_ADDR: your_es_ip_here

And then read env in your python code:

es_arr = os.environ["ES_ADDR"]

This is one of many possible problem solutions.

Upvotes: 1

Related Questions