实现基础的智能调度

This commit is contained in:
刘祥超
2023-05-17 18:42:21 +08:00
parent 813ce44ceb
commit 6976454bde
33 changed files with 507 additions and 127 deletions

View File

@@ -67267,7 +67267,7 @@
"name": "edgeNSDomains",
"engine": "InnoDB",
"charset": "utf8mb4_general_ci",
"definition": "CREATE TABLE `edgeNSDomains` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `clusterId` int(11) unsigned DEFAULT '0' COMMENT '集群ID',\n `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `name` varchar(255) DEFAULT NULL COMMENT '域名',\n `groupIds` json DEFAULT NULL COMMENT '分组ID',\n `tsig` json DEFAULT NULL COMMENT 'TSIG配置',\n `verifyTXT` varchar(64) DEFAULT NULL COMMENT '验证用的TXT',\n `verifyExpiresAt` bigint(11) unsigned DEFAULT '0' COMMENT '验证TXT过期时间',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `version` bigint(20) unsigned DEFAULT '0' COMMENT '版本号',\n `status` varchar(64) DEFAULT 'none' COMMENT '状态none|verified',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n PRIMARY KEY (`id`),\n KEY `userId` (`userId`),\n KEY `name` (`name`),\n KEY `version` (`version`) USING BTREE,\n KEY `status` (`status`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='DNS域名'",
"definition": "CREATE TABLE `edgeNSDomains` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `clusterId` int(11) unsigned DEFAULT '0' COMMENT '集群ID',\n `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `name` varchar(255) DEFAULT NULL COMMENT '域名',\n `groupIds` json DEFAULT NULL COMMENT '分组ID',\n `tsig` json DEFAULT NULL COMMENT 'TSIG配置',\n `verifyTXT` varchar(64) DEFAULT NULL COMMENT '验证用的TXT',\n `verifyExpiresAt` bigint(11) unsigned DEFAULT '0' COMMENT '验证TXT过期时间',\n `recordsHealthCheck` json DEFAULT NULL COMMENT '记录健康检查设置',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `version` bigint(20) unsigned DEFAULT '0' COMMENT '版本号',\n `status` varchar(64) DEFAULT 'none' COMMENT '状态none|verified',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n PRIMARY KEY (`id`),\n KEY `userId` (`userId`),\n KEY `name` (`name`),\n KEY `version` (`version`) USING BTREE,\n KEY `status` (`status`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='DNS域名'",
"fields": [
{
"name": "id",
@@ -67305,6 +67305,10 @@
"name": "verifyExpiresAt",
"definition": "bigint(11) unsigned DEFAULT '0' COMMENT '验证TXT过期时间'"
},
{
"name": "recordsHealthCheck",
"definition": "json COMMENT '记录健康检查设置'"
},
{
"name": "createdAt",
"definition": "bigint(11) unsigned DEFAULT '0' COMMENT '创建时间'"
@@ -67653,7 +67657,7 @@
"name": "edgeNSRecords",
"engine": "InnoDB",
"charset": "utf8mb4_general_ci",
"definition": "CREATE TABLE `edgeNSRecords` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `domainId` int(11) unsigned DEFAULT '0' COMMENT '域名ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `description` varchar(512) DEFAULT NULL COMMENT '备注',\n `name` varchar(255) DEFAULT NULL COMMENT '记录名',\n `type` varchar(32) DEFAULT NULL COMMENT '类型',\n `value` varchar(4096) DEFAULT NULL COMMENT '值',\n `mxPriority` int(11) unsigned DEFAULT '0' COMMENT 'MX优先级',\n `srvPriority` int(11) unsigned DEFAULT '0' COMMENT 'SRV优先级',\n `srvWeight` int(11) unsigned DEFAULT '0' COMMENT 'SRV权重',\n `srvPort` int(11) unsigned DEFAULT '0' COMMENT 'SRV端口',\n `caaFlag` tinyint(1) unsigned DEFAULT '0' COMMENT 'CAA Flag',\n `caaTag` varchar(32) DEFAULT NULL COMMENT 'CAA TAG',\n `ttl` int(11) unsigned DEFAULT '0' COMMENT 'TTL',\n `weight` int(11) unsigned DEFAULT '0' COMMENT '权重',\n `routeIds` json DEFAULT NULL COMMENT '线路',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `version` bigint(20) unsigned DEFAULT '0' COMMENT '版本号',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n PRIMARY KEY (`id`),\n KEY `domainId` (`domainId`),\n KEY `version` (`version`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='DNS记录'",
"definition": "CREATE TABLE `edgeNSRecords` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `domainId` int(11) unsigned DEFAULT '0' COMMENT '域名ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `description` varchar(512) DEFAULT NULL COMMENT '备注',\n `name` varchar(255) DEFAULT NULL COMMENT '记录名',\n `type` varchar(32) DEFAULT NULL COMMENT '类型',\n `value` varchar(4096) DEFAULT NULL COMMENT '值',\n `mxPriority` int(11) unsigned DEFAULT '0' COMMENT 'MX优先级',\n `srvPriority` int(11) unsigned DEFAULT '0' COMMENT 'SRV优先级',\n `srvWeight` int(11) unsigned DEFAULT '0' COMMENT 'SRV权重',\n `srvPort` int(11) unsigned DEFAULT '0' COMMENT 'SRV端口',\n `caaFlag` tinyint(1) unsigned DEFAULT '0' COMMENT 'CAA Flag',\n `caaTag` varchar(32) DEFAULT NULL COMMENT 'CAA TAG',\n `ttl` int(11) unsigned DEFAULT '0' COMMENT 'TTL',\n `weight` int(11) unsigned DEFAULT '0' COMMENT '权重',\n `routeIds` json DEFAULT NULL COMMENT '线路',\n `healthCheck` json DEFAULT NULL COMMENT '健康检查配置',\n `countUp` int(11) unsigned DEFAULT '0' COMMENT '连续上线次数',\n `countDown` int(11) unsigned DEFAULT '0' COMMENT '连续离线次数',\n `isUp` tinyint(1) unsigned DEFAULT '1' COMMENT '是否在线',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `version` bigint(20) unsigned DEFAULT '0' COMMENT '版本号',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n PRIMARY KEY (`id`),\n KEY `domainId` (`domainId`),\n KEY `version` (`version`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='DNS记录'",
"fields": [
{
"name": "id",
@@ -67719,6 +67723,22 @@
"name": "routeIds",
"definition": "json COMMENT '线路'"
},
{
"name": "healthCheck",
"definition": "json COMMENT '健康检查配置'"
},
{
"name": "countUp",
"definition": "int(11) unsigned DEFAULT '0' COMMENT '连续上线次数'"
},
{
"name": "countDown",
"definition": "int(11) unsigned DEFAULT '0' COMMENT '连续离线次数'"
},
{
"name": "isUp",
"definition": "tinyint(1) unsigned DEFAULT '1' COMMENT '是否在线'"
},
{
"name": "createdAt",
"definition": "bigint(11) unsigned DEFAULT '0' COMMENT '创建时间'"
@@ -67992,6 +68012,61 @@
],
"records": []
},
{
"name": "edgeNodeActions",
"engine": "InnoDB",
"charset": "utf8mb4_general_ci",
"definition": "CREATE TABLE `edgeNodeActions` (\n `id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `nodeId` bigint(11) unsigned DEFAULT '0' COMMENT '节点ID',\n `role` varchar(16) DEFAULT NULL COMMENT '角色',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `conds` json DEFAULT NULL COMMENT '条件',\n `action` json DEFAULT NULL COMMENT '动作',\n `duration` json DEFAULT NULL COMMENT '持续时间',\n `order` int(11) unsigned DEFAULT '0' COMMENT '排序',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n PRIMARY KEY (`id`),\n KEY `nodeId` (`nodeId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点智能调度设置'",
"fields": [
{
"name": "id",
"definition": "bigint(11) unsigned auto_increment COMMENT 'ID'"
},
{
"name": "nodeId",
"definition": "bigint(11) unsigned DEFAULT '0' COMMENT '节点ID'"
},
{
"name": "role",
"definition": "varchar(16) COMMENT '角色'"
},
{
"name": "isOn",
"definition": "tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用'"
},
{
"name": "conds",
"definition": "json COMMENT '条件'"
},
{
"name": "action",
"definition": "json COMMENT '动作'"
},
{
"name": "duration",
"definition": "json COMMENT '持续时间'"
},
{
"name": "order",
"definition": "int(11) unsigned DEFAULT '0' COMMENT '排序'"
},
{
"name": "state",
"definition": "tinyint(1) unsigned DEFAULT '1' COMMENT '状态'"
}
],
"indexes": [
{
"name": "PRIMARY",
"definition": "UNIQUE KEY `PRIMARY` (`id`) USING BTREE"
},
{
"name": "nodeId",
"definition": "KEY `nodeId` (`nodeId`) USING BTREE"
}
],
"records": []
},
{
"name": "edgeNodeClusterFirewallActions",
"engine": "InnoDB",
@@ -69041,7 +69116,7 @@
"name": "edgeNodeThresholds",
"engine": "InnoDB",
"charset": "utf8mb4_general_ci",
"definition": "CREATE TABLE `edgeNodeThresholds` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `role` varchar(32) DEFAULT NULL COMMENT '节点角色',\n `clusterId` int(11) unsigned DEFAULT '0' COMMENT '集群ID',\n `nodeId` int(11) unsigned DEFAULT '0' COMMENT '节点ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `item` varchar(255) DEFAULT NULL COMMENT '监控项',\n `param` varchar(255) DEFAULT NULL COMMENT '参数',\n `operator` varchar(255) DEFAULT NULL COMMENT '操作符',\n `value` json DEFAULT NULL COMMENT '对比值',\n `message` varchar(512) DEFAULT NULL COMMENT '消息内容',\n `notifyDuration` int(11) unsigned DEFAULT '0' COMMENT '通知间隔(单位分钟)',\n `notifiedAt` int(11) unsigned DEFAULT '0' COMMENT '上次通知时间',\n `duration` int(11) unsigned DEFAULT '0' COMMENT '时间段',\n `durationUnit` varchar(16) DEFAULT NULL COMMENT '时间段单位',\n `sumMethod` varchar(32) DEFAULT NULL COMMENT '聚合方法',\n `order` int(11) unsigned DEFAULT '0' COMMENT '排序',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n PRIMARY KEY (`id`),\n KEY `nodeId` (`nodeId`),\n KEY `clusterId` (`clusterId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群阈值设置'",
"definition": "CREATE TABLE `edgeNodeThresholds` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `role` varchar(32) DEFAULT NULL COMMENT '节点角色',\n `clusterId` int(11) unsigned DEFAULT '0' COMMENT '集群ID',\n `nodeId` int(11) unsigned DEFAULT '0' COMMENT '节点ID',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `item` varchar(255) DEFAULT NULL COMMENT '监控项',\n `param` varchar(255) DEFAULT NULL COMMENT '参数',\n `operator` varchar(255) DEFAULT NULL COMMENT '操作符',\n `value` json DEFAULT NULL COMMENT '对比值',\n `message` varchar(512) DEFAULT NULL COMMENT '消息内容',\n `notifyDuration` int(11) unsigned DEFAULT '0' COMMENT '通知间隔(单位分钟)',\n `notifiedAt` int(11) unsigned DEFAULT '0' COMMENT '上次通知时间',\n `duration` int(11) unsigned DEFAULT '0' COMMENT '时间段',\n `durationUnit` varchar(16) DEFAULT NULL COMMENT '时间段单位',\n `sumMethod` varchar(32) DEFAULT NULL COMMENT '聚合方法',\n `order` int(11) unsigned DEFAULT '0' COMMENT '排序',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n PRIMARY KEY (`id`),\n KEY `nodeId` (`nodeId`),\n KEY `clusterId` (`clusterId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点监控阈值设置'",
"fields": [
{
"name": "id",
@@ -69345,7 +69420,7 @@
"name": "edgeNodes",
"engine": "InnoDB",
"charset": "utf8mb4_general_ci",
"definition": "CREATE TABLE `edgeNodes` (\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `adminId` int(11) unsigned DEFAULT '0' COMMENT '管理员ID',\n `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n `level` tinyint(1) unsigned DEFAULT '1' COMMENT '级别',\n `lnAddrs` json DEFAULT NULL COMMENT 'Ln级别访问地址',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `isUp` tinyint(1) unsigned DEFAULT '1' COMMENT '是否在线',\n `countUp` int(11) unsigned DEFAULT '0' COMMENT '连续在线次数',\n `countDown` int(11) unsigned DEFAULT '0' COMMENT '连续下线次数',\n `isActive` tinyint(1) unsigned DEFAULT '1' COMMENT '是否活跃',\n `inactiveNotifiedAt` bigint(11) unsigned DEFAULT '0' COMMENT '离线通知时间',\n `uniqueId` varchar(32) DEFAULT NULL COMMENT '节点ID',\n `secret` varchar(32) DEFAULT NULL COMMENT '密钥',\n `name` varchar(255) DEFAULT NULL COMMENT '节点名',\n `code` varchar(255) DEFAULT NULL COMMENT '代号',\n `clusterId` int(11) unsigned DEFAULT '0' COMMENT '主集群ID',\n `secondaryClusterIds` json DEFAULT NULL COMMENT '从集群ID',\n `regionId` int(11) unsigned DEFAULT '0' COMMENT '区域ID',\n `groupId` int(11) unsigned DEFAULT '0' COMMENT '分组ID',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `status` json DEFAULT NULL COMMENT '最新的状态',\n `version` int(11) unsigned DEFAULT '0' COMMENT '当前版本号',\n `latestVersion` int(11) unsigned DEFAULT '0' COMMENT '最后版本号',\n `installDir` varchar(512) DEFAULT NULL COMMENT '安装目录',\n `isInstalled` tinyint(1) unsigned DEFAULT '0' COMMENT '是否已安装',\n `installStatus` json DEFAULT NULL COMMENT '安装状态',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n `connectedAPINodes` json DEFAULT NULL COMMENT '当前连接的API节点',\n `maxCPU` int(4) unsigned DEFAULT '0' COMMENT '可以使用的最多CPU',\n `maxThreads` int(11) unsigned DEFAULT '0' COMMENT '最大线程数',\n `ddosProtection` json DEFAULT NULL COMMENT 'DDOS配置',\n `dnsRoutes` json DEFAULT NULL COMMENT 'DNS线路设置',\n `maxCacheDiskCapacity` json DEFAULT NULL COMMENT '硬盘缓存容量',\n `maxCacheMemoryCapacity` json DEFAULT NULL COMMENT '内存缓存容量',\n `cacheDiskDir` varchar(255) DEFAULT NULL COMMENT '主缓存目录',\n `cacheDiskSubDirs` json DEFAULT NULL COMMENT '其他缓存目录',\n `dnsResolver` json DEFAULT NULL COMMENT 'DNS解析器',\n `enableIPLists` tinyint(1) unsigned DEFAULT '1' COMMENT '启用IP名单',\n `apiNodeAddrs` json DEFAULT NULL COMMENT 'API节点地址',\n PRIMARY KEY (`id`),\n KEY `uniqueId` (`uniqueId`),\n KEY `clusterId` (`clusterId`),\n KEY `groupId` (`groupId`),\n KEY `regionId` (`regionId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点'",
"definition": "CREATE TABLE `edgeNodes` (\n `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `adminId` int(11) unsigned DEFAULT '0' COMMENT '管理员ID',\n `userId` int(11) unsigned DEFAULT '0' COMMENT '用户ID',\n `level` tinyint(1) unsigned DEFAULT '1' COMMENT '级别',\n `lnAddrs` json DEFAULT NULL COMMENT 'Ln级别访问地址',\n `isOn` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启用',\n `isUp` tinyint(1) unsigned DEFAULT '1' COMMENT '是否在线',\n `countUp` int(11) unsigned DEFAULT '0' COMMENT '连续在线次数',\n `countDown` int(11) unsigned DEFAULT '0' COMMENT '连续下线次数',\n `isActive` tinyint(1) unsigned DEFAULT '1' COMMENT '是否活跃',\n `inactiveNotifiedAt` bigint(11) unsigned DEFAULT '0' COMMENT '离线通知时间',\n `uniqueId` varchar(32) DEFAULT NULL COMMENT '节点ID',\n `secret` varchar(32) DEFAULT NULL COMMENT '密钥',\n `name` varchar(255) DEFAULT NULL COMMENT '节点名',\n `code` varchar(255) DEFAULT NULL COMMENT '代号',\n `clusterId` int(11) unsigned DEFAULT '0' COMMENT '主集群ID',\n `secondaryClusterIds` json DEFAULT NULL COMMENT '从集群ID',\n `regionId` int(11) unsigned DEFAULT '0' COMMENT '区域ID',\n `groupId` int(11) unsigned DEFAULT '0' COMMENT '分组ID',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `status` json DEFAULT NULL COMMENT '最新的状态',\n `version` int(11) unsigned DEFAULT '0' COMMENT '当前版本号',\n `latestVersion` int(11) unsigned DEFAULT '0' COMMENT '最后版本号',\n `installDir` varchar(512) DEFAULT NULL COMMENT '安装目录',\n `isInstalled` tinyint(1) unsigned DEFAULT '0' COMMENT '是否已安装',\n `installStatus` json DEFAULT NULL COMMENT '安装状态',\n `state` tinyint(1) unsigned DEFAULT '1' COMMENT '状态',\n `connectedAPINodes` json DEFAULT NULL COMMENT '当前连接的API节点',\n `maxCPU` int(4) unsigned DEFAULT '0' COMMENT '可以使用的最多CPU',\n `maxThreads` int(11) unsigned DEFAULT '0' COMMENT '最大线程数',\n `ddosProtection` json DEFAULT NULL COMMENT 'DDOS配置',\n `dnsRoutes` json DEFAULT NULL COMMENT 'DNS线路设置',\n `maxCacheDiskCapacity` json DEFAULT NULL COMMENT '硬盘缓存容量',\n `maxCacheMemoryCapacity` json DEFAULT NULL COMMENT '内存缓存容量',\n `cacheDiskDir` varchar(255) DEFAULT NULL COMMENT '主缓存目录',\n `cacheDiskSubDirs` json DEFAULT NULL COMMENT '其他缓存目录',\n `dnsResolver` json DEFAULT NULL COMMENT 'DNS解析器',\n `enableIPLists` tinyint(1) unsigned DEFAULT '1' COMMENT '启用IP名单',\n `apiNodeAddrs` json DEFAULT NULL COMMENT 'API节点地址',\n `offlineDay` varchar(8) DEFAULT NULL COMMENT '下线日期YYYYMMDD',\n `offlineIsNotified` tinyint(1) unsigned DEFAULT '0' COMMENT '下线是否已通知',\n `isBackupForCluster` tinyint(1) unsigned DEFAULT '0' COMMENT '是否为集群备用节点',\n `isBackupForGroup` tinyint(1) unsigned DEFAULT '0' COMMENT '是否为分组备用节点',\n `backupIPs` json DEFAULT NULL COMMENT '备用IP',\n `actionStatus` json DEFAULT NULL COMMENT '当前动作配置',\n PRIMARY KEY (`id`),\n KEY `uniqueId` (`uniqueId`),\n KEY `clusterId` (`clusterId`),\n KEY `groupId` (`groupId`),\n KEY `regionId` (`regionId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点'",
"fields": [
{
"name": "id",
@@ -69502,6 +69577,30 @@
{
"name": "apiNodeAddrs",
"definition": "json COMMENT 'API节点地址'"
},
{
"name": "offlineDay",
"definition": "varchar(8) COMMENT '下线日期YYYYMMDD'"
},
{
"name": "offlineIsNotified",
"definition": "tinyint(1) unsigned DEFAULT '0' COMMENT '下线是否已通知'"
},
{
"name": "isBackupForCluster",
"definition": "tinyint(1) unsigned DEFAULT '0' COMMENT '是否为集群备用节点'"
},
{
"name": "isBackupForGroup",
"definition": "tinyint(1) unsigned DEFAULT '0' COMMENT '是否为分组备用节点'"
},
{
"name": "backupIPs",
"definition": "json COMMENT '备用IP'"
},
{
"name": "actionStatus",
"definition": "json COMMENT '当前动作配置'"
}
],
"indexes": [