Caused by: java.net.UnknownHostException: fx-elasticsearch: Name does not resolve

Hi All,

I have issue of fx-elasticsearch not found and i have deploy as docker compose file

one more error i got in same container

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchClient' defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method 'elasticsearchClient' threw exception; nested exception is java.lang.IllegalArgumentException: java.net.UnknownHostException: fx-elasticsearch: Name does not resolve

here is the elasticsearch.yml file

http.host: 0.0.0.0

# Uncomment the following lines for a production cluster deployment
transport.host: 0.0.0.0
#discovery.zen.minimum_master_nodes: 1
#transport.host: localhost
#transport.tcp.port: 9300
#http.port: 9200
#network.bind_host: 0.0.0.0

and here is docker-compose file

fx-elasticsearch:
#    image: "elasticsearch:5.0.0"
    image: "elasticsearch:6.8.12"
    deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      placement:
        constraints: [node.role == manager]
      resources:
        limits:
          memory: 10G
    environment:
      - ES_JAVA_OPTS=${ELASTICSEARCH_MEM}
      - ./elasticsearch.yaml:/usr/share/elasticsearch/config/elasticsearch.yml
      - cluster.name=elasticsearch
    volumes:
      - esdata:/usr/share/elasticsearch/data
    logging:
      driver: syslog
      options:
        tag: "{{.Name}}/{{.ID}}"

Here is my .env file

ELASTICSEARCH_HOST=fx-elasticsearch
ELASTICSEARCH_MEM="-Xms4g -Xmx4g"

Please help out

Can you ping fx-elasticsearch? If not then you have a DNS issue in your network.

where should i ping inside elasticsearch container

inside docker container of elasticsearch its pinging ..its working and next step plse

Ok but you need to be able to do that from outside the container and have it work.

outside container getting below error...

ping ping fx-elasticsearch
ping: fx-elasticsearch: Temporary failure in name resolution

i have open port number 9200 in azure vm

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.