Skip to content

Commit

Permalink
add v2.2.0 feature & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zengqiao committed Jan 23, 2021
1 parent fc109fd commit 850d43d
Show file tree
Hide file tree
Showing 34 changed files with 427 additions and 154 deletions.
27 changes: 27 additions & 0 deletions docs/dev_guide/upgrade_manual/logi-km-v2.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

---

![kafka-manager-logo](../../assets/images/common/logo_name.png)

**一站式`Apache Kafka`集群指标监控与运维管控平台**

---

# 升级至`2.2.0`版本

`2.2.0`版本在`cluster`表及`logical_cluster`各增加了一个字段,因此需要执行下面的sql进行字段的增加。

```sql
# 往cluster表中增加jmx_properties字段, 这个字段会用于存储jmx相关的认证以及配置信息
ALTER TABLE `cluster` ADD COLUMN `jmx_properties` TEXT NULL COMMENT 'JMX配置' AFTER `security_properties`;

# 往logical_cluster中增加identification字段, 同时数据和原先name数据相同, 最后增加一个唯一键.
# 此后, name字段还是表示集群名称, 而identification字段表示的是集群标识, 只能是字母数字及下划线组成,
# 数据上报到监控系统时, 集群这个标识采用的字段就是identification字段, 之前使用的是name字段.
ALTER TABLE `logical_cluster` ADD COLUMN `identification` VARCHAR(192) NOT NULL DEFAULT '' COMMENT '逻辑集群标识' AFTER `name`;

UPDATE `logical_cluster` SET `identification`=`name` WHERE id>=0;

ALTER TABLE `logical_cluster` ADD INDEX `uniq_identification` (`identification` ASC);
```

36 changes: 22 additions & 14 deletions docs/install_guide/create_mysql_table.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-- create database
CREATE DATABASE logi_kafka_manager;

USE logi_kafka_manager;

--
-- Table structure for table `account`
--
Expand Down Expand Up @@ -104,7 +109,8 @@ CREATE TABLE `cluster` (
`zookeeper` varchar(512) NOT NULL DEFAULT '' COMMENT 'zk地址',
`bootstrap_servers` varchar(512) NOT NULL DEFAULT '' COMMENT 'server地址',
`kafka_version` varchar(32) NOT NULL DEFAULT '' COMMENT 'kafka版本',
`security_properties` text COMMENT '安全认证参数',
`security_properties` text COMMENT 'Kafka安全认证参数',
`jmx_properties` text COMMENT 'JMX配置',
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT ' 监控标记, 0表示未监控, 1表示监控中',
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
Expand Down Expand Up @@ -302,20 +308,22 @@ INSERT INTO kafka_user(app_id, password, user_type, operation) VALUES ('dkm_admi
-- Table structure for table `logical_cluster`
--

-- DROP TABLE IF EXISTS `logical_cluster`;
CREATE TABLE `logical_cluster` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(192) NOT NULL DEFAULT '' COMMENT '逻辑集群名称',
`mode` int(16) NOT NULL DEFAULT '0' COMMENT '逻辑集群类型, 0:共享集群, 1:独享集群, 2:独立集群',
`app_id` varchar(64) NOT NULL DEFAULT '' COMMENT '所属应用',
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
`region_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'regionid列表',
`description` text COMMENT '备注说明',
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='逻辑集群信息表';
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(192) NOT NULL DEFAULT '' COMMENT '逻辑集群名称',
`identification` varchar(192) NOT NULL DEFAULT '' COMMENT '逻辑集群标识',
`mode` int(16) NOT NULL DEFAULT '0' COMMENT '逻辑集群类型, 0:共享集群, 1:独享集群, 2:独立集群',
`app_id` varchar(64) NOT NULL DEFAULT '' COMMENT '所属应用',
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
`region_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'regionid列表',
`description` text COMMENT '备注说明',
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_name` (`name`),
UNIQUE KEY `uniq_identification` (`identification`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='逻辑集群信息表';


--
-- Table structure for table `monitor_rule`
Expand Down
48 changes: 27 additions & 21 deletions docs/install_guide/install_guide_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,56 @@

# 安装手册

## 1、环境依赖

## 环境依赖
如果是以Release包进行安装的,则仅安装`Java``MySQL`即可。如果是要先进行源码包进行打包,然后再使用,则需要安装`Maven``Node`环境。

- `Maven 3.5+`(后端打包依赖)
- `node v12+`(前端打包依赖)
- `Java 8+`(运行环境需要)
- `MySQL 5.7`(数据存储)
- `Maven 3.5+`(后端打包依赖)
- `Node 10+`(前端打包依赖)

---

## 环境初始化
## 2、获取安装包

执行[create_mysql_table.sql](create_mysql_table.sql)中的SQL命令,从而创建所需的MySQL库及表,默认创建的库名是`kafka_manager`
**1、Release直接下载**

```
# 示例:
mysql -uXXXX -pXXX -h XXX.XXX.XXX.XXX -PXXXX < ./create_mysql_table.sql
```
这里如果觉得麻烦,然后也不想进行二次开发,则可以直接下载Release包,下载地址:[Github Release包下载地址](https://github.com/didi/Logi-KafkaManager/releases)

如果觉得Github的下载地址太慢了,也可以进入`Logi-KafkaManager`的用户群获取,群地址在README中。

---

## 打包
**2、源代码进行打包**

```bash
下载好代码之后,进入`Logi-KafkaManager`的主目录,执行`sh build.sh`命令即可,执行完成之后会在`output/kafka-manager-xxx`目录下面生成一个jar包。

# 一次性打包
cd ..
mvn install
对于`windows`环境的用户,估计执行不了`sh build.sh`命令,因此可以直接执行`mvn install`,然后在`kafka-manager-web/target`目录下生成一个kafka-manager-web-xxx.jar的包。

获取到jar包之后,我们继续下面的步骤。

---

## 3、MySQL-DB初始化

执行[create_mysql_table.sql](create_mysql_table.sql)中的SQL命令,从而创建所需的MySQL库及表,默认创建的库名是`logi_kafka_manager`

```
# 示例:
mysql -uXXXX -pXXX -h XXX.XXX.XXX.XXX -PXXXX < ./create_mysql_table.sql
```

---

## 启动
## 4、启动

```
# application.yml 是配置文件
# application.yml 是配置文件,最简单的是仅修改MySQL相关的配置即可启动
cp kafka-manager-web/src/main/resources/application.yml kafka-manager-web/target/
cd kafka-manager-web/target/
nohup java -jar kafka-manager-web-2.1.0-SNAPSHOT.jar --spring.config.location=./application.yml > /dev/null 2>&1 &
nohup java -jar kafka-manager.jar --spring.config.location=./application.yml > /dev/null 2>&1 &
```

## 使用
### 5、使用

本地启动的话,访问`http://localhost:8080`,输入帐号及密码(默认`admin/admin`)进行登录。更多参考:[kafka-manager 用户使用手册](../user_guide/user_guide_cn.md)

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class LogicalCluster {

private String logicalClusterName;

private String logicalClusterIdentification;

private Integer mode;

private Integer topicNum;
Expand Down Expand Up @@ -41,6 +43,14 @@ public void setLogicalClusterName(String logicalClusterName) {
this.logicalClusterName = logicalClusterName;
}

public String getLogicalClusterIdentification() {
return logicalClusterIdentification;
}

public void setLogicalClusterIdentification(String logicalClusterIdentification) {
this.logicalClusterIdentification = logicalClusterIdentification;
}

public Integer getMode() {
return mode;
}
Expand Down Expand Up @@ -81,6 +91,14 @@ public void setBootstrapServers(String bootstrapServers) {
this.bootstrapServers = bootstrapServers;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public Long getGmtCreate() {
return gmtCreate;
}
Expand All @@ -97,19 +115,12 @@ public void setGmtModify(Long gmtModify) {
this.gmtModify = gmtModify;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

@Override
public String toString() {
return "LogicalCluster{" +
"logicalClusterId=" + logicalClusterId +
", logicalClusterName='" + logicalClusterName + '\'' +
", logicalClusterIdentification='" + logicalClusterIdentification + '\'' +
", mode=" + mode +
", topicNum=" + topicNum +
", clusterVersion='" + clusterVersion + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ public class ClusterDTO {
@ApiModelProperty(value="数据中心")
private String idc;

@ApiModelProperty(value="安全配置参数")
@ApiModelProperty(value="Kafka安全配置")
private String securityProperties;

@ApiModelProperty(value="Jmx配置")
private String jmxProperties;

public Long getClusterId() {
return clusterId;
}
Expand Down Expand Up @@ -78,6 +81,14 @@ public void setSecurityProperties(String securityProperties) {
this.securityProperties = securityProperties;
}

public String getJmxProperties() {
return jmxProperties;
}

public void setJmxProperties(String jmxProperties) {
this.jmxProperties = jmxProperties;
}

@Override
public String toString() {
return "ClusterDTO{" +
Expand All @@ -87,6 +98,7 @@ public String toString() {
", bootstrapServers='" + bootstrapServers + '\'' +
", idc='" + idc + '\'' +
", securityProperties='" + securityProperties + '\'' +
", jmxProperties='" + jmxProperties + '\'' +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class LogicalClusterDTO {
@ApiModelProperty(value = "名称")
private String name;

@ApiModelProperty(value = "集群标识, 用于告警的上报")
private String identification;

@ApiModelProperty(value = "集群模式")
private Integer mode;

Expand Down Expand Up @@ -52,6 +55,14 @@ public void setName(String name) {
this.name = name;
}

public String getIdentification() {
return identification;
}

public void setIdentification(String identification) {
this.identification = identification;
}

public Integer getMode() {
return mode;
}
Expand Down Expand Up @@ -97,6 +108,7 @@ public String toString() {
return "LogicalClusterDTO{" +
"id=" + id +
", name='" + name + '\'' +
", identification='" + identification + '\'' +
", mode=" + mode +
", clusterId=" + clusterId +
", regionIdList=" + regionIdList +
Expand All @@ -117,6 +129,7 @@ public boolean legal() {
}
appId = ValidateUtils.isNull(appId)? "": appId;
description = ValidateUtils.isNull(description)? "": description;
identification = ValidateUtils.isNull(identification)? name: identification;
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class ClusterDO implements Comparable<ClusterDO> {

private String securityProperties;

private String jmxProperties;

private Integer status;

private Date gmtCreate;
Expand All @@ -31,30 +33,6 @@ public void setId(Long id) {
this.id = id;
}

public Integer getStatus() {
return status;
}

public void setStatus(Integer status) {
this.status = status;
}

public Date getGmtCreate() {
return gmtCreate;
}

public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}

public Date getGmtModify() {
return gmtModify;
}

public void setGmtModify(Date gmtModify) {
this.gmtModify = gmtModify;
}

public String getClusterName() {
return clusterName;
}
Expand Down Expand Up @@ -87,6 +65,38 @@ public void setSecurityProperties(String securityProperties) {
this.securityProperties = securityProperties;
}

public String getJmxProperties() {
return jmxProperties;
}

public void setJmxProperties(String jmxProperties) {
this.jmxProperties = jmxProperties;
}

public Integer getStatus() {
return status;
}

public void setStatus(Integer status) {
this.status = status;
}

public Date getGmtCreate() {
return gmtCreate;
}

public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}

public Date getGmtModify() {
return gmtModify;
}

public void setGmtModify(Date gmtModify) {
this.gmtModify = gmtModify;
}

@Override
public String toString() {
return "ClusterDO{" +
Expand All @@ -95,6 +105,7 @@ public String toString() {
", zookeeper='" + zookeeper + '\'' +
", bootstrapServers='" + bootstrapServers + '\'' +
", securityProperties='" + securityProperties + '\'' +
", jmxProperties='" + jmxProperties + '\'' +
", status=" + status +
", gmtCreate=" + gmtCreate +
", gmtModify=" + gmtModify +
Expand Down
Loading

0 comments on commit 850d43d

Please sign in to comment.