移除topic 限流

This commit is contained in:
许晓东
2021-11-27 20:49:46 +08:00
parent 34c87997d1
commit e881c58a8f
5 changed files with 40 additions and 16 deletions

View File

@@ -78,6 +78,8 @@ sh bin/shutdown.sh
## 注意
前后分离,直接启动后端如果未编译前端代码是没有前端页面的,可以先打包进行编译`sh package.sh`然后再用idea启动或者前端部分单独启动
# 页面示例
如果未启用ACL配置不会显示ACL的菜单页面所以导航栏上没有Acl这一项
![集群](./document/集群.png)
![Topic](./document/Topic.png)
![消费组](./document/消费组.png)

View File

@@ -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.");

View File

@@ -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.
*

View File

@@ -18,7 +18,23 @@
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
<a-form-item label="选择分区">
<a-form-item label="操作">
<a-radio-group
@change="onChange"
v-decorator="[
'operation',
{
initialValue: 'ON',
rules: [{ required: true, message: '请选择一个操作!' }],
},
]"
>
<a-radio value="ON"> 配置限流 </a-radio>
<a-radio value="OFF"> 移除所有分区限流配置 </a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="选择分区" v-show="showPartition">
<a-select
mode="multiple"
option-filter-prop="children"
@@ -36,20 +52,6 @@
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="操作">
<a-radio-group
v-decorator="[
'operation',
{
initialValue: 'ON',
rules: [{ required: true, message: '请选择一个操作!' }],
},
]"
>
<a-radio value="ON"> 开启限流配置 </a-radio>
<a-radio value="OFF"> 移除限流配置 </a-radio>
</a-radio-group>
</a-form-item>
</a-form>
<hr />
<h4>说明:</h4>
@@ -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");
},
},
};
</script>

View File

@@ -57,6 +57,10 @@
<span style="color: red">运维->副本变更详情</span>
处查看也可以在那里将正在进行的任务取消
</p>
<p>
*如果是减少副本不用限流如果是增加副本数副本同步的时候如果有大量消息需要同步可能占用大量带宽担心会影响集群的稳定考虑是否开启限流同步完成可以再把该topic的限流关毕关闭操作可以点击
限流按钮 处理
</p>
</a-spin>
</div>
</a-modal>