is it safe to add partition or broker online for kafka?
<p>Thanks for your patience.</p>

<ol>
<li>After adding partitions to a topic online, the kafka consumer stops reading message and no exceptions are thrown. The consumer just blocks. Each time we have to restart the consumer. I think it is unreasonable and I cannot find any docs about it.</li>
</ol>

<p>Moreover, consumer thread will not resume when error occurs in processing message. Our consumer reads message and insert it to MySql. Once the network failed, consumer was not able to connect to MySql, then it blocked and stopped reading message until we restarted it.</p>

<ol start="2">
<li>What will happen to old data and new data when adding partition? 
the docs（<a href="https://kafka.apache.org/documentation.html#basic_ops_modify_topic" rel="nofollow">https://kafka.apache.org/documentation.html#basic_ops_modify_topic</a>） says:</li>
</ol>

<p>"Be aware that one use case for partitions is to semantically partition data, and adding partitions doesn't change the partitioning of existing data so this may disturb consumers if they rely on that partition. That is if data is partitioned by hash(key) % number_of_partitions then this partitioning will potentially be shuffled by adding partitions but Kafka will not attempt to automatically redistribute data in any way."</p>

<p>What does "not attempt to automatically redistribute data" mean? The old data are unchanged and the new data will not be sent to the added partition? </p>

<ol start="3">
<li>The kafka producer fail to send message when a broker is down.</li>
</ol>

<p>We have a topic with 3 partition and 2 replicas. The kafka cluster has 3 brokers. But when a broker is down, exceptions occur:</p>

<pre><code>kafka.producer.async.ProducerSendThread.error():103: - Error in handling batch of 65 events
kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
  at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:90) ~[kafka_2.9.2-0.8.2.0.jar:na]
 at kafka.producer.async.ProducerSendThread.tryToHandle(ProducerSendThread.scala:105) [kafka_2.9.2-0.8.2.0.jar:na]
     at kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:88) [kafka_2.9.2-0.8.2.0.jar:na]
       at kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:68) [kafka_2.9.2-0.8.2.0.jar:na]
 at scala.collection.immutable.Stream.foreach(Stream.scala:526) [scala-library-2.9.2.jar:na]
   at kafka.producer.async.ProducerSendThread.processEvents(ProducerSendThread.scala:67) [kafka_2.9.2-0.8.2.0.jar:na]
      at kafka.producer.async.ProducerSendThread.run(ProducerSendThread.scala:45) [kafka_2.9.2-0.8.2.0.jar:na]

kafka.producer.async.DefaultEventHandler.error():97: - Failed to send requests for topics risk_acts with correlation ids in [433266,433395]
</code></pre>

<p>The same problems also happen when new brokers are added. We have to add new brokers hostname and port to "metadata.broker.list" configuration in producer and restart it.</p>

<p>We are using the high level api and the version of kafka is:</p>

<pre><code>&lt;dependency&gt;
      &lt;groupId&gt; org.apache.kafka&lt;/groupId &gt;
      &lt;artifactId&gt; kafka_2.9.2&lt;/artifactId &gt;
      &lt;version&gt; 0.8.2.0&lt;/version &gt;
&lt;/dependency&gt;
</code></pre>

<p>producer configuration:</p>

<pre><code>&lt;entry key="metadata.broker.list" value="${metadata.broker.list}" /&gt;
&lt;entry key="serializer.class" value="kafka.serializer.StringEncoder" /&gt;
&lt;entry key="key.serializer.class" value="kafka.serializer.StringEncoder" /&gt;
&lt;entry key="request.required.acks" value="-1" /&gt;
&lt;entry key="producer.type" value="async" /&gt;
&lt;entry key="queue.enqueue.timeout.ms" value="-1" /&gt;
&lt;entry key="compression.codec" value="1" /&gt;
</code></pre>

<p>consumer configuration:</p>

<pre><code>&lt;entry key="zookeeper.connect" value="${zookeeper.connect}" /&gt;
&lt;entry key="group.id" value="${kafka.consumer.group.id}" /&gt;
&lt;entry key="zookeeper.session.timeout.ms" value="40000" /&gt;
&lt;entry key="rebalance.backoff.ms" value="10000" /&gt;
&lt;entry key="zookeeper.sync.time.ms" value="2000" /&gt;
&lt;entry key="auto.commit.interval.ms" value="1000" /&gt;
&lt;entry key="auto.offset.reset" value="smallest" /&gt;
</code></pre>

<p>producer code and consumer code are like:
<a href="https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+Producer+Example" rel="nofollow">https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+Producer+Example</a>
<a href="https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example" rel="nofollow">https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example</a></p>