doc-exports/docs/dms/umn/kafka-ug-0006.html
Chen, Junjie dd8a3a658b DMS UMN Initial Version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Chen, Junjie <chenjunjie@huawei.com>
Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
2022-12-08 00:33:11 +00:00

30 lines
6.1 KiB
HTML

<a name="kafka-ug-0006"></a><a name="kafka-ug-0006"></a>
<h1 class="topictitle1">Changing Partition Quantity</h1>
<div id="body0000001111609710"><p id="kafka-ug-0006__p5611595276">After creating a topic, you can increase the number of partitions based on service requirements.</p>
<div class="note" id="kafka-ug-0006__note16932250112213"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="kafka-ug-0006__p1593245052218">Changing the number of partitions does not affect services.</p>
</div></div>
<p id="kafka-ug-0006__p481511371998">Methods for changing the partition quantity:</p>
<ul id="kafka-ug-0006__ul1521515294111"><li id="kafka-ug-0006__li621562931110"><a href="#kafka-ug-0006__section11349555102717">Method 1: By Using the Console</a></li><li id="kafka-ug-0006__li965101814135"><a href="#kafka-ug-0006__section2227184716161">Method 2: By using Kafka CLI</a></li></ul>
<div class="section" id="kafka-ug-0006__section11349555102717"><a name="kafka-ug-0006__section11349555102717"></a><a name="section11349555102717"></a><h4 class="sectiontitle">Method 1: By Using the Console</h4><ol id="kafka-ug-0006__ol363518281765"><li id="kafka-ug-0006__li10427115412419"><span>Log in to the management console.</span></li><li id="kafka-ug-0006__li14905725134512"><span>Click <span><img id="kafka-ug-0006__image47311155134319" src="en-us_image_0143929918.png"></span> in the upper left corner to select a region.</span><p><div class="note" id="kafka-ug-0006__note596412409275"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="kafka-ug-0006__p11964174020277">Select the region where your Kafka instance is located.</p>
</div></div>
</p></li><li id="kafka-ug-0006__li076014201144"><span>Click <strong id="kafka-ug-0006__b4004497009576">Service List</strong> and choose <strong id="kafka-ug-0006__b7266307509576">Application</strong> &gt; <strong id="kafka-ug-0006__b15848465979576">Distributed Message Service</strong>. The Kafka instance list is displayed.</span></li><li id="kafka-ug-0006__li26520051765"><span>Click the desired Kafka instance to view the instance details.</span></li><li id="kafka-ug-0006__li6318234617851"><span>Click the <strong id="kafka-ug-0006__b1991111114412">Topics</strong> tab.</span></li><li id="kafka-ug-0006__li1169275344516"><span>Modify the number of partitions using either of the following methods:</span><p><ul id="kafka-ug-0006__ul1146071715465"><li id="kafka-ug-0006__li104997486113">Select one or more topics and click <strong id="kafka-ug-0006__b216983043218">Edit Topic</strong> in the upper left corner.</li><li id="kafka-ug-0006__li53063508319">In the row containing the desired topic, click <strong id="kafka-ug-0006__b7161114013324">Edit</strong>.</li></ul>
</p></li><li id="kafka-ug-0006__li195891923113810"><span>In the <strong id="kafka-ug-0006__b20912661078">Edit Topic</strong> dialog box, enter the number of partitions and click <strong id="kafka-ug-0006__b49121361574">OK</strong>.</span><p><div class="note" id="kafka-ug-0006__note629814128341"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="kafka-ug-0006__ul490861418346"><li id="kafka-ug-0006__li590851414342">The number of partitions can only be increased.</li><li id="kafka-ug-0006__li165296265343">To ensure performance, the Kafka console allows a maximum of 100 partitions for each topic.</li><li id="kafka-ug-0006__li389811618143">The total number of partitions of all topics cannot exceed the maximum number of partitions allowed by the instance.</li></ul>
</div></div>
</p></li></ol>
</div>
<div class="section" id="kafka-ug-0006__section2227184716161"><a name="kafka-ug-0006__section2227184716161"></a><a name="section2227184716161"></a><h4 class="sectiontitle">Method 2: By Using Kafka CLI</h4><p id="kafka-ug-0006__p168427588518">If your Kafka client version is later than 2.2, you can use <strong id="kafka-ug-0006__b20405425341">kafka-topics.sh</strong> to change the partition quantity.</p>
<ul id="kafka-ug-0006__ul14955625613"><li id="kafka-ug-0006__li15955620614">If SASL is not enabled for the Kafka instance, run the following command in the <strong id="kafka-ug-0006__b0801144143620">/</strong><em id="kafka-ug-0006__i46011240143614">{directory where the CLI is located}</em><strong id="kafka-ug-0006__b28084483616">/kafka_{version}/bin/</strong> directory to change the partition quantity:<pre class="screen" id="kafka-ug-0006__screen1719958142520">./kafka-topics.sh --bootstrap-server {broker_ip}:{port} --topic {topic_name} --alter --partitions {partition_num}</pre>
</li><li id="kafka-ug-0006__li2174501363">If SASL has been enabled for the Kafka instance, perform the following steps to change the partition quantity:<ol id="kafka-ug-0006__ol39441754276"><li id="kafka-ug-0006__li15966133810218">(Optional) If the SSL certificate configuration has been set, skip this step. Otherwise, perform the following operations:<p id="kafka-ug-0006__p2013074012213"><a name="kafka-ug-0006__li15966133810218"></a><a name="li15966133810218"></a>Create the <strong id="kafka-ug-0006__b1249710446344">ssl-user-config.properties</strong> file in the <strong id="kafka-ug-0006__b10497444113413">/config</strong> directory of the Kafka client and add the SSL certificate configurations by referring to <a href="kafka-ug-180801001.html#kafka-ug-180801001__li5414277457">3</a>.</p>
</li><li id="kafka-ug-0006__li529219395271">Run the following command in the <strong id="kafka-ug-0006__b9792135319360">/</strong><em id="kafka-ug-0006__i547065019367">{directory where the CLI is located}</em><strong id="kafka-ug-0006__b279315535368">/kafka_{version}/bin/</strong> directory to change the partition quantity:<pre class="screen" id="kafka-ug-0006__screen117611716133716">./kafka-topics.sh --bootstrap-server {broker_ip}:{port} --topic {topic_name} --alter --partitions {partition_num} --command-config ./config/ssl-user-config.properties </pre>
</li></ol>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="kafka-ug-0720001.html">Managing Topics</a></div>
</div>
</div>