You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ma...@apache.org on 2019/02/04 21:48:26 UTC
[kafka] branch trunk updated: KAFKA-7804: Update docs for
topic-command related KIP-377
This is an automated email from the ASF dual-hosted git repository.
manikumar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 776041d KAFKA-7804: Update docs for topic-command related KIP-377
776041d is described below
commit 776041db112be8a9ba98130d7394da61e82bbd26
Author: Viktor Somogyi-Vass <vi...@gmail.com>
AuthorDate: Mon Feb 4 13:46:33 2019 -0800
KAFKA-7804: Update docs for topic-command related KIP-377
This PR adds a upgrade notes and changes examples to use the bootstrap-server.
Author: Viktor Somogyi-Vass <vi...@gmail.com>
Reviewers: Srinivas <sr...@gmail.com>, Manikumar Reddy <ma...@gmail.com>
Closes #6118 from viktorsomogyi/topiccommand-adminclient-doc
---
core/src/main/scala/kafka/admin/TopicCommand.scala | 2 +-
docs/configuration.html | 2 +-
docs/ops.html | 12 ++++++------
docs/quickstart.html | 12 ++++++------
docs/streams/quickstart.html | 6 +++---
docs/upgrade.html | 3 +++
.../kafka/streams/examples/temperature/TemperatureDemo.java | 4 ++--
7 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/core/src/main/scala/kafka/admin/TopicCommand.scala b/core/src/main/scala/kafka/admin/TopicCommand.scala
index b9d215b..48fdaec 100755
--- a/core/src/main/scala/kafka/admin/TopicCommand.scala
+++ b/core/src/main/scala/kafka/admin/TopicCommand.scala
@@ -509,7 +509,7 @@ object TopicCommand extends Logging {
private val configOpt = parser.accepts("config", "A topic configuration override for the topic being created or altered." +
"The following is a list of valid configurations: " + nl + LogConfig.configNames.map("\t" + _).mkString(nl) + nl +
"See the Kafka documentation for full details on the topic configs." +
- "Not supported with the --bootstrap-server option.")
+ "It is supported only in combination with --create if --bootstrap-server option is used.")
.withRequiredArg
.describedAs("name=value")
.ofType(classOf[String])
diff --git a/docs/configuration.html b/docs/configuration.html
index bde53a7..06d7585 100644
--- a/docs/configuration.html
+++ b/docs/configuration.html
@@ -234,7 +234,7 @@
Configurations pertinent to topics have both a server default as well an optional per-topic override. If no per-topic configuration is given the server default is used. The override can be set at topic creation time by giving one or more <code>--config</code> options. This example creates a topic named <i>my-topic</i> with a custom max message size and flush rate:
<pre class="brush: bash;">
- > bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic my-topic --partitions 1
+ > bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic my-topic --partitions 1 \
--replication-factor 1 --config max.message.bytes=64000 --config flush.messages=1
</pre>
Overrides can also be changed or set later using the alter configs command. This example updates the max message size for <i>my-topic</i>:
diff --git a/docs/ops.html b/docs/ops.html
index 64f7159..99672c9 100644
--- a/docs/ops.html
+++ b/docs/ops.html
@@ -28,7 +28,7 @@
<p>
Topics are added and modified using the topic tool:
<pre class="brush: bash;">
- > bin/kafka-topics.sh --zookeeper zk_host:port/chroot --create --topic my_topic_name
+ > bin/kafka-topics.sh --bootstrap-server broker_host:port --create --topic my_topic_name \
--partitions 20 --replication-factor 3 --config x=y
</pre>
The replication factor controls how many servers will replicate each message that is written. If you have a replication factor of 3 then up to 2 servers can fail before you will lose access to your data. We recommend you use a replication factor of 2 or 3 so that you can transparently bounce machines without interrupting data consumption.
@@ -45,22 +45,22 @@
<p>
To add partitions you can do
<pre class="brush: bash;">
- > bin/kafka-topics.sh --zookeeper zk_host:port/chroot --alter --topic my_topic_name
+ > bin/kafka-topics.sh --bootstrap-server broker_host:port --alter --topic my_topic_name \
--partitions 40
</pre>
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 <code>hash(key) % number_of_partitions</code> then this partitioning will potentially be shuffled by adding partitions but Kafka will not attempt to automatically redistribute data in any way.
<p>
To add configs:
<pre class="brush: bash;">
- > bin/kafka-configs.sh --zookeeper zk_host:port/chroot --entity-type topics --entity-name my_topic_name --alter --add-config x=y
+ > bin/kafka-configs.sh --bootstrap-server broker_host:port --entity-type topics --entity-name my_topic_name --alter --add-config x=y
</pre>
To remove a config:
<pre class="brush: bash;">
- > bin/kafka-configs.sh --zookeeper zk_host:port/chroot --entity-type topics --entity-name my_topic_name --alter --delete-config x
+ > bin/kafka-configs.sh --bootstrap-server broker_host:port --entity-type topics --entity-name my_topic_name --alter --delete-config x
</pre>
And finally deleting a topic:
<pre class="brush: bash;">
- > bin/kafka-topics.sh --zookeeper zk_host:port/chroot --delete --topic my_topic_name
+ > bin/kafka-topics.sh --bootstrap-server broker_host:port --delete --topic my_topic_name
</pre>
<p>
Kafka does not currently support reducing the number of partitions for a topic.
@@ -442,7 +442,7 @@
</pre>
You can also verify the increase in replication factor with the kafka-topics tool:
<pre class="brush: bash;">
- > bin/kafka-topics.sh --zookeeper localhost:2181 --topic foo --describe
+ > bin/kafka-topics.sh --bootstrap-server localhost:9092 --topic foo --describe
Topic:foo PartitionCount:1 ReplicationFactor:3 Configs:
Topic: foo Partition: 0 Leader: 5 Replicas: 5,6,7 Isr: 5,6,7
</pre>
diff --git a/docs/quickstart.html b/docs/quickstart.html
index e84f4d2..b9e0c7c 100644
--- a/docs/quickstart.html
+++ b/docs/quickstart.html
@@ -56,12 +56,12 @@ Kafka uses <a href="https://zookeeper.apache.org/">ZooKeeper</a> so you need to
<p>Let's create a topic named "test" with a single partition and only one replica:</p>
<pre class="brush: bash;">
-> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
+> bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
</pre>
<p>We can now see that topic if we run the list topic command:</p>
<pre class="brush: bash;">
-> bin/kafka-topics.sh --list --zookeeper localhost:2181
+> bin/kafka-topics.sh --list --bootstrap-server localhost:9092
test
</pre>
<p>Alternatively, instead of manually creating topics you can also configure your brokers to auto-create topics when a non-existent topic is published to.</p>
@@ -133,12 +133,12 @@ We already have Zookeeper and our single node started, so we just need to start
<p>Now create a new topic with a replication factor of three:</p>
<pre class="brush: bash;">
-> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic my-replicated-topic
+> bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 3 --partitions 1 --topic my-replicated-topic
</pre>
<p>Okay but now that we have a cluster how can we know which broker is doing what? To see that run the "describe topics" command:</p>
<pre class="brush: bash;">
-> bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic my-replicated-topic
+> bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic my-replicated-topic
Topic:my-replicated-topic PartitionCount:1 ReplicationFactor:3 Configs:
Topic: my-replicated-topic Partition: 0 Leader: 1 Replicas: 1,2,0 Isr: 1,2,0
</pre>
@@ -153,7 +153,7 @@ Topic:my-replicated-topic PartitionCount:1 ReplicationFactor:3 Configs:
We can run the same command on the original topic we created to see where it is:
</p>
<pre class="brush: bash;">
-> bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
+> bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic test
Topic:test PartitionCount:1 ReplicationFactor:1 Configs:
Topic: test Partition: 0 Leader: 0 Replicas: 0 Isr: 0
</pre>
@@ -195,7 +195,7 @@ ProcessId
<p>Leadership has switched to one of the followers and node 1 is no longer in the in-sync replica set:</p>
<pre class="brush: bash;">
-> bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic my-replicated-topic
+> bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic my-replicated-topic
Topic:my-replicated-topic PartitionCount:1 ReplicationFactor:3 Configs:
Topic: my-replicated-topic Partition: 0 Leader: 2 Replicas: 1,2,0 Isr: 2,0
</pre>
diff --git a/docs/streams/quickstart.html b/docs/streams/quickstart.html
index 5cbaf4d..9abeed4 100644
--- a/docs/streams/quickstart.html
+++ b/docs/streams/quickstart.html
@@ -138,7 +138,7 @@ Next, we create the input topic named <b>streams-plaintext-input</b> and the out
<pre class="brush: bash;">
> bin/kafka-topics.sh --create \
- --zookeeper localhost:2181 \
+ --bootstrap-server localhost:9092 \
--replication-factor 1 \
--partitions 1 \
--topic streams-plaintext-input
@@ -150,7 +150,7 @@ Note: we create the output topic with compaction enabled because the output stre
<pre class="brush: bash;">
> bin/kafka-topics.sh --create \
- --zookeeper localhost:2181 \
+ --bootstrap-server localhost:9092 \
--replication-factor 1 \
--partitions 1 \
--topic streams-wordcount-output \
@@ -161,7 +161,7 @@ Created topic "streams-wordcount-output".
The created topic can be described with the same <b>kafka-topics</b> tool:
<pre class="brush: bash;">
-> bin/kafka-topics.sh --zookeeper localhost:2181 --describe
+> bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe
Topic:streams-plaintext-input PartitionCount:1 ReplicationFactor:1 Configs:
Topic: streams-plaintext-input Partition: 0 Leader: 0 Replicas: 0 Isr: 0
diff --git a/docs/upgrade.html b/docs/upgrade.html
index 0b6b83a..4d5d2a9 100644
--- a/docs/upgrade.html
+++ b/docs/upgrade.html
@@ -26,6 +26,9 @@
and fetch or commit offsets. The empty string as consumer group id is deprecated but will be supported until a future major release. Old clients that rely on the empty string group id will now
have to explicitly provide it as part of their consumer config. For more information see
<a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-289%3A+Improve+the+default+group+id+behavior+in+KafkaConsumer">KIP-289</a>.</li>
+ <li>The <code>bin/kafka-topics.sh</code> command line tool is now able to connect directly to brokers with <code>--bootstrap-server</code> instead of zookeeper. The old <code>--zookeeper</code>
+ option is still available for now. Please read <a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-377%3A+TopicCommand+to+use+AdminClient">KIP-377</a>.</li>
+ for more information.
</ul>
<h4><a id="upgrade_2_1_0" href="#upgrade_2_1_0">Upgrading from 0.8.x, 0.9.x, 0.10.0.x, 0.10.1.x, 0.10.2.x, 0.11.0.x, 1.0.x, 1.1.x, or 2.0.0 to 2.1.0</a></h4>
diff --git a/streams/examples/src/main/java/org/apache/kafka/streams/examples/temperature/TemperatureDemo.java b/streams/examples/src/main/java/org/apache/kafka/streams/examples/temperature/TemperatureDemo.java
index 4994a5d..b750b66 100644
--- a/streams/examples/src/main/java/org/apache/kafka/streams/examples/temperature/TemperatureDemo.java
+++ b/streams/examples/src/main/java/org/apache/kafka/streams/examples/temperature/TemperatureDemo.java
@@ -43,11 +43,11 @@ import java.util.concurrent.CountDownLatch;
*
* Before running this example you must create the input topic for temperature values in the following way :
*
- * bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic iot-temperature
+ * bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic iot-temperature
*
* and at same time the output topic for filtered values :
*
- * bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic iot-temperature-max
+ * bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic iot-temperature-max
*
* After that, a console consumer can be started in order to read filtered values from the "iot-temperature-max" topic :
*