Hi all, were trying to deploy an ECS service and w...
# all-things-deployment
n
Hi all, were trying to deploy an ECS service and we are facing some connection issues with elasticsearch and elasticsearch-setup
Copy code
Problem with request: Get <http://localhost:9200>: dial tcp [::1]:9200: connect: connection refused. Sleeping 1s
Does anyone facing this issue or have deployed with ECS using elasticsearch and can help us?
plus1 2
o
Hi! Looks like you're trying to connect to localhost:9200 in a Cloud deployment, have you updated the connection details in your docker environment to point to your ElasticSearch host? If you're deploying with K8s we have configuration guides here: https://datahubproject.io/docs/deploy/kubernetes . If you're not using K8s to manage your docker images you'll need to manually configure the docker environment variables.
n
Hi Ryan! We are providing our insfrastructure with Terraform and deploying DataHub images with ECS. On elasticsearch-setup image we set the following environment variables, on the task-definiiton-services.json file:
Copy code
"environment": [
      {
        "name": "ELASTICSEARCH_HOST",
        "value": "localhost"
      },
      {
        "name": "ELASTICSEARCH_PORT",
        "value": "9200"
      },
      {
        "name": "ELASTICSEARCH_PROTOCOL", 
        "value": "http"
      }
    ]
and on elasticsearch image, we have the following variables
Copy code
"environment": [
      {
        "name": "discovery.type",
        "value": "single-node"
      },
      {
        "name": "xpack.security.enabled",
        "value": "false"
      },
      {
        "name": "ES_JAVA_OPTS",
        "value": "-Xms256m -Xmx256m -Dlog4j2.formatMsgNoLookups:true"
      },
      {"name": "network.host","value":"0.0.0.0"}
    ]
o
So the default of "localhost" is intended for local deploys, as the docker-compose file will expose relevant ports on your local machine, not cloud deployments. You'll need to set the actual host for your ElasticSearch/AWS OpenSearch instance.