Skip to content

Commit 0129877

Browse files
showuoncmccabe
andcommitted
MINOR: Improve the KIP-853 documentation (apache#17598)
In docs/ops.html, add a section discussion the difference between static and dynamic quorums. This section also discusses how to find out which quorum type you have. Also discuss the current limitations, such as the inability to transition from static quorums to dynamic. Add a brief section to docs/upgrade.html discussing controller membership change. Co-authored-by: Federico Valeri <[email protected]>, Colin P. McCabe <[email protected]> Reviewers: Justine Olshan <[email protected]>
1 parent 0eae750 commit 0129877

File tree

2 files changed

+133
-2
lines changed

2 files changed

+133
-2
lines changed

docs/ops.html

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,8 +3824,64 @@ <h5 class="anchor-heading"><a id="kraft_storage_observers" class="anchor-link"><
38243824

38253825
<h4 class="anchor-heading"><a id="kraft_reconfig" class="anchor-link"></a><a href="#kraft_reconfig">Controller membership changes</a></h4>
38263826

3827+
<h5 class="anchor-heading"><a id="static_versus_dynamic_kraft_quorums" class="anchor-link"></a><a href="#static_versus_dynamic_kraft_quorums">Static versus Dynamic KRaft Quorums</a></h5>
3828+
There are two ways to run KRaft: the old way using static controller quorums, and the new way
3829+
using KIP-853 dynamic controller quorums.<p>
3830+
3831+
When using a static quorum, the configuration file for each broker and controller must specify
3832+
the IDs, hostnames, and ports of all controllers in <code>controller.quorum.voters</code>.<p>
3833+
3834+
In contrast, when using a dynamic quorum, you should set
3835+
<code>controller.quorum.bootstrap.servers</code> instead. This configuration key need not
3836+
contain all the controllers, but it should contain as many as possible so that all the servers
3837+
can locate the quorum. In other words, its function is much like the
3838+
<code>bootstrap.servers</code> configuration used by Kafka clients.<p>
3839+
3840+
If you are not sure whether you are using static or dynamic quorums, you can determine this by
3841+
running something like the following:<p>
3842+
3843+
<pre><code class="language-bash">
3844+
$ bin/kafka-features.sh --bootstrap-controller localhost:9093 describe
3845+
</code></pre><p>
3846+
3847+
If the <code>kraft.version</code> field is level 0 or absent, you are using a static quorum. If
3848+
it is 1 or above, you are using a dynamic quorum. For example, here is an example of a static
3849+
quorum:<p/>
3850+
<pre><code class="language-bash">
3851+
Feature: kraft.version SupportedMinVersion: 0 SupportedMaxVersion: 1 FinalizedVersionLevel: 0 Epoch: 5
3852+
Feature: metadata.version SupportedMinVersion: 3.0-IV1 SupportedMaxVersion: 3.9-IV0 FinalizedVersionLevel: 3.9-IV0 Epoch: 5
3853+
</code></pre><p/>
3854+
3855+
Here is another example of a static quorum:<p/>
3856+
<pre><code class="language-bash">
3857+
Feature: metadata.version SupportedMinVersion: 3.0-IV1 SupportedMaxVersion: 3.8-IV0 FinalizedVersionLevel: 3.8-IV0 Epoch: 5
3858+
</code></pre><p/>
3859+
3860+
Here is an example of a dynamic quorum:<p/>
3861+
<pre><code class="language-bash">
3862+
Feature: kraft.version SupportedMinVersion: 0 SupportedMaxVersion: 1 FinalizedVersionLevel: 1 Epoch: 5
3863+
Feature: metadata.version SupportedMinVersion: 3.0-IV1 SupportedMaxVersion: 3.9-IV0 FinalizedVersionLevel: 3.9-IV0 Epoch: 5
3864+
</code></pre><p/>
3865+
3866+
The static versus dynamic nature of the quorum is determined at the time of formatting.
3867+
Specifically, the quorum will be formatted as dynamic if <code>controller.quorum.voters</code> is
3868+
<b>not</b> present, and if the software version is Apache Kafka 3.9 or newer. If you have
3869+
followed the instructions earlier in this document, you will get a dynamic quorum.<p>
3870+
3871+
If you would like the formatting process to fail if a dynamic quorum cannot be achieved, format your
3872+
controllers using the <code>--feature kraft.version=1</code>. (Note that you should not supply
3873+
this flag when formatting brokers -- only when formatting controllers.)<p>
3874+
3875+
<pre><code class="language-bash">
3876+
$ bin/kafka-storage.sh format -t KAFKA_CLUSTER_ID --feature kraft.version=1 -c controller_static.properties
3877+
Cannot set kraft.version to 1 unless KIP-853 configuration is present. Try removing the --feature flag for kraft.version.
3878+
</code></pre><p>
3879+
3880+
Note: Currently it is <b>not</b> possible to convert clusters using a static controller quorum to
3881+
use a dynamic controller quorum. This function will be supported in the future release.
3882+
38273883
<h5 class="anchor-heading"><a id="kraft_reconfig_add" class="anchor-link"></a><a href="#kraft_reconfig_add">Add New Controller</a></h5>
3828-
If the KRaft Controller cluster already exists, the cluster can be expanded by first provisioning a new controller using the <a href="#kraft_storage_observers">kafka-storage tool</a> and starting the controller.
3884+
If a dynamic controller cluster already exists, it can be expanded by first provisioning a new controller using the <a href="#kraft_storage_observers">kafka-storage.sh tool</a> and starting the controller.
38293885

38303886
After starting the controller, the replication to the new controller can be monitored using the <code>kafka-metadata-quorum describe --replication</code> command. Once the new controller has caught up to the active controller, it can be added to the cluster using the <code>kafka-metadata-quorum add-controller</code> command.
38313887

@@ -3836,7 +3892,7 @@ <h5 class="anchor-heading"><a id="kraft_reconfig_add" class="anchor-link"></a><a
38363892
<pre><code class="language-bash">$ bin/kafka-metadata-quorum --command-config controller.properties --bootstrap-controller localhost:9092 add-controller</code></pre>
38373893

38383894
<h5 class="anchor-heading"><a id="kraft_reconfig_remove" class="anchor-link"></a><a href="#kraft_reconfig_remove">Remove Controller</a></h5>
3839-
If the KRaft Controller cluster already exists, the cluster can be shrunk using the <code>kafka-metadata-quorum remove-controller</code> command. Until KIP-996: Pre-vote has been implemented and released, it is recommended to shutdown the controller that will be removed before running the remove-controller command.
3895+
If the dynamic controller cluster already exists, it can be shrunk using the <code>bin/kafka-metadata-quorum.sh remove-controller</code> command. Until KIP-996: Pre-vote has been implemented and released, it is recommended to shutdown the controller that will be removed before running the remove-controller command.
38403896

38413897
When using broker endpoints use the --bootstrap-server flag:
38423898
<pre><code class="language-bash">$ bin/kafka-metadata-quorum --bootstrap-server localhost:9092 remove-controller --controller-id &lt;id&gt; --controller-directory-id &lt;directory-id&gt;</code></pre>

docs/upgrade.html

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,81 @@ <h5><a id="upgrade_390_notable" href="#upgrade_390_notable">Notable changes in 3
4141
See <a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-956+Tiered+Storage+Quotas">KIP-956</a> for more details.</li>
4242
</ul>
4343
</li>
44+
<li>Controller membership change in KRaft is now supported when formatting with `--standalone` or `--initial-controllers` option.
45+
See <a href="/{{version}}/documentation.html#kraft_reconfig">here</a> for more details.</li>
46+
</ul>
47+
48+
<h4><a id="upgrade_3_8_1" href="#upgrade_3_8_1">Upgrading to 3.8.1 from any version 0.8.x through 3.7.x</a></h4>
49+
50+
<h5><a id="upgrade_381_zk" href="#upgrade_381_zk">Upgrading ZooKeeper-based clusters</a></h5>
51+
<p><b>If you are upgrading from a version prior to 2.1.x, please see the note in step 5 below about the change to the schema used to store consumer offsets.
52+
Once you have changed the inter.broker.protocol.version to the latest version, it will not be possible to downgrade to a version prior to 2.1.</b></p>
53+
54+
<p><b>For a rolling upgrade:</b></p>
55+
56+
<ol>
57+
<li>Update server.properties on all brokers and add the following properties. CURRENT_KAFKA_VERSION refers to the version you
58+
are upgrading from. CURRENT_MESSAGE_FORMAT_VERSION refers to the message format version currently in use. If you have previously
59+
overridden the message format version, you should keep its current value. Alternatively, if you are upgrading from a version prior
60+
to 0.11.0.x, then CURRENT_MESSAGE_FORMAT_VERSION should be set to match CURRENT_KAFKA_VERSION.
61+
<ul>
62+
<li>inter.broker.protocol.version=CURRENT_KAFKA_VERSION (e.g. <code>3.7</code>, <code>3.6</code>, etc.)</li>
63+
<li>log.message.format.version=CURRENT_MESSAGE_FORMAT_VERSION (See <a href="#upgrade_10_performance_impact">potential performance impact
64+
following the upgrade</a> for the details on what this configuration does.)</li>
65+
</ul>
66+
If you are upgrading from version 0.11.0.x or above, and you have not overridden the message format, then you only need to override
67+
the inter-broker protocol version.
68+
<ul>
69+
<li>inter.broker.protocol.version=CURRENT_KAFKA_VERSION (e.g. <code>3.7</code>, <code>3.6</code>, etc.)</li>
70+
</ul>
71+
</li>
72+
<li>Upgrade the brokers one at a time: shut down the broker, update the code, and restart it. Once you have done so, the
73+
brokers will be running the latest version and you can verify that the cluster's behavior and performance meets expectations.
74+
It is still possible to downgrade at this point if there are any problems.
75+
</li>
76+
<li>Once the cluster's behavior and performance has been verified, bump the protocol version by editing
77+
<code>inter.broker.protocol.version</code> and setting it to <code>3.8</code>.
78+
</li>
79+
<li>Restart the brokers one by one for the new protocol version to take effect. Once the brokers begin using the latest
80+
protocol version, it will no longer be possible to downgrade the cluster to an older version.
81+
</li>
82+
<li>If you have overridden the message format version as instructed above, then you need to do one more rolling restart to
83+
upgrade it to its latest version. Once all (or most) consumers have been upgraded to 0.11.0 or later,
84+
change log.message.format.version to 3.8 on each broker and restart them one by one. Note that the older Scala clients,
85+
which are no longer maintained, do not support the message format introduced in 0.11, so to avoid conversion costs
86+
(or to take advantage of <a href="#upgrade_11_exactly_once_semantics">exactly once semantics</a>),
87+
the newer Java clients must be used.
88+
</li>
89+
</ol>
90+
91+
<h5><a id="upgrade_380_kraft" href="#upgrade_380_kraft">Upgrading KRaft-based clusters</a></h5>
92+
<p><b>If you are upgrading from a version prior to 3.3.0, please see the note in step 3 below. Once you have changed the metadata.version to the latest version, it will not be possible to downgrade to a version prior to 3.3-IV0.</b></p>
93+
94+
<p><b>For a rolling upgrade:</b></p>
95+
96+
<ol>
97+
<li>Upgrade the brokers one at a time: shut down the broker, update the code, and restart it. Once you have done so, the
98+
brokers will be running the latest version and you can verify that the cluster's behavior and performance meets expectations.
99+
</li>
100+
<li>Once the cluster's behavior and performance has been verified, bump the metadata.version by running
101+
<code>
102+
bin/kafka-features.sh upgrade --metadata 3.8
103+
</code>
104+
</li>
105+
<li>Note that cluster metadata downgrade is not supported in this version since it has metadata changes.
106+
Every <a href="https://github.com/apache/kafka/blob/trunk/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java">MetadataVersion</a>
107+
after 3.2.x has a boolean parameter that indicates if there are metadata changes (i.e. <code>IBP_3_3_IV3(7, "3.3", "IV3", true)</code> means this version has metadata changes).
108+
Given your current and target versions, a downgrade is only possible if there are no metadata changes in the versions between.</li>
109+
</ol>
110+
111+
<h5><a id="upgrade_381_notable" href="#upgrade_381_notable">Notable changes in 3.8.1</a></h5>
112+
<ul>
113+
<li>In case you run your Kafka clusters with no execution permission for the <code>/tmp</code> partition, Kafka will not work properly. It might either refuse to start or fail
114+
when producing and consuming messages. This is due to the compression libraries <code>zstd-jni</code> and <code>snappy</code>.
115+
To remediate this problem you need to pass the following JVM flags to Kafka <code>ZstdTempFolder</code> and <code>org.xerial.snappy.tempdir</code> pointing to a directory with execution permissions.
116+
For example, this could be done via the <code>KAFKA_OPTS</code> environment variable like follows: <code>export KAFKA_OPTS="-DZstdTempFolder=/opt/kafka/tmp -Dorg.xerial.snappy.tempdir=/opt/kafka/tmp"</code>.
117+
This is a known issue for version 3.8.0.
118+
</li>
44119
<li>In 3.8.0 the <code>kafka.utils.Thottler</code> metric was accidentally renamed to <code>org.apache.kafka.storage.internals.utils.Throttler</code>.
45120
This change has been reverted and the metric is now named <code>kafka.utils.Thottler</code> again.
46121
</li>

0 commit comments

Comments
 (0)