title: Filebeat and Kafka: Client has run out of available brokers to talk to
body: <p>I have two servers, lets name them <code>server1</code> and <code>server2</code>.</p>
  <p>On <code>server1</code> I have a <code>docker</code> container with <code>Kafka</code> running. Port of <code>Kafka</code> Broker and Zookeeper are mapped to the host.</p>
  <p>On <code>server2</code> I want to install <code>Filebeat</code> which sends some log messages to <code>Kafka</code> on <code>server1</code>. It seems that it can establish the connection to the broker...</p>
  <pre><code>[publisher_pipeline_output]        pipeline/output.go:143        Connecting to kafka(server1:9092)
  [publisher_pipeline_output]        pipeline/output.go:151        Connection to kafka(server1:9092) established
  </code></pre>
  <p>...but the actual sending of the message fails with the error message:</p>
  <pre><code>[kafka] kafka/client.go:317     Kafka (topic=sample-topic): kafka: client has run out of available brokers to talk to (Is your cluster reachable?)
  </code></pre>
  <p>I've also tried to run the <code>kafka-producer-console</code> (also in a docker) from my <code>server2</code> and that actually worked! The only difference is that my <code>Filebeat</code> does not run in a <code>docker</code> container but directly on <code>server2</code>.</p>
  <p>So what did I forget? Any idea how to further debug the issue?</p>
  <p>As <code>ADVERTISED_HOST</code> when running the container I did use the <code>server1</code> hostname.</p>
  <p><strong>For clarification:</strong>
  I'm using <code>KAfka</code> from <code>spotify/kafka</code> (<a href="https://hub.docker.com/r/spotify/kafka" rel="nofollow noreferrer">https://hub.docker.com/r/spotify/kafka</a>) and run it like that:</p>
  <pre><code>docker run -p 2181:2181 -p 9092:9092 --name kafka --env ADVERTISED_HOST=server1 --env ADVERTISED_PORT=9092 spotify/kafka
  </code></pre>
  <p>my <code>Filebeat</code> config looks like this:</p>
  <pre><code>output.kafka:
    hosts: [&quot;server1:9092&quot;]
    topic: 'sample-topic'
    partition.round_robin:
      reachable_only: false
  
    required_acks: 1
    compression: gzip
    max_message_bytes: 1000000
  </code></pre>