Skip to content

Commit c199237

Browse files
author
zengqiao
committed
集群信息中,补充ZK配置字段
1 parent b4d44ef commit c199237

File tree

9 files changed

+71
-3
lines changed

9 files changed

+71
-3
lines changed

docs/install_guide/版本升级手册.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
### 6.2.0、升级至 `master` 版本
66

7-
暂无
7+
**SQL 变更**
8+
9+
```sql
10+
ALTER TABLE `ks_km_physical_cluster`
11+
ADD COLUMN `zk_properties` TEXT NULL COMMENT 'ZK配置' AFTER `jmx_properties`;
12+
```
813

914
### 6.2.1、升级至 `v3.0.0-beta.2`版本
1015

km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/bean/dto/cluster/ClusterPhyBaseDTO.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
44
import com.xiaojukeji.know.streaming.km.common.bean.dto.BaseDTO;
55
import com.xiaojukeji.know.streaming.km.common.bean.entity.config.JmxConfig;
6+
import com.xiaojukeji.know.streaming.km.common.bean.entity.config.ZKConfig;
67
import io.swagger.annotations.ApiModel;
78
import io.swagger.annotations.ApiModelProperty;
89
import lombok.Data;
@@ -34,4 +35,8 @@ public class ClusterPhyBaseDTO extends BaseDTO {
3435
@NotNull(message = "jmxProperties不允许为空")
3536
@ApiModelProperty(value="Jmx配置")
3637
protected JmxConfig jmxProperties;
38+
39+
// TODO 前端页面增加时,需要加一个不为空的限制
40+
@ApiModelProperty(value="ZK配置")
41+
protected ZKConfig zkProperties;
3742
}

km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/bean/entity/cluster/ClusterPhy.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ public class ClusterPhy implements Comparable<ClusterPhy>, EntifyIdInterface {
5353

5454
/**
5555
* jmx配置
56+
* @see com.xiaojukeji.know.streaming.km.common.bean.entity.config.JmxConfig
5657
*/
5758
private String jmxProperties;
5859

60+
/**
61+
* zk配置
62+
* @see com.xiaojukeji.know.streaming.km.common.bean.entity.config.ZKConfig
63+
*/
64+
private String zkProperties;
65+
5966
/**
6067
* 开启ACL
6168
* @see com.xiaojukeji.know.streaming.km.common.enums.cluster.ClusterAuthTypeEnum
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.xiaojukeji.know.streaming.km.common.bean.entity.config;
2+
3+
import io.swagger.annotations.ApiModel;
4+
import io.swagger.annotations.ApiModelProperty;
5+
import lombok.Data;
6+
7+
import java.io.Serializable;
8+
import java.util.Properties;
9+
10+
/**
11+
* @author zengqiao
12+
* @date 22/02/24
13+
*/
14+
@Data
15+
@ApiModel(description = "ZK配置")
16+
public class ZKConfig implements Serializable {
17+
@ApiModelProperty(value="ZK的jmx配置")
18+
private JmxConfig jmxConfig;
19+
20+
@ApiModelProperty(value="ZK是否开启secure", example = "false")
21+
private Boolean openSecure = false;
22+
23+
@ApiModelProperty(value="ZK的Session超时时间", example = "15000")
24+
private Long sessionTimeoutUnitMs = 15000L;
25+
26+
@ApiModelProperty(value="ZK的Request超时时间", example = "5000")
27+
private Long requestTimeoutUnitMs = 5000L;
28+
29+
@ApiModelProperty(value="ZK的Request超时时间")
30+
private Properties otherProps = new Properties();
31+
}

km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/bean/po/cluster/ClusterPhyPO.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public class ClusterPhyPO extends BasePO {
4141
*/
4242
private String jmxProperties;
4343

44+
/**
45+
* zk配置
46+
*/
47+
private String zkProperties;
48+
4449
/**
4550
* 认证类型
4651
* @see com.xiaojukeji.know.streaming.km.common.enums.cluster.ClusterAuthTypeEnum

km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/bean/vo/cluster/ClusterPhyBaseVO.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public class ClusterPhyBaseVO extends BaseTimeVO {
3131
@ApiModelProperty(value="Jmx配置", example = "{}")
3232
protected String jmxProperties;
3333

34+
@ApiModelProperty(value="ZK配置", example = "{}")
35+
protected String zkProperties;
36+
3437
@ApiModelProperty(value="描述", example = "测试")
3538
protected String description;
3639

km-common/src/main/java/com/xiaojukeji/know/streaming/km/common/converter/ClusterConverter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public static ClusterPhyPO convert2ClusterPhyPO(ClusterPhyAddDTO dto) {
1919
ClusterPhyPO clusterPhyPO = ConvertUtil.obj2Obj(dto, ClusterPhyPO.class);
2020
clusterPhyPO.setClientProperties(ConvertUtil.obj2Json(dto.getClientProperties()));
2121
clusterPhyPO.setJmxProperties(ConvertUtil.obj2Json(dto.getJmxProperties()));
22+
if (ValidateUtils.isNull(dto.getZkProperties())) {
23+
clusterPhyPO.setZkProperties("");
24+
} else {
25+
clusterPhyPO.setZkProperties(ConvertUtil.obj2Json(dto.getZkProperties()));
26+
}
2227
clusterPhyPO.setRunState(
2328
ValidateUtils.isBlank(dto.getZookeeper())?
2429
ClusterRunStateEnum.RUN_RAFT.getRunState() :
@@ -32,6 +37,11 @@ public static ClusterPhyPO convert2ClusterPhyPO(ClusterPhyModifyDTO dto) {
3237
ClusterPhyPO clusterPhyPO = ConvertUtil.obj2Obj(dto, ClusterPhyPO.class);
3338
clusterPhyPO.setClientProperties(ConvertUtil.obj2Json(dto.getClientProperties()));
3439
clusterPhyPO.setJmxProperties(ConvertUtil.obj2Json(dto.getJmxProperties()));
40+
if (ValidateUtils.isNull(dto.getZkProperties())) {
41+
clusterPhyPO.setZkProperties("");
42+
} else {
43+
clusterPhyPO.setZkProperties(ConvertUtil.obj2Json(dto.getZkProperties()));
44+
}
3545
clusterPhyPO.setRunState(
3646
ValidateUtils.isBlank(dto.getZookeeper())?
3747
ClusterRunStateEnum.RUN_RAFT.getRunState() :

km-dist/init/sql/ddl-ks-km.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ CREATE TABLE `ks_km_physical_cluster` (
257257
`kafka_version` varchar(32) NOT NULL DEFAULT '' COMMENT 'kafka版本',
258258
`client_properties` text COMMENT 'Kafka客户端配置',
259259
`jmx_properties` text COMMENT 'JMX配置',
260+
`zk_properties` text COMMENT 'ZK配置',
260261
`description` text COMMENT '备注',
261262
`auth_type` int(11) NOT NULL DEFAULT '0' COMMENT '认证类型,-1未知,0:无认证,',
262263
`run_state` tinyint(4) NOT NULL DEFAULT '1' COMMENT '运行状态, 0表示未监控, 1监控中,有ZK,2:监控中,无ZK',

km-persistence/src/main/resources/mybatis/ClusterPhyMapper.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<result column="kafka_version" property="kafkaVersion" />
1414
<result column="client_properties" property="clientProperties" />
1515
<result column="jmx_properties" property="jmxProperties" />
16+
<result column="zk_properties" property="zkProperties" />
1617
<result column="auth_type" property="authType" />
1718
<result column="run_state" property="runState" />
1819
<result column="description" property="description" />
@@ -23,8 +24,8 @@
2324
useGeneratedKeys="true"
2425
keyProperty="id">
2526
INSERT INTO ks_km_physical_cluster
26-
(name, zookeeper, bootstrap_servers, kafka_version, client_properties, jmx_properties, description, auth_type, run_state)
27+
(name, zookeeper, bootstrap_servers, kafka_version, client_properties, jmx_properties, zk_properties, description, auth_type, run_state)
2728
VALUES
28-
(#{name}, #{zookeeper}, #{bootstrapServers}, #{kafkaVersion}, #{clientProperties}, #{jmxProperties}, #{description}, #{authType}, #{runState})
29+
(#{name}, #{zookeeper}, #{bootstrapServers}, #{kafkaVersion}, #{clientProperties}, #{jmxProperties}, #{zkProperties}, #{description}, #{authType}, #{runState})
2930
</insert>
3031
</mapper>

0 commit comments

Comments
 (0)