diff --git a/distribution/bin/shutdown.cmd b/distribution/bin/shutdown.cmd
new file mode 100755
index 00000000..e3ae899e
--- /dev/null
+++ b/distribution/bin/shutdown.cmd
@@ -0,0 +1,24 @@
+@echo off
+rem Copyright 1999-2018 Alibaba Group Holding Ltd.
+rem Licensed under the Apache License, Version 2.0 (the "License");
+rem you may not use this file except in compliance with the License.
+rem You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
+
+setlocal
+
+set "PATH=%JAVA_HOME%\bin;%PATH%"
+
+echo killing nacos server
+
+for /f "tokens=1" %%i in ('jps -m ^| find "nacos.nacos"') do ( taskkill /F /PID %%i )
+
+echo Done!
diff --git a/distribution/bin/shutdown.sh b/distribution/bin/shutdown.sh
new file mode 100644
index 00000000..e3e14fed
--- /dev/null
+++ b/distribution/bin/shutdown.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Copyright 1999-2018 Alibaba Group Holding Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+cd `dirname $0`/../target
+target_dir=`pwd`
+
+pid=`ps ax | grep -i 'nacos.nacos' | grep ${target_dir} | grep java | grep -v grep | awk '{print $1}'`
+if [ -z "$pid" ] ; then
+ echo "No nacosServer running."
+ exit -1;
+fi
+
+echo "The nacosServer(${pid}) is running..."
+
+kill ${pid}
+
+echo "Send shutdown request to nacosServer(${pid}) OK"
diff --git a/distribution/bin/startup.cmd b/distribution/bin/startup.cmd
new file mode 100755
index 00000000..c9910877
--- /dev/null
+++ b/distribution/bin/startup.cmd
@@ -0,0 +1,95 @@
+@echo off
+rem Copyright 1999-2018 Alibaba Group Holding Ltd.
+rem Licensed under the Apache License, Version 2.0 (the "License");
+rem you may not use this file except in compliance with the License.
+rem You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
+set "JAVA=%JAVA_HOME%\bin\java.exe"
+
+setlocal enabledelayedexpansion
+
+set BASE_DIR=%~dp0
+rem added double quotation marks to avoid the issue caused by the folder names containing spaces.
+rem removed the last 5 chars(which means \bin\) to get the base DIR.
+set BASE_DIR="%BASE_DIR:~0,-5%"
+
+set CUSTOM_SEARCH_LOCATIONS=file:%BASE_DIR%/conf/
+
+set MODE="cluster"
+set FUNCTION_MODE="all"
+set SERVER=nacos-server
+set MODE_INDEX=-1
+set FUNCTION_MODE_INDEX=-1
+set SERVER_INDEX=-1
+set EMBEDDED_STORAGE_INDEX=-1
+set EMBEDDED_STORAGE=""
+
+
+set i=0
+for %%a in (%*) do (
+ if "%%a" == "-m" ( set /a MODE_INDEX=!i!+1 )
+ if "%%a" == "-f" ( set /a FUNCTION_MODE_INDEX=!i!+1 )
+ if "%%a" == "-s" ( set /a SERVER_INDEX=!i!+1 )
+ if "%%a" == "-p" ( set /a EMBEDDED_STORAGE_INDEX=!i!+1 )
+ set /a i+=1
+)
+
+set i=0
+for %%a in (%*) do (
+ if %MODE_INDEX% == !i! ( set MODE="%%a" )
+ if %FUNCTION_MODE_INDEX% == !i! ( set FUNCTION_MODE="%%a" )
+ if %SERVER_INDEX% == !i! (set SERVER="%%a")
+ if %EMBEDDED_STORAGE_INDEX% == !i! (set EMBEDDED_STORAGE="%%a")
+ set /a i+=1
+)
+
+rem if nacos startup mode is standalone
+if %MODE% == "standalone" (
+ echo "nacos is starting with standalone"
+ set "NACOS_OPTS=-Dnacos.standalone=true"
+ set "NACOS_JVM_OPTS=-Xms512m -Xmx512m -Xmn256m"
+)
+
+rem if nacos startup mode is cluster
+if %MODE% == "cluster" (
+ echo "nacos is starting with cluster"
+ if %EMBEDDED_STORAGE% == "embedded" (
+ set "NACOS_OPTS=-DembeddedStorage=true"
+ )
+
+ set "NACOS_JVM_OPTS=-server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof -XX:-UseLargePages"
+)
+
+rem set nacos's functionMode
+if %FUNCTION_MODE% == "config" (
+ set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=config"
+)
+
+if %FUNCTION_MODE% == "naming" (
+ set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=naming"
+)
+
+rem set nacos options
+set "NACOS_OPTS=%NACOS_OPTS% -Dloader.path=%BASE_DIR%/plugins/health,%BASE_DIR%/plugins/cmdb"
+set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.home=%BASE_DIR%"
+set "NACOS_OPTS=%NACOS_OPTS% -jar %BASE_DIR%\target\%SERVER%.jar"
+
+rem set nacos spring config location
+set "NACOS_CONFIG_OPTS=--spring.config.additional-location=%CUSTOM_SEARCH_LOCATIONS%"
+
+rem set nacos log4j file location
+set "NACOS_LOG4J_OPTS=--logging.config=%BASE_DIR%/conf/nacos-logback.xml"
+
+
+set COMMAND="%JAVA%" %NACOS_JVM_OPTS% %NACOS_OPTS% %NACOS_CONFIG_OPTS% %NACOS_LOG4J_OPTS% nacos.nacos %*
+
+rem start nacos command
+%COMMAND%
diff --git a/distribution/bin/startup.sh b/distribution/bin/startup.sh
new file mode 100644
index 00000000..f16c5e6c
--- /dev/null
+++ b/distribution/bin/startup.sh
@@ -0,0 +1,142 @@
+#!/bin/bash
+
+# Copyright 1999-2018 Alibaba Group Holding Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cygwin=false
+darwin=false
+os400=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+Darwin*) darwin=true;;
+OS400*) os400=true;;
+esac
+error_exit ()
+{
+ echo "ERROR: $1 !!"
+ exit 1
+}
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
+[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/taobao/java
+[ ! -e "$JAVA_HOME/bin/java" ] && unset JAVA_HOME
+
+if [ -z "$JAVA_HOME" ]; then
+ if $darwin; then
+
+ if [ -x '/usr/libexec/java_home' ] ; then
+ export JAVA_HOME=`/usr/libexec/java_home`
+
+ elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then
+ export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
+ fi
+ else
+ JAVA_PATH=`dirname $(readlink -f $(which javac))`
+ if [ "x$JAVA_PATH" != "x" ]; then
+ export JAVA_HOME=`dirname $JAVA_PATH 2>/dev/null`
+ fi
+ fi
+ if [ -z "$JAVA_HOME" ]; then
+ error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!"
+ fi
+fi
+
+export SERVER="nacos-server"
+export MODE="cluster"
+export FUNCTION_MODE="all"
+export MEMBER_LIST=""
+export EMBEDDED_STORAGE=""
+while getopts ":m:f:s:c:p:" opt
+do
+ case $opt in
+ m)
+ MODE=$OPTARG;;
+ f)
+ FUNCTION_MODE=$OPTARG;;
+ s)
+ SERVER=$OPTARG;;
+ c)
+ MEMBER_LIST=$OPTARG;;
+ p)
+ EMBEDDED_STORAGE=$OPTARG;;
+ ?)
+ echo "Unknown parameter"
+ exit 1;;
+ esac
+done
+
+export JAVA_HOME
+export JAVA="$JAVA_HOME/bin/java"
+export BASE_DIR=`cd $(dirname $0)/..; pwd`
+export CUSTOM_SEARCH_LOCATIONS=file:${BASE_DIR}/conf/
+
+#===========================================================================================
+# JVM Configuration
+#===========================================================================================
+if [[ "${MODE}" == "standalone" ]]; then
+ JAVA_OPT="${JAVA_OPT} -Xms512m -Xmx512m -Xmn256m"
+ JAVA_OPT="${JAVA_OPT} -Dnacos.standalone=true"
+else
+ if [[ "${EMBEDDED_STORAGE}" == "embedded" ]]; then
+ JAVA_OPT="${JAVA_OPT} -DembeddedStorage=true"
+ fi
+ JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
+ JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASE_DIR}/logs/java_heapdump.hprof"
+ JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages"
+
+fi
+
+if [[ "${FUNCTION_MODE}" == "config" ]]; then
+ JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=config"
+elif [[ "${FUNCTION_MODE}" == "naming" ]]; then
+ JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=naming"
+fi
+
+JAVA_OPT="${JAVA_OPT} -Dnacos.member.list=${MEMBER_LIST}"
+
+JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p')
+if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
+ JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400"
+else
+ JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext"
+ JAVA_OPT="${JAVA_OPT} -Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
+fi
+
+JAVA_OPT="${JAVA_OPT} -Dloader.path=${BASE_DIR}/plugins/health,${BASE_DIR}/plugins/cmdb"
+JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"
+JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/${SERVER}.jar"
+JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
+JAVA_OPT="${JAVA_OPT} --spring.config.additional-location=${CUSTOM_SEARCH_LOCATIONS}"
+JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml"
+JAVA_OPT="${JAVA_OPT} --server.max-http-header-size=524288"
+
+if [ ! -d "${BASE_DIR}/logs" ]; then
+ mkdir ${BASE_DIR}/logs
+fi
+
+echo "$JAVA ${JAVA_OPT}"
+
+if [[ "${MODE}" == "standalone" ]]; then
+ echo "nacos is starting with standalone"
+else
+ echo "nacos is starting with cluster"
+fi
+
+# check the start.out log output file
+if [ ! -f "${BASE_DIR}/logs/start.out" ]; then
+ touch "${BASE_DIR}/logs/start.out"
+fi
+# start
+echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 &
+nohup $JAVA ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 &
+echo "nacos is starting,you can check the ${BASE_DIR}/logs/start.out"
diff --git a/distribution/conf/application.yml b/distribution/conf/application.yml
new file mode 100644
index 00000000..1ca6a22e
--- /dev/null
+++ b/distribution/conf/application.yml
@@ -0,0 +1,98 @@
+server:
+ port: 8081
+ tomcat:
+ accept-count: 1000
+ max-connections: 10000
+ max-threads: 800
+ min-spare-threads: 100
+
+spring:
+ application:
+ name: kafkamanager
+ datasource:
+ kafka-manager:
+ jdbc-url: jdbc:mysql://localhost:3306/logi_kafka_manager?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
+ username: root
+ password: 123456
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ main:
+ allow-bean-definition-overriding: true
+
+ profiles:
+ active: dev
+ servlet:
+ multipart:
+ max-file-size: 100MB
+ max-request-size: 100MB
+
+logging:
+ config: classpath:logback-spring.xml
+
+custom:
+ idc: cn
+ jmx:
+ max-conn: 10 # 2.3版本配置不在这个地方生效
+ store-metrics-task:
+ community:
+ broker-metrics-enabled: true
+ topic-metrics-enabled: true
+ didi:
+ app-topic-metrics-enabled: false
+ topic-request-time-metrics-enabled: false
+ topic-throttled-metrics: false
+ save-days: 7
+
+# 任务相关的开关
+task:
+ op:
+ sync-topic-enabled: false # 未落盘的Topic定期同步到DB中
+ order-auto-exec: # 工单自动化审批线程的开关
+ topic-enabled: false # Topic工单自动化审批开关, false:关闭自动化审批, true:开启
+ app-enabled: false # App工单自动化审批开关, false:关闭自动化审批, true:开启
+
+account:
+ ldap:
+ enabled: false
+ url: ldap://127.0.0.1:389/
+ basedn: dc=tsign,dc=cn
+ factory: com.sun.jndi.ldap.LdapCtxFactory
+ filter: sAMAccountName
+ security:
+ authentication: simple
+ principal: cn=admin,dc=tsign,dc=cn
+ credentials: admin
+ auth-user-registration: true
+ auth-user-registration-role: normal
+
+kcm:
+ enabled: false
+ s3:
+ endpoint: s3.didiyunapi.com
+ access-key: 1234567890
+ secret-key: 0987654321
+ bucket: logi-kafka
+ n9e:
+ base-url: http://127.0.0.1:8004
+ user-token: 12345678
+ timeout: 300
+ account: root
+ script-file: kcm_script.sh
+
+monitor:
+ enabled: false
+ n9e:
+ nid: 2
+ user-token: 1234567890
+ mon:
+ base-url: http://127.0.0.1:8032
+ sink:
+ base-url: http://127.0.0.1:8006
+ rdb:
+ base-url: http://127.0.0.1:80
+
+notify:
+ kafka:
+ cluster-id: 95
+ topic-name: didi-kafka-notify
+ order:
+ detail-url: http://127.0.0.1
diff --git a/distribution/conf/application.yml.example b/distribution/conf/application.yml.example
new file mode 100644
index 00000000..1ca6a22e
--- /dev/null
+++ b/distribution/conf/application.yml.example
@@ -0,0 +1,98 @@
+server:
+ port: 8081
+ tomcat:
+ accept-count: 1000
+ max-connections: 10000
+ max-threads: 800
+ min-spare-threads: 100
+
+spring:
+ application:
+ name: kafkamanager
+ datasource:
+ kafka-manager:
+ jdbc-url: jdbc:mysql://localhost:3306/logi_kafka_manager?characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
+ username: root
+ password: 123456
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ main:
+ allow-bean-definition-overriding: true
+
+ profiles:
+ active: dev
+ servlet:
+ multipart:
+ max-file-size: 100MB
+ max-request-size: 100MB
+
+logging:
+ config: classpath:logback-spring.xml
+
+custom:
+ idc: cn
+ jmx:
+ max-conn: 10 # 2.3版本配置不在这个地方生效
+ store-metrics-task:
+ community:
+ broker-metrics-enabled: true
+ topic-metrics-enabled: true
+ didi:
+ app-topic-metrics-enabled: false
+ topic-request-time-metrics-enabled: false
+ topic-throttled-metrics: false
+ save-days: 7
+
+# 任务相关的开关
+task:
+ op:
+ sync-topic-enabled: false # 未落盘的Topic定期同步到DB中
+ order-auto-exec: # 工单自动化审批线程的开关
+ topic-enabled: false # Topic工单自动化审批开关, false:关闭自动化审批, true:开启
+ app-enabled: false # App工单自动化审批开关, false:关闭自动化审批, true:开启
+
+account:
+ ldap:
+ enabled: false
+ url: ldap://127.0.0.1:389/
+ basedn: dc=tsign,dc=cn
+ factory: com.sun.jndi.ldap.LdapCtxFactory
+ filter: sAMAccountName
+ security:
+ authentication: simple
+ principal: cn=admin,dc=tsign,dc=cn
+ credentials: admin
+ auth-user-registration: true
+ auth-user-registration-role: normal
+
+kcm:
+ enabled: false
+ s3:
+ endpoint: s3.didiyunapi.com
+ access-key: 1234567890
+ secret-key: 0987654321
+ bucket: logi-kafka
+ n9e:
+ base-url: http://127.0.0.1:8004
+ user-token: 12345678
+ timeout: 300
+ account: root
+ script-file: kcm_script.sh
+
+monitor:
+ enabled: false
+ n9e:
+ nid: 2
+ user-token: 1234567890
+ mon:
+ base-url: http://127.0.0.1:8032
+ sink:
+ base-url: http://127.0.0.1:8006
+ rdb:
+ base-url: http://127.0.0.1:80
+
+notify:
+ kafka:
+ cluster-id: 95
+ topic-name: didi-kafka-notify
+ order:
+ detail-url: http://127.0.0.1
diff --git a/distribution/conf/create_mysql_table.sql b/distribution/conf/create_mysql_table.sql
new file mode 100644
index 00000000..12910ae1
--- /dev/null
+++ b/distribution/conf/create_mysql_table.sql
@@ -0,0 +1,591 @@
+-- create database
+CREATE DATABASE logi_kafka_manager;
+
+USE logi_kafka_manager;
+
+--
+-- Table structure for table `account`
+--
+
+-- DROP TABLE IF EXISTS `account`;
+CREATE TABLE `account` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '用户名',
+ `password` varchar(128) NOT NULL DEFAULT '' COMMENT '密码',
+ `role` tinyint(8) NOT NULL DEFAULT '0' COMMENT '角色类型, 0:普通用户 1:研发 2:运维',
+ `status` int(16) NOT NULL DEFAULT '0' 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 '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_username` (`username`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='账号表';
+INSERT INTO account(username, password, role) VALUES ('admin', '21232f297a57a5a743894a0e4a801fc3', 2);
+
+--
+-- Table structure for table `app`
+--
+
+-- DROP TABLE IF EXISTS `app`;
+CREATE TABLE `app` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT '应用id',
+ `name` varchar(192) NOT NULL DEFAULT '' COMMENT '应用名称',
+ `password` varchar(256) NOT NULL DEFAULT '' COMMENT '应用密码',
+ `type` int(11) NOT NULL DEFAULT '0' COMMENT '类型, 0:普通用户, 1:超级用户',
+ `applicant` varchar(64) NOT NULL DEFAULT '' COMMENT '申请人',
+ `principals` text COMMENT '应用负责人',
+ `description` text COMMENT '应用描述',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_name` (`name`),
+ UNIQUE KEY `uniq_app_id` (`app_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='应用信息';
+
+
+--
+-- Table structure for table `authority`
+--
+
+-- DROP TABLE IF EXISTS `authority`;
+CREATE TABLE `authority` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `app_id` varchar(128) NOT NULL DEFAULT '' COMMENT '应用id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `access` int(11) NOT NULL DEFAULT '0' COMMENT '0:无权限, 1:读, 2:写, 3:读写',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_app_id_cluster_id_topic_name` (`app_id`,`cluster_id`,`topic_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='权限信息(kafka-manager)';
+
+--
+-- Table structure for table `broker`
+--
+
+-- DROP TABLE IF EXISTS `broker`;
+CREATE TABLE `broker` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `broker_id` int(16) NOT NULL DEFAULT '-1' COMMENT 'brokerid',
+ `host` varchar(128) NOT NULL DEFAULT '' COMMENT 'broker主机名',
+ `port` int(16) NOT NULL DEFAULT '-1' COMMENT 'broker端口',
+ `timestamp` bigint(20) NOT NULL DEFAULT '-1' COMMENT '启动时间',
+ `max_avg_bytes_in` bigint(20) NOT NULL DEFAULT '-1' COMMENT '峰值的均值流量',
+ `version` varchar(128) NOT NULL DEFAULT '' COMMENT 'broker版本',
+ `status` int(16) NOT NULL DEFAULT '0' 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 '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_cluster_id_broker_id` (`cluster_id`,`broker_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='broker信息表';
+
+--
+-- Table structure for table `broker_metrics`
+--
+
+-- DROP TABLE IF EXISTS `broker_metrics`;
+CREATE TABLE `broker_metrics` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `broker_id` int(16) NOT NULL DEFAULT '-1' COMMENT 'brokerid',
+ `metrics` text COMMENT '指标',
+ `messages_in` double(53,2) NOT NULL DEFAULT '0.00' COMMENT '每秒消息数流入',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_cluster_id_broker_id_gmt_create` (`cluster_id`,`broker_id`,`gmt_create`),
+ KEY `idx_gmt_create` (`gmt_create`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='broker-metric信息表';
+
+--
+-- Table structure for table `cluster`
+--
+
+-- DROP TABLE IF EXISTS `cluster`;
+CREATE TABLE `cluster` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '集群id',
+ `cluster_name` varchar(128) NOT NULL DEFAULT '' COMMENT '集群名称',
+ `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 '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 '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_cluster_name` (`cluster_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='cluster信息表';
+
+--
+-- Table structure for table `cluster_metrics`
+--
+
+-- DROP TABLE IF EXISTS `cluster_metrics`;
+CREATE TABLE `cluster_metrics` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `metrics` text COMMENT '指标',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_cluster_id_gmt_create` (`cluster_id`,`gmt_create`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='clustermetrics信息';
+
+--
+-- Table structure for table `cluster_tasks`
+--
+
+-- DROP TABLE IF EXISTS `cluster_tasks`;
+CREATE TABLE `cluster_tasks` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `uuid` varchar(128) NOT NULL DEFAULT '' COMMENT '任务UUID',
+ `cluster_id` bigint(128) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `task_type` varchar(128) NOT NULL DEFAULT '' COMMENT '任务类型',
+ `kafka_package` text COMMENT 'kafka包',
+ `kafka_package_md5` varchar(128) NOT NULL DEFAULT '' COMMENT 'kafka包的md5',
+ `server_properties` text COMMENT 'kafkaserver配置',
+ `server_properties_md5` varchar(128) NOT NULL DEFAULT '' COMMENT '配置文件的md5',
+ `agent_task_id` bigint(128) NOT NULL DEFAULT '-1' COMMENT '任务id',
+ `agent_rollback_task_id` bigint(128) NOT NULL DEFAULT '-1' COMMENT '回滚任务id',
+ `host_list` text COMMENT '升级的主机',
+ `pause_host_list` text COMMENT '暂停点',
+ `rollback_host_list` text COMMENT '回滚机器列表',
+ `rollback_pause_host_list` text COMMENT '回滚暂停机器列表',
+ `operator` varchar(64) NOT NULL DEFAULT '' COMMENT '操作人',
+ `task_status` int(11) NOT NULL DEFAULT '0' COMMENT '任务状态',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='集群任务(集群升级部署)';
+
+--
+-- Table structure for table `config`
+--
+
+-- DROP TABLE IF EXISTS `config`;
+CREATE TABLE `config` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `config_key` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '配置key',
+ `config_value` text COMMENT '配置value',
+ `config_description` text COMMENT '备注说明',
+ `status` int(16) NOT NULL DEFAULT '0' 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 '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_config_key` (`config_key`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='配置表';
+
+--
+-- Table structure for table `controller`
+--
+
+-- DROP TABLE IF EXISTS `controller`;
+CREATE TABLE `controller` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `broker_id` int(16) NOT NULL DEFAULT '-1' COMMENT 'brokerid',
+ `host` varchar(256) NOT NULL DEFAULT '' COMMENT '主机名',
+ `timestamp` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'controller变更时间',
+ `version` int(16) NOT NULL DEFAULT '-1' COMMENT 'controller格式版本',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_cluster_id_broker_id_timestamp` (`cluster_id`,`broker_id`,`timestamp`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='controller记录表';
+
+--
+-- Table structure for table `gateway_config`
+--
+
+-- DROP TABLE IF EXISTS `gateway_config`;
+CREATE TABLE `gateway_config` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `type` varchar(128) NOT NULL DEFAULT '' COMMENT '配置类型',
+ `name` varchar(128) NOT NULL DEFAULT '' COMMENT '配置名称',
+ `value` text COMMENT '配置值',
+ `version` bigint(20) unsigned NOT NULL DEFAULT '1' COMMENT '版本信息',
+ `description` text COMMENT '描述信息',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_type_name` (`type`,`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='gateway配置';
+INSERT INTO gateway_config(type, name, value, `version`, `description`) values('SD_QUEUE_SIZE', 'SD_QUEUE_SIZE', 100000000, 1, '任意集群队列大小');
+INSERT INTO gateway_config(type, name, value, `version`, `description`) values('SD_APP_RATE', 'SD_APP_RATE', 100000000, 1, '任意一个App限速');
+INSERT INTO gateway_config(type, name, value, `version`, `description`) values('SD_IP_RATE', 'SD_IP_RATE', 100000000, 1, '任意一个IP限速');
+INSERT INTO gateway_config(type, name, value, `version`, `description`) values('SD_SP_RATE', 'app_01234567', 100000000, 1, '指定App限速');
+INSERT INTO gateway_config(type, name, value, `version`, `description`) values('SD_SP_RATE', '192.168.0.1', 100000000, 1, '指定IP限速');
+
+--
+-- Table structure for table `heartbeat`
+--
+
+-- DROP TABLE IF EXISTS `heartbeat`;
+CREATE TABLE `heartbeat` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `ip` varchar(128) NOT NULL DEFAULT '' COMMENT '主机ip',
+ `hostname` varchar(256) NOT NULL DEFAULT '' COMMENT '主机名',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_ip` (`ip`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='心跳信息';
+
+--
+-- Table structure for table `kafka_acl`
+--
+
+-- DROP TABLE IF EXISTS `kafka_acl`;
+CREATE TABLE `kafka_acl` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `app_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '用户id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `access` int(11) NOT NULL DEFAULT '0' COMMENT '0:无权限, 1:读, 2:写, 3:读写',
+ `operation` int(11) NOT NULL DEFAULT '0' COMMENT '0:创建, 1:更新 2:删除, 以最新的一条数据为准',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='权限信息(kafka-broker)';
+
+--
+-- Table structure for table `kafka_bill`
+--
+
+-- DROP TABLE IF EXISTS `kafka_bill`;
+CREATE TABLE `kafka_bill` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `principal` varchar(64) NOT NULL DEFAULT '' COMMENT '负责人',
+ `quota` double(53,2) NOT NULL DEFAULT '0.00' COMMENT '配额, 单位mb/s',
+ `cost` double(53,2) NOT NULL DEFAULT '0.00' COMMENT '成本, 单位元',
+ `cost_type` int(16) NOT NULL DEFAULT '0' COMMENT '成本类型, 0:共享集群, 1:独享集群, 2:独立集群',
+ `gmt_day` varchar(64) NOT NULL DEFAULT '' COMMENT '计价的日期, 例如2019-02-02的计价结果',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_cluster_id_topic_name_gmt_day` (`cluster_id`,`topic_name`,`gmt_day`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='kafka账单';
+
+--
+-- Table structure for table `kafka_file`
+--
+
+-- DROP TABLE IF EXISTS `kafka_file`;
+CREATE TABLE `kafka_file` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `storage_name` varchar(128) NOT NULL DEFAULT '' COMMENT '存储位置',
+ `file_name` varchar(128) NOT NULL DEFAULT '' COMMENT '文件名',
+ `file_md5` varchar(256) NOT NULL DEFAULT '' COMMENT '文件md5',
+ `file_type` int(16) NOT NULL DEFAULT '-1' COMMENT '0:kafka压缩包, 1:kafkaserver配置',
+ `description` text COMMENT '备注信息',
+ `operator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建用户',
+ `status` int(16) NOT NULL DEFAULT '0' 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 '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_cluster_id_file_name_storage_name` (`cluster_id`,`file_name`,`storage_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文件管理';
+
+--
+-- Table structure for table `kafka_user`
+--
+
+-- DROP TABLE IF EXISTS `kafka_user`;
+CREATE TABLE `kafka_user` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `app_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '应用id',
+ `password` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '密码',
+ `user_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:普通用户, 1:超级用户',
+ `operation` int(11) NOT NULL DEFAULT '0' COMMENT '0:创建, 1:更新 2:删除, 以最新一条的记录为准',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='kafka用户表';
+INSERT INTO app(app_id, name, password, type, applicant, principals, description) VALUES ('dkm_admin', 'KM管理员', 'km_kMl4N8as1Kp0CCY', 1, 'admin', 'admin', 'KM管理员应用-谨慎对外提供');
+INSERT INTO kafka_user(app_id, password, user_type, operation) VALUES ('dkm_admin', 'km_kMl4N8as1Kp0CCY', 1, 0);
+
+
+--
+-- Table structure for table `logical_cluster`
+--
+
+CREATE TABLE `logical_cluster` (
+ `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`
+--
+
+-- DROP TABLE IF EXISTS `monitor_rule`;
+CREATE TABLE `monitor_rule` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `name` varchar(192) NOT NULL DEFAULT '' COMMENT '告警名称',
+ `strategy_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '监控id',
+ `app_id` varchar(64) NOT NULL DEFAULT '' COMMENT 'appid',
+ `operator` varchar(64) NOT NULL DEFAULT '' COMMENT '操作人',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` 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='监控规则';
+
+--
+-- Table structure for table `operate_record`
+--
+
+-- DROP TABLE IF EXISTS `operate_record`;
+CREATE TABLE `operate_record` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `module_id` int(16) NOT NULL DEFAULT '-1' COMMENT '模块类型, 0:topic, 1:应用, 2:配额, 3:权限, 4:集群, -1:未知',
+ `operate_id` int(16) NOT NULL DEFAULT '-1' COMMENT '操作类型, 0:新增, 1:删除, 2:修改',
+ `resource` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称、app名称',
+ `content` text COMMENT '操作内容',
+ `operator` varchar(64) NOT NULL DEFAULT '' COMMENT '操作人',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_module_id_operate_id_operator` (`module_id`,`operate_id`,`operator`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='操作记录';
+
+--
+-- Table structure for table `reassign_task`
+--
+
+-- DROP TABLE IF EXISTS `reassign_task`;
+CREATE TABLE `reassign_task` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `task_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '任务ID',
+ `name` varchar(256) NOT NULL DEFAULT '' COMMENT '任务名称',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
+ `partitions` text COMMENT '分区',
+ `reassignment_json` text COMMENT '任务参数',
+ `real_throttle` bigint(20) NOT NULL DEFAULT '0' COMMENT '限流值',
+ `max_throttle` bigint(20) NOT NULL DEFAULT '0' COMMENT '限流上限',
+ `min_throttle` bigint(20) NOT NULL DEFAULT '0' COMMENT '限流下限',
+ `begin_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '开始时间',
+ `operator` varchar(64) NOT NULL DEFAULT '' COMMENT '操作人',
+ `description` varchar(256) NOT NULL DEFAULT '' COMMENT '备注说明',
+ `status` int(16) NOT NULL DEFAULT '0' COMMENT '任务状态',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '任务创建时间',
+ `gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '任务修改时间',
+ `original_retention_time` bigint(20) NOT NULL DEFAULT '86400000' COMMENT 'Topic存储时间',
+ `reassign_retention_time` bigint(20) NOT NULL DEFAULT '86400000' COMMENT '迁移时的存储时间',
+ `src_brokers` text COMMENT '源Broker',
+ `dest_brokers` text COMMENT '目标Broker',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic迁移信息';
+
+--
+-- Table structure for table `region`
+--
+
+-- DROP TABLE IF EXISTS `region`;
+CREATE TABLE `region` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `name` varchar(192) NOT NULL DEFAULT '' COMMENT 'region名称',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `broker_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'broker列表',
+ `capacity` bigint(20) NOT NULL DEFAULT '0' COMMENT '容量(B/s)',
+ `real_used` bigint(20) NOT NULL DEFAULT '0' COMMENT '实际使用量(B/s)',
+ `estimate_used` bigint(20) NOT NULL DEFAULT '0' COMMENT '预估使用量(B/s)',
+ `description` text COMMENT '备注说明',
+ `status` int(16) NOT NULL DEFAULT '0' 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 '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='region信息表';
+
+--
+-- Table structure for table `topic`
+--
+
+-- DROP TABLE IF EXISTS `topic`;
+CREATE TABLE `topic` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `app_id` varchar(64) NOT NULL DEFAULT '' COMMENT 'topic所属appid',
+ `peak_bytes_in` bigint(20) NOT NULL DEFAULT '0' COMMENT '峰值流量',
+ `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_cluster_id_topic_name` (`cluster_id`,`topic_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic信息表';
+
+--
+-- Table structure for table `topic_app_metrics`
+--
+
+-- DROP TABLE IF EXISTS `topic_app_metrics`;
+CREATE TABLE `topic_app_metrics` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `app_id` varchar(64) NOT NULL DEFAULT '' COMMENT 'appid',
+ `metrics` text COMMENT '指标',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_cluster_id_topic_name_app_id_gmt_create` (`cluster_id`,`topic_name`,`app_id`,`gmt_create`),
+ KEY `idx_gmt_create` (`gmt_create`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic app metrics';
+
+--
+-- Table structure for table `topic_connections`
+--
+
+-- DROP TABLE IF EXISTS `topic_connections`;
+CREATE TABLE `topic_connections` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `app_id` varchar(64) NOT NULL DEFAULT '' COMMENT '应用id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `type` varchar(16) NOT NULL DEFAULT '' COMMENT 'producer or consumer',
+ `ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'ip地址',
+ `client_version` varchar(8) NOT NULL DEFAULT '' COMMENT '客户端版本',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_app_id_cluster_id_topic_name_type_ip_client_version` (`app_id`,`cluster_id`,`topic_name`,`type`,`ip`,`client_version`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic连接信息表';
+
+--
+-- Table structure for table `topic_expired`
+--
+
+-- DROP TABLE IF EXISTS `topic_expired`;
+CREATE TABLE `topic_expired` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `produce_connection_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '发送连接数',
+ `fetch_connection_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '消费连接数',
+ `expired_day` bigint(20) NOT NULL DEFAULT '0' COMMENT '过期天数',
+ `gmt_retain` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '保留截止时间',
+ `status` int(16) NOT NULL DEFAULT '0' COMMENT '-1:可下线, 0:过期待通知, 1+:已通知待反馈',
+ `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_cluster_id_topic_name` (`cluster_id`,`topic_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic过期信息表';
+
+--
+-- Table structure for table `topic_metrics`
+--
+
+-- DROP TABLE IF EXISTS `topic_metrics`;
+CREATE TABLE `topic_metrics` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `metrics` text COMMENT '指标数据JSON',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_cluster_id_topic_name_gmt_create` (`cluster_id`,`topic_name`,`gmt_create`),
+ KEY `idx_gmt_create` (`gmt_create`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topicmetrics表';
+
+--
+-- Table structure for table `topic_report`
+--
+
+-- DROP TABLE IF EXISTS `topic_report`;
+CREATE TABLE `topic_report` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '开始上报时间',
+ `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束上报时间',
+ `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_cluster_id_topic_name` (`cluster_id`,`topic_name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='开启jmx采集的topic';
+
+--
+-- Table structure for table `topic_request_time_metrics`
+--
+
+-- DROP TABLE IF EXISTS `topic_request_time_metrics`;
+CREATE TABLE `topic_request_time_metrics` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `metrics` text COMMENT '指标',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_cluster_id_topic_name_gmt_create` (`cluster_id`,`topic_name`,`gmt_create`),
+ KEY `idx_gmt_create` (`gmt_create`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic请求耗时信息';
+
+--
+-- Table structure for table `topic_statistics`
+--
+
+-- DROP TABLE IF EXISTS `topic_statistics`;
+CREATE TABLE `topic_statistics` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic名称',
+ `offset_sum` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'offset和',
+ `max_avg_bytes_in` double(53,2) NOT NULL DEFAULT '-1.00' COMMENT '峰值的均值流量',
+ `gmt_day` varchar(64) NOT NULL DEFAULT '' COMMENT '日期2020-03-30的形式',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `max_avg_messages_in` double(53,2) NOT NULL DEFAULT '-1.00' COMMENT '峰值的均值消息条数',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `uniq_cluster_id_topic_name_gmt_day` (`cluster_id`,`topic_name`,`gmt_day`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic统计信息表';
+
+--
+-- Table structure for table `topic_throttled_metrics`
+--
+
+-- DROP TABLE IF EXISTS `topic_throttled_metrics`;
+CREATE TABLE `topic_throttled_metrics` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
+ `topic_name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'topic name',
+ `app_id` varchar(64) NOT NULL DEFAULT '' COMMENT 'app',
+ `produce_throttled` tinyint(8) NOT NULL DEFAULT '0' COMMENT '是否是生产耗时',
+ `fetch_throttled` tinyint(8) NOT NULL DEFAULT '0' COMMENT '是否是消费耗时',
+ `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `idx_cluster_id_topic_name_app_id` (`cluster_id`,`topic_name`,`app_id`),
+ KEY `idx_gmt_create` (`gmt_create`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='topic限流信息';
+
+--
+-- Table structure for table `work_order`
+--
+
+-- DROP TABLE IF EXISTS `work_order`;
+CREATE TABLE `work_order` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `type` int(16) NOT NULL DEFAULT '-1' COMMENT '工单类型',
+ `title` varchar(512) NOT NULL DEFAULT '' COMMENT '工单标题',
+ `applicant` varchar(64) NOT NULL DEFAULT '' COMMENT '申请人',
+ `description` text COMMENT '备注信息',
+ `approver` varchar(64) NOT NULL DEFAULT '' COMMENT '审批人',
+ `gmt_handle` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '审批时间',
+ `opinion` varchar(256) NOT NULL DEFAULT '' COMMENT '审批信息',
+ `extensions` text COMMENT '扩展信息',
+ `status` int(16) NOT NULL DEFAULT '0' COMMENT '工单状态, 0:待审批, 1:通过, 2:拒绝, 3:取消',
+ `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`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工单表';
\ No newline at end of file
diff --git a/distribution/conf/logback-spring.xml b/distribution/conf/logback-spring.xml
new file mode 100644
index 00000000..c1c16136
--- /dev/null
+++ b/distribution/conf/logback-spring.xml
@@ -0,0 +1,215 @@
+
+
+ logback
+
+
+
+
+
+
+
+
+
+
+
+
+
+ info
+
+
+ ${CONSOLE_LOG_PATTERN}
+ UTF-8
+
+
+
+
+
+
+
+
+ ${log.path}/log_debug.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+
+ ${log.path}/log_debug_%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 7
+
+
+
+ debug
+ ACCEPT
+ DENY
+
+
+
+
+
+
+ ${log.path}/log_info.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+
+ ${log.path}/log_info_%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 7
+
+
+
+ info
+ ACCEPT
+ DENY
+
+
+
+
+
+
+ ${log.path}/log_warn.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+ ${log.path}/log_warn_%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 7
+
+
+
+ warn
+ ACCEPT
+ DENY
+
+
+
+
+
+
+
+ ${log.path}/log_error.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+ ${log.path}/log_error_%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 7
+
+
+
+ ERROR
+ ACCEPT
+ DENY
+
+
+
+
+
+ ${log.path}/metrics/collector_metrics.log
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+ ${log.path}/metrics/collector_metrics_%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+ 3
+
+
+
+
+
+ ${log.path}/metrics/api_metrics.log
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+ ${log.path}/metrics/api_metrics_%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+ 3
+
+
+
+
+
+ ${log.path}/metrics/scheduled_tasks.log
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+ ${log.path}/metrics/scheduled_tasks_%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/distribution/pom.xml b/distribution/pom.xml
new file mode 100644
index 00000000..6a0d4f0c
--- /dev/null
+++ b/distribution/pom.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+ kafka-manager
+ com.xiaojukeji.kafka
+ ${kafka-manager.revision}
+
+
+ 4.0.0
+
+ distribution
+ distribution
+ pom
+
+
+
+
+
+ release-kafka-manager
+
+
+ ${project.groupId}
+ kafka-manager-web
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ release-km.xml
+
+ posix
+
+
+
+ make-assembly
+ install
+
+ single
+
+
+
+
+
+ kafka-manager
+
+
+
+
diff --git a/distribution/release-km.xml b/distribution/release-km.xml
new file mode 100755
index 00000000..1f7eeb55
--- /dev/null
+++ b/distribution/release-km.xml
@@ -0,0 +1,42 @@
+
+
+
+ server-${project.version}
+ true
+
+ dir
+ tar.gz
+ zip
+
+
+
+
+ conf/**
+
+
+
+
+
+ bin/*
+
+ 0755
+
+
+
+
+
+
+ ../kafka-manager-web/target/kafka-manager-web-${kafka-manager.revision}.jar
+ target/
+
+
+
+
+
+ true
+
+ com.xiaojukeji.kafka:kafka-manager-web
+
+
+
+
diff --git a/kafka-manager-console/package.json b/kafka-manager-console/package.json
index 3be33c21..15e2b523 100644
--- a/kafka-manager-console/package.json
+++ b/kafka-manager-console/package.json
@@ -57,4 +57,4 @@
"dependencies": {
"format-to-json": "^1.0.4"
}
-}
\ No newline at end of file
+}
diff --git a/pom.xml b/pom.xml
index 51fa20e0..7e9335c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,10 +27,14 @@
UTF-8
UTF-8
8.5.66
+ 3.0.0
+
+
kafka-manager-common
kafka-manager-dao
kafka-manager-core
@@ -42,6 +46,7 @@
kafka-manager-extends/kafka-manager-openapi
kafka-manager-task
kafka-manager-web
+ distribution
@@ -231,4 +236,16 @@
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ ${maven-assembly-plugin.version}
+
+
+
\ No newline at end of file