diff --git a/README.md b/README.md index 6dfc65d..009136b 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ sh bin/shutdown.sh ## 注意 前后分离,直接启动后端如果未编译前端代码是没有前端页面的,可以先打包进行编译`sh package.sh`,然后再用idea启动,或者前端部分单独启动 # 页面示例 +如果未启用ACL配置,不会显示ACL的菜单页面,所以导航栏上没有Acl这一项 + ![集群](./document/集群.png) ![Topic](./document/Topic.png) ![消费组](./document/消费组.png) diff --git a/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java b/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java index 5bdc960..0c3f0e4 100644 --- a/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java +++ b/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java @@ -157,6 +157,7 @@ public class TopicServiceImpl implements TopicService { tuple2 = topicConsole.configThrottle(topic, partitions); break; case OFF: + tuple2 = topicConsole.clearThrottle(topic); break; default: throw new IllegalArgumentException("switch is unknown."); diff --git a/src/main/scala/kafka/console/TopicConsole.scala b/src/main/scala/kafka/console/TopicConsole.scala index 946e496..61905e9 100644 --- a/src/main/scala/kafka/console/TopicConsole.scala +++ b/src/main/scala/kafka/console/TopicConsole.scala @@ -224,6 +224,16 @@ class TopicConsole(config: KafkaConfig) extends KafkaConsole(config: KafkaConfig }).asInstanceOf[(Boolean, String)] } + def clearThrottle(topic: String): (Boolean, String) = { + withAdminClientAndCatchError(admin => { + clearTopicLevelThrottles(admin, Collections.singleton(topic).asScala.toSet) + (true, "") + }, e => { + log.error("clearThrottle error, ", e) + (false, e.getMessage) + }).asInstanceOf[(Boolean, String)] + } + /** * Get the current replica assignments for some topics. * diff --git a/ui/src/views/topic/ConfigTopicThrottle.vue b/ui/src/views/topic/ConfigTopicThrottle.vue index d2f25bc..1deeb40 100644 --- a/ui/src/views/topic/ConfigTopicThrottle.vue +++ b/ui/src/views/topic/ConfigTopicThrottle.vue @@ -18,7 +18,23 @@ :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }" > - + + + 配置限流 + 移除所有分区限流配置 + + + + - - - 开启限流配置 - 移除限流配置 - -

说明:

@@ -93,6 +95,7 @@ export default { loading: false, form: this.$form.createForm(this, { name: "RemoveThrottleForm" }), partitions: [], + showPartition: true, }; }, watch: { @@ -100,6 +103,7 @@ export default { this.show = v; if (this.show) { this.getPartitionInfo(); + this.showPartition = true; } }, }, @@ -128,7 +132,7 @@ export default { ok() { this.form.validateFields((err, values) => { if (!err) { - const data = Object.assign({}, values, {topic: this.topic}); + const data = Object.assign({}, values, { topic: this.topic }); this.loading = true; request({ url: KafkaTopicApi.configThrottle.url, @@ -149,6 +153,9 @@ export default { } }); }, + onChange(e) { + this.showPartition = !(e.target.value == "OFF"); + }, }, }; diff --git a/ui/src/views/topic/UpdateReplica.vue b/ui/src/views/topic/UpdateReplica.vue index d8b7299..3a3240f 100644 --- a/ui/src/views/topic/UpdateReplica.vue +++ b/ui/src/views/topic/UpdateReplica.vue @@ -57,6 +57,10 @@ 运维->副本变更详情 处查看,也可以在那里将正在进行的任务取消。

+

+ *如果是减少副本,不用限流。如果是增加副本数,副本同步的时候如果有大量消息需要同步,可能占用大量带宽,担心会影响集群的稳定,考虑是否开启限流。同步完成可以再把该topic的限流关毕。关闭操作可以点击 + 限流按钮 处理。 +