# Docker Connection refused with elasticsearch

**URL:** <https://discuss.elastic.co/t/docker-connection-refused-with-elasticsearch/185812>\
**Category:** Logstash\
**Created:** [June 14, 2019, 9:02am UTC](https://discuss.elastic.co/t/docker-connection-refused-with-elasticsearch/185812 "2019-06-14T09:02:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![crobix](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@crobix](https://discuss.elastic.co/u/crobix)\
**Post date:** [June 14, 2019, 9:02am UTC](https://discuss.elastic.co/t/docker-connection-refused-with-elasticsearch/185812/1 "2019-06-14T09:02:56Z")

</div>

Hello,  
I got an issue while i try to connect logstash with elasticsearch

and i can't solve it

```auto
[2019-06-14T08:49:25,833][WARN][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::SocketException] Connection refused (Connection refused)"}

```

docker-compose.yml

```auto
version: '2.2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
    container_name: elasticsearch
    environment:
      - node.name=elasticsearch
      - discovery.seed_hosts=es02
      - cluster.initial_master_nodes=elasticsearch,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
    container_name: es02
    environment:
      - node.name=es02
      - discovery.seed_hosts=elasticsearch
      - cluster.initial_master_nodes=elasticsearch,es02
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata02:/usr/share/elasticsearch/data
    networks:
      - esnet

  logstash:
    image: logstash:7.1.1
    links:
      - elasticsearch
    volumes:
      - ./:/config-dir
    command: logstash -f /config-dir/logstash.conf
    depends_on:
      - elasticsearch
    networks:
      - esnet

  rabbitmq:
    image: macintoshplus/rabbitmq-management
    ports:
      - "8080:15672"

volumes:
  esdata01:
    driver: local
  esdata02:
    driver: local

networks:
  esnet:

```

logstash.conf

```auto
input {
	rabbitmq {
            host => "rabbitmq"
            heartbeat => 30
            durable => true
            exchange => "logging_queue"
            exchange_type => "headers"
            queue => "logstash"

        }
}

filter {
	if [type] == "nginx-access" {
		grok {
			match => { "message" => "%{COMBINEDAPACHELOG}" }
		}
	}
}

output {
	elasticsearch {
		hosts => ["elasticsearch:9200"]
	}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 12, 2019, 9:03am UTC](https://discuss.elastic.co/t/docker-connection-refused-with-elasticsearch/185812/2 "2019-07-12T09:03:00Z")

</div>

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