共计 47973 个字符,预计需要花费 120 分钟才能阅读完成。
- MySQL
Apollo 的表结构对 timestamp 使用了多个 default 声明,所以需要 5.6.5 以上版本。
Apollo 服务端共需要两个数据库:ApolloPortalDB 和 ApolloConfigDB
ApolloConfigDB:
/*
Navicat Premium Data Transfer
Source Server : mylocal
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3306
Source Schema : ApolloConfigDB
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 30/04/2019 14:07:01
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for App
-- ----------------------------
DROP TABLE IF EXISTS `App`;
CREATE TABLE `App` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
`OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门 Id',
`OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
`OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
`OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `AppId` (`AppId`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Name` (`Name`(191))
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
-- ----------------------------
-- Records of App
-- ----------------------------
BEGIN;
INSERT INTO `App` VALUES (1, 'SampleApp', 'Sample App', 'TEST1', '样例部门 1', 'apollo', 'apollo@acme.com', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `App` VALUES (2, 'myapp', '测试应用', 'TEST1', '样例部门 1', 'apollo', 'apollo@acme.com', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
COMMIT;
-- ----------------------------
-- Table structure for AppNamespace
-- ----------------------------
DROP TABLE IF EXISTS `AppNamespace`;
CREATE TABLE `AppNamespace` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Name` varchar(32) NOT NULL DEFAULT ''COMMENT'namespace 名字,注意,需要全局唯一 ',
`AppId` varchar(32) NOT NULL DEFAULT ''COMMENT'app id',
`Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace 的 format 类型',
`IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace 是否为公共',
`Comment` varchar(64) NOT NULL DEFAULT ''COMMENT' 注释 ',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT ''COMMENT' 创建人邮箱前缀 ',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_AppId` (`AppId`),
KEY `Name_AppId` (`Name`,`AppId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='应用 namespace 定义';
-- ----------------------------
-- Records of AppNamespace
-- ----------------------------
BEGIN;
INSERT INTO `AppNamespace` VALUES (1, 'application', 'SampleApp', 'properties', b'0', 'default app namespace', b'0', '','2019-04-14 14:13:47','', '2019-04-14 14:13:47');
INSERT INTO `AppNamespace` VALUES (2, 'application', 'myapp', 'properties', b'0', 'default app namespace', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `AppNamespace` VALUES (3, 'test', 'myapp', 'properties', b'1', '', b'0','apollo','2019-04-16 13:57:05','apollo','2019-04-16 13:57:05');
COMMIT;
-- ----------------------------
-- Table structure for Audit
-- ----------------------------
DROP TABLE IF EXISTS `Audit`;
CREATE TABLE `Audit` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名',
`EntityId` int(10) unsigned DEFAULT NULL COMMENT '记录 ID',
`OpName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '操作类型',
`Comment` varchar(500) DEFAULT NULL COMMENT '备注',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表';
-- ----------------------------
-- Records of Audit
-- ----------------------------
BEGIN;
INSERT INTO `Audit` VALUES (1, 'App', 2, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:41:28', NULL, '2019-04-16 13:41:28');
INSERT INTO `Audit` VALUES (2, 'AppNamespace', 2, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:41:28', NULL, '2019-04-16 13:41:28');
INSERT INTO `Audit` VALUES (3, 'Cluster', 2, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:41:28', NULL, '2019-04-16 13:41:28');
INSERT INTO `Audit` VALUES (4, 'Namespace', 2, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:41:28', NULL, '2019-04-16 13:41:28');
INSERT INTO `Audit` VALUES (5, 'Release', 2, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:41:41', NULL, '2019-04-16 13:41:41');
INSERT INTO `Audit` VALUES (6, 'ReleaseHistory', 2, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:41:41', NULL, '2019-04-16 13:41:41');
INSERT INTO `Audit` VALUES (7, 'Item', 2, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:42:16', NULL, '2019-04-16 13:42:16');
INSERT INTO `Audit` VALUES (8, 'Release', 3, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:42:23', NULL, '2019-04-16 13:42:23');
INSERT INTO `Audit` VALUES (9, 'ReleaseHistory', 3, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:42:23', NULL, '2019-04-16 13:42:23');
INSERT INTO `Audit` VALUES (10, 'Namespace', 3, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:57:05', NULL, '2019-04-16 13:57:05');
INSERT INTO `Audit` VALUES (11, 'AppNamespace', 3, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:57:05', NULL, '2019-04-16 13:57:05');
INSERT INTO `Audit` VALUES (12, 'Release', 4, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:57:30', NULL, '2019-04-16 13:57:30');
INSERT INTO `Audit` VALUES (13, 'ReleaseHistory', 4, 'INSERT', NULL, b'0', 'apollo', '2019-04-16 13:57:30', NULL, '2019-04-16 13:57:30');
COMMIT;
-- ----------------------------
-- Table structure for Cluster
-- ----------------------------
DROP TABLE IF EXISTS `Cluster`;
CREATE TABLE `Cluster` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Name` varchar(32) NOT NULL DEFAULT ''COMMENT' 集群名字 ',
`AppId` varchar(32) NOT NULL DEFAULT ''COMMENT'App id',
`ParentClusterId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父 cluster',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT ''COMMENT' 创建人邮箱前缀 ',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_AppId_Name` (`AppId`,`Name`),
KEY `IX_ParentClusterId` (`ParentClusterId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='集群';
-- ----------------------------
-- Records of Cluster
-- ----------------------------
BEGIN;
INSERT INTO `Cluster` VALUES (1, 'default', 'SampleApp', 0, b'0', '','2019-04-14 14:13:47','', '2019-04-14 14:13:47');
INSERT INTO `Cluster` VALUES (2, 'default', 'myapp', 0, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
COMMIT;
-- ----------------------------
-- Table structure for Commit
-- ----------------------------
DROP TABLE IF EXISTS `Commit`;
CREATE TABLE `Commit` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`ChangeSets` longtext NOT NULL COMMENT '修改变更集',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
`NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
`Comment` varchar(500) DEFAULT NULL COMMENT '备注',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `AppId` (`AppId`(191)),
KEY `ClusterName` (`ClusterName`(191)),
KEY `NamespaceName` (`NamespaceName`(191))
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表';
-- ----------------------------
-- Records of Commit
-- ----------------------------
BEGIN;
INSERT INTO `Commit` VALUES (1, '{\"createItems\":[{\"namespaceId\":2,\"key\":\"spring.test\",\"value\":\" 测试 apollo\",\"lineNum\":1,\"id\":2,\"isDeleted\":false,\"dataChangeCreatedBy\":\"apollo\",\"dataChangeCreatedTime\":\"2019-04-16 13:42:15\",\"dataChangeLastModifiedBy\":\"apollo\",\"dataChangeLastModifiedTime\":\"2019-04-16 13:42:15\"}],\"updateItems\":[],\"deleteItems\":[]}', 'myapp', 'default', 'application', NULL, b'0', 'apollo', '2019-04-16 13:42:16', 'apollo', '2019-04-16 13:42:16');
COMMIT;
-- ----------------------------
-- Table structure for GrayReleaseRule
-- ----------------------------
DROP TABLE IF EXISTS `GrayReleaseRule`;
CREATE TABLE `GrayReleaseRule` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
`NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
`BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'branch name',
`Rules` varchar(16000) DEFAULT '[]' COMMENT '灰度规则',
`ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '灰度对应的 release',
`BranchStatus` tinyint(2) DEFAULT '1' COMMENT '灰度分支状态: 0: 删除分支,1: 正在使用的规则 2:全量发布',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表';
-- ----------------------------
-- Table structure for Instance
-- ----------------------------
DROP TABLE IF EXISTS `Instance`;
CREATE TABLE `Instance` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
`DataCenter` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Data Center Name',
`Ip` varchar(32) NOT NULL DEFAULT ''COMMENT'instance ip',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
UNIQUE KEY `IX_UNIQUE_KEY` (`AppId`,`ClusterName`,`Ip`,`DataCenter`),
KEY `IX_IP` (`Ip`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例';
-- ----------------------------
-- Records of Instance
-- ----------------------------
BEGIN;
INSERT INTO `Instance` VALUES (1, 'myapp', 'default', '','10.153.111.139','2019-04-16 14:02:53','2019-04-16 14:02:53');
COMMIT;
-- ----------------------------
-- Table structure for InstanceConfig
-- ----------------------------
DROP TABLE IF EXISTS `InstanceConfig`;
CREATE TABLE `InstanceConfig` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id',
`ConfigAppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config App Id',
`ConfigClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name',
`ConfigNamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name',
`ReleaseKey` varchar(64) NOT NULL DEFAULT ''COMMENT' 发布的 Key',
`ReleaseDeliveryTime` timestamp NULL DEFAULT NULL COMMENT '配置获取时间',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
UNIQUE KEY `IX_UNIQUE_KEY` (`InstanceId`,`ConfigAppId`,`ConfigNamespaceName`),
KEY `IX_ReleaseKey` (`ReleaseKey`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息';
-- ----------------------------
-- Records of InstanceConfig
-- ----------------------------
BEGIN;
INSERT INTO `InstanceConfig` VALUES (1, 1, 'myapp', 'default', 'application', '20190416134223-7f43754dbb4ca14b', '2019-04-16 14:02:52', '2019-04-16 14:02:52', '2019-04-16 14:02:52');
INSERT INTO `InstanceConfig` VALUES (2, 1, 'myapp', 'default', 'test', '20190416135729-be85754dbb4ca14c', '2019-04-16 14:02:52', '2019-04-16 14:02:52', '2019-04-16 14:02:52');
COMMIT;
-- ----------------------------
-- Table structure for Item
-- ----------------------------
DROP TABLE IF EXISTS `Item`;
CREATE TABLE `Item` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群 NamespaceId',
`Key` varchar(128) NOT NULL DEFAULT 'default' COMMENT '配置项 Key',
`Value` longtext NOT NULL COMMENT '配置项值',
`Comment` varchar(1024) DEFAULT ''COMMENT' 注释 ',
`LineNum` int(10) unsigned DEFAULT '0' COMMENT '行号',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_GroupId` (`NamespaceId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='配置项目';
-- ----------------------------
-- Records of Item
-- ----------------------------
BEGIN;
INSERT INTO `Item` VALUES (1, 1, 'timeout', '100', 'sample timeout 配置', 1, b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `Item` VALUES (2, 2, 'spring.test', '测试 apollo', NULL, 1, b'0', 'apollo', '2019-04-16 13:42:16', 'apollo', '2019-04-16 13:42:16');
COMMIT;
-- ----------------------------
-- Table structure for Namespace
-- ----------------------------
DROP TABLE IF EXISTS `Namespace`;
CREATE TABLE `Namespace` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name',
`NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `AppId_ClusterName_NamespaceName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_NamespaceName` (`NamespaceName`(191))
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='命名空间';
-- ----------------------------
-- Records of Namespace
-- ----------------------------
BEGIN;
INSERT INTO `Namespace` VALUES (1, 'SampleApp', 'default', 'application', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `Namespace` VALUES (2, 'myapp', 'default', 'application', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Namespace` VALUES (3, 'myapp', 'default', 'test', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
COMMIT;
-- ----------------------------
-- Table structure for NamespaceLock
-- ----------------------------
DROP TABLE IF EXISTS `NamespaceLock`;
CREATE TABLE `NamespaceLock` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 id',
`NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群 NamespaceId',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT 'default' COMMENT '最后修改人邮箱前缀',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
`IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除',
PRIMARY KEY (`Id`),
UNIQUE KEY `IX_NamespaceId` (`NamespaceId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace 的编辑锁';
-- ----------------------------
-- Table structure for Release
-- ----------------------------
DROP TABLE IF EXISTS `Release`;
CREATE TABLE `Release` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`ReleaseKey` varchar(64) NOT NULL DEFAULT ''COMMENT' 发布的 Key',
`Name` varchar(64) NOT NULL DEFAULT 'default' COMMENT '发布名字',
`Comment` varchar(256) DEFAULT NULL COMMENT '发布说明',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
`NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
`Configurations` longtext NOT NULL COMMENT '发布配置',
`IsAbandoned` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否废弃',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `AppId_ClusterName_GroupName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_ReleaseKey` (`ReleaseKey`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='发布';
-- ----------------------------
-- Records of Release
-- ----------------------------
BEGIN;
INSERT INTO `Release` VALUES (1, '20161009155425-d3a0749c6e20bc15', '20161009155424-release', 'Sample 发布', 'SampleApp', 'default', 'application', '{\"timeout\":\"100\"}', b'0', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `Release` VALUES (2, '20190416134141-7f43754dbb4ca14a', '20190416134137-release', '','myapp','default','application','{}', b'0', b'0','apollo','2019-04-16 13:41:41','apollo','2019-04-16 13:41:41');
INSERT INTO `Release` VALUES (3, '20190416134223-7f43754dbb4ca14b', '20190416134221-release', '','myapp','default','application','{\"spring.test\":\"测试 apollo\"}', b'0', b'0','apollo','2019-04-16 13:42:23','apollo','2019-04-16 13:42:23');
INSERT INTO `Release` VALUES (4, '20190416135729-be85754dbb4ca14c', '20190416135728-release', '','myapp','default','test','{}', b'0', b'0','apollo','2019-04-16 13:57:30','apollo','2019-04-16 13:57:30');
COMMIT;
-- ----------------------------
-- Table structure for ReleaseHistory
-- ----------------------------
DROP TABLE IF EXISTS `ReleaseHistory`;
CREATE TABLE `ReleaseHistory` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName',
`NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'namespaceName',
`BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT '发布分支名',
`ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联的 Release Id',
`PreviousReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '前一次发布的 ReleaseId',
`Operation` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '发布类型,0: 普通发布,1: 回滚,2: 灰度发布,3: 灰度规则更新,4: 灰度合并回主分支发布,5: 主分支发布灰度自动发布,6: 主分支回滚灰度自动发布,7: 放弃灰度',
`OperationContext` longtext NOT NULL COMMENT '发布上下文信息',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`),
KEY `IX_ReleaseId` (`ReleaseId`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='发布历史';
-- ----------------------------
-- Records of ReleaseHistory
-- ----------------------------
BEGIN;
INSERT INTO `ReleaseHistory` VALUES (1, 'SampleApp', 'default', 'application', 'default', 1, 0, 0, '{}', b'0', 'apollo', '2019-04-14 14:13:47', 'apollo', '2019-04-14 14:13:47');
INSERT INTO `ReleaseHistory` VALUES (2, 'myapp', 'default', 'application', 'default', 2, 0, 0, '{\"isEmergencyPublish\":false}', b'0', 'apollo', '2019-04-16 13:41:41', 'apollo', '2019-04-16 13:41:41');
INSERT INTO `ReleaseHistory` VALUES (3, 'myapp', 'default', 'application', 'default', 3, 2, 0, '{\"isEmergencyPublish\":false}', b'0', 'apollo', '2019-04-16 13:42:23', 'apollo', '2019-04-16 13:42:23');
INSERT INTO `ReleaseHistory` VALUES (4, 'myapp', 'default', 'test', 'default', 4, 0, 0, '{\"isEmergencyPublish\":false}', b'0', 'apollo', '2019-04-16 13:57:30', 'apollo', '2019-04-16 13:57:30');
COMMIT;
-- ----------------------------
-- Table structure for ReleaseMessage
-- ----------------------------
DROP TABLE IF EXISTS `ReleaseMessage`;
CREATE TABLE `ReleaseMessage` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Message` varchar(1024) NOT NULL DEFAULT ''COMMENT' 发布的消息内容 ',
`DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Message` (`Message`(191))
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='发布消息';
-- ----------------------------
-- Records of ReleaseMessage
-- ----------------------------
BEGIN;
INSERT INTO `ReleaseMessage` VALUES (2, 'myapp+default+application', '2019-04-16 13:42:23');
INSERT INTO `ReleaseMessage` VALUES (3, 'myapp+default+test', '2019-04-16 13:57:30');
COMMIT;
-- ----------------------------
-- Table structure for ServerConfig
-- ----------------------------
DROP TABLE IF EXISTS `ServerConfig`;
CREATE TABLE `ServerConfig` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项 Key',
`Cluster` varchar(32) NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default 为不针对特定的集群',
`Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值',
`Comment` varchar(1024) DEFAULT ''COMMENT' 注释 ',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_Key` (`Key`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
-- ----------------------------
-- Records of ServerConfig
-- ----------------------------
BEGIN;
INSERT INTO `ServerConfig` VALUES (1, 'eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka 服务 Url,多个 service 以英文逗号分隔', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `ServerConfig` VALUES (2, 'namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `ServerConfig` VALUES (3, 'item.value.length.limit', 'default', '20000', 'item value 最大长度限制', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `ServerConfig` VALUES (4, 'config-service.cache.enabled', 'default', 'false', 'ConfigService 是否开启缓存,开启后能提高性能,但是会增大内存消耗!', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
INSERT INTO `ServerConfig` VALUES (5, 'item.key.length.limit', 'default', '128', 'item key 最大长度限制', b'0', 'default', '2019-04-14 14:13:47', '','2019-04-14 14:13:47');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
ApolloPortalDB:
/*
Navicat Premium Data Transfer
Source Server : mylocal
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3306
Source Schema : ApolloPortalDB
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 30/04/2019 14:06:53
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for App
-- ----------------------------
DROP TABLE IF EXISTS `App`;
CREATE TABLE `App` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
`OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门 Id',
`OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
`OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
`OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `AppId` (`AppId`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_Name` (`Name`(191))
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='应用表';
-- ----------------------------
-- Records of App
-- ----------------------------
BEGIN;
INSERT INTO `App` VALUES (1, 'SampleApp', 'Sample App', 'TEST1', '样例部门 1', 'apollo', 'apollo@acme.com', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `App` VALUES (2, 'myapp', '测试应用', 'TEST1', '样例部门 1', 'apollo', 'apollo@acme.com', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
COMMIT;
-- ----------------------------
-- Table structure for AppNamespace
-- ----------------------------
DROP TABLE IF EXISTS `AppNamespace`;
CREATE TABLE `AppNamespace` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`Name` varchar(32) NOT NULL DEFAULT ''COMMENT'namespace 名字,注意,需要全局唯一 ',
`AppId` varchar(32) NOT NULL DEFAULT ''COMMENT'app id',
`Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace 的 format 类型',
`IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace 是否为公共',
`Comment` varchar(64) NOT NULL DEFAULT ''COMMENT' 注释 ',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT ''COMMENT' 创建人邮箱前缀 ',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_AppId` (`AppId`),
KEY `Name_AppId` (`Name`,`AppId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='应用 namespace 定义';
-- ----------------------------
-- Records of AppNamespace
-- ----------------------------
BEGIN;
INSERT INTO `AppNamespace` VALUES (1, 'application', 'SampleApp', 'properties', b'0', 'default app namespace', b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `AppNamespace` VALUES (2, 'application', 'myapp', 'properties', b'0', 'default app namespace', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `AppNamespace` VALUES (3, 'test', 'myapp', 'properties', b'1', '', b'0','apollo','2019-04-16 13:57:05','apollo','2019-04-16 13:57:05');
COMMIT;
-- ----------------------------
-- Table structure for Authorities
-- ----------------------------
DROP TABLE IF EXISTS `Authorities`;
CREATE TABLE `Authorities` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`Username` varchar(64) NOT NULL,
`Authority` varchar(50) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of Authorities
-- ----------------------------
BEGIN;
INSERT INTO `Authorities` VALUES (1, 'apollo', 'ROLE_user');
COMMIT;
-- ----------------------------
-- Table structure for Consumer
-- ----------------------------
DROP TABLE IF EXISTS `Consumer`;
CREATE TABLE `Consumer` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名',
`OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门 Id',
`OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字',
`OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName',
`OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `AppId` (`AppId`(191)),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开放 API 消费者';
-- ----------------------------
-- Table structure for ConsumerAudit
-- ----------------------------
DROP TABLE IF EXISTS `ConsumerAudit`;
CREATE TABLE `ConsumerAudit` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
`Uri` varchar(1024) NOT NULL DEFAULT ''COMMENT' 访问的 Uri',
`Method` varchar(16) NOT NULL DEFAULT ''COMMENT' 访问的 Method',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_ConsumerId` (`ConsumerId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer 审计表';
-- ----------------------------
-- Table structure for ConsumerRole
-- ----------------------------
DROP TABLE IF EXISTS `ConsumerRole`;
CREATE TABLE `ConsumerRole` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'Consumer Id',
`RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) DEFAULT ''COMMENT' 创建人邮箱前缀 ',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_RoleId` (`RoleId`),
KEY `IX_ConsumerId_RoleId` (`ConsumerId`,`RoleId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer 和 role 的绑定表';
-- ----------------------------
-- Table structure for ConsumerToken
-- ----------------------------
DROP TABLE IF EXISTS `ConsumerToken`;
CREATE TABLE `ConsumerToken` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`ConsumerId` int(11) unsigned DEFAULT NULL COMMENT 'ConsumerId',
`Token` varchar(128) NOT NULL DEFAULT ''COMMENT'token',
`Expires` datetime NOT NULL DEFAULT '2099-01-01 00:00:00' COMMENT 'token 失效时间',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
UNIQUE KEY `IX_Token` (`Token`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='consumer token 表';
-- ----------------------------
-- Table structure for Favorite
-- ----------------------------
DROP TABLE IF EXISTS `Favorite`;
CREATE TABLE `Favorite` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`UserId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '收藏的用户',
`AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID',
`Position` int(32) NOT NULL DEFAULT '10000' COMMENT '收藏顺序',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `AppId` (`AppId`(191)),
KEY `IX_UserId` (`UserId`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COMMENT='应用收藏表';
-- ----------------------------
-- Table structure for Permission
-- ----------------------------
DROP TABLE IF EXISTS `Permission`;
CREATE TABLE `Permission` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`PermissionType` varchar(32) NOT NULL DEFAULT ''COMMENT' 权限类型 ',
`TargetId` varchar(256) NOT NULL DEFAULT ''COMMENT' 权限对象类型 ',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT ''COMMENT' 创建人邮箱前缀 ',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_TargetId_PermissionType` (`TargetId`(191),`PermissionType`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COMMENT='permission 表';
-- ----------------------------
-- Records of Permission
-- ----------------------------
BEGIN;
INSERT INTO `Permission` VALUES (1, 'CreateCluster', 'SampleApp', b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `Permission` VALUES (2, 'CreateNamespace', 'SampleApp', b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `Permission` VALUES (3, 'AssignRole', 'SampleApp', b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `Permission` VALUES (4, 'ModifyNamespace', 'SampleApp+application', b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `Permission` VALUES (5, 'ReleaseNamespace', 'SampleApp+application', b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `Permission` VALUES (6, 'CreateCluster', 'myapp', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Permission` VALUES (7, 'CreateNamespace', 'myapp', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Permission` VALUES (8, 'AssignRole', 'myapp', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Permission` VALUES (9, 'ModifyNamespace', 'myapp+application', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Permission` VALUES (10, 'ReleaseNamespace', 'myapp+application', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Permission` VALUES (11, 'ModifyNamespace', 'myapp+application+DEV', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Permission` VALUES (12, 'ReleaseNamespace', 'myapp+application+DEV', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Permission` VALUES (13, 'ModifyNamespace', 'myapp+test', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `Permission` VALUES (14, 'ReleaseNamespace', 'myapp+test', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `Permission` VALUES (15, 'ModifyNamespace', 'myapp+test+DEV', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `Permission` VALUES (16, 'ReleaseNamespace', 'myapp+test+DEV', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
COMMIT;
-- ----------------------------
-- Table structure for Role
-- ----------------------------
DROP TABLE IF EXISTS `Role`;
CREATE TABLE `Role` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`RoleName` varchar(256) NOT NULL DEFAULT ''COMMENT'Role name',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_RoleName` (`RoleName`(191)),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COMMENT='角色表';
-- ----------------------------
-- Records of Role
-- ----------------------------
BEGIN;
INSERT INTO `Role` VALUES (1, 'Master+SampleApp', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `Role` VALUES (2, 'ModifyNamespace+SampleApp+application', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `Role` VALUES (3, 'ReleaseNamespace+SampleApp+application', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `Role` VALUES (4, 'Master+myapp', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Role` VALUES (5, 'ModifyNamespace+myapp+application', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Role` VALUES (6, 'ReleaseNamespace+myapp+application', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Role` VALUES (7, 'ModifyNamespace+myapp+application+DEV', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Role` VALUES (8, 'ReleaseNamespace+myapp+application+DEV', b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `Role` VALUES (9, 'ModifyNamespace+myapp+test', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `Role` VALUES (10, 'ReleaseNamespace+myapp+test', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `Role` VALUES (11, 'ModifyNamespace+myapp+test+DEV', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `Role` VALUES (12, 'ReleaseNamespace+myapp+test+DEV', b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
COMMIT;
-- ----------------------------
-- Table structure for RolePermission
-- ----------------------------
DROP TABLE IF EXISTS `RolePermission`;
CREATE TABLE `RolePermission` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
`PermissionId` int(10) unsigned DEFAULT NULL COMMENT 'Permission Id',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) DEFAULT ''COMMENT' 创建人邮箱前缀 ',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_RoleId` (`RoleId`),
KEY `IX_PermissionId` (`PermissionId`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限的绑定表';
-- ----------------------------
-- Records of RolePermission
-- ----------------------------
BEGIN;
INSERT INTO `RolePermission` VALUES (1, 1, 1, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `RolePermission` VALUES (2, 1, 2, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `RolePermission` VALUES (3, 1, 3, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `RolePermission` VALUES (4, 2, 4, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `RolePermission` VALUES (5, 3, 5, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `RolePermission` VALUES (6, 4, 6, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `RolePermission` VALUES (7, 4, 7, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `RolePermission` VALUES (8, 4, 8, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `RolePermission` VALUES (9, 5, 9, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `RolePermission` VALUES (10, 6, 10, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `RolePermission` VALUES (11, 7, 11, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `RolePermission` VALUES (12, 8, 12, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `RolePermission` VALUES (13, 9, 13, b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `RolePermission` VALUES (14, 10, 14, b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `RolePermission` VALUES (15, 11, 15, b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `RolePermission` VALUES (16, 12, 16, b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
COMMIT;
-- ----------------------------
-- Table structure for ServerConfig
-- ----------------------------
DROP TABLE IF EXISTS `ServerConfig`;
CREATE TABLE `ServerConfig` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项 Key',
`Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值',
`Comment` varchar(1024) DEFAULT ''COMMENT' 注释 ',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_Key` (`Key`),
KEY `DataChange_LastTime` (`DataChange_LastTime`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置';
-- ----------------------------
-- Records of ServerConfig
-- ----------------------------
BEGIN;
INSERT INTO `ServerConfig` VALUES (1, 'apollo.portal.envs', 'dev', '可支持的环境列表', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `ServerConfig` VALUES (2, 'organizations', '[{\"orgId\":\"TEST1\",\"orgName\":\" 样例部门 1\"},{\"orgId\":\"TEST2\",\"orgName\":\" 样例部门 2\"}]', '部门列表', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `ServerConfig` VALUES (3, 'superAdmin', 'apollo', 'Portal 超级管理员', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `ServerConfig` VALUES (4, 'api.readTimeout', '10000', 'http 接口 read timeout', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `ServerConfig` VALUES (5, 'consumer.token.salt', 'someSalt', 'consumer token salt', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `ServerConfig` VALUES (6, 'admin.createPrivateNamespace.switch', 'true', '是否允许项目管理员创建私有 namespace', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
INSERT INTO `ServerConfig` VALUES (7, 'configView.memberOnly.envs', 'dev', '只对项目成员显示配置信息的环境列表,多个 env 以英文逗号分隔', b'0', 'default', '2019-04-14 14:12:42', '','2019-04-14 14:12:42');
COMMIT;
-- ----------------------------
-- Table structure for UserRole
-- ----------------------------
DROP TABLE IF EXISTS `UserRole`;
CREATE TABLE `UserRole` (`Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`UserId` varchar(128) DEFAULT ''COMMENT' 用户身份标识 ',
`RoleId` int(10) unsigned DEFAULT NULL COMMENT 'Role Id',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DataChange_CreatedBy` varchar(32) DEFAULT ''COMMENT' 创建人邮箱前缀 ',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`DataChange_LastModifiedBy` varchar(32) DEFAULT ''COMMENT' 最后修改人邮箱前缀 ',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
PRIMARY KEY (`Id`),
KEY `IX_DataChange_LastTime` (`DataChange_LastTime`),
KEY `IX_RoleId` (`RoleId`),
KEY `IX_UserId_RoleId` (`UserId`,`RoleId`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COMMENT='用户和 role 的绑定表';
-- ----------------------------
-- Records of UserRole
-- ----------------------------
BEGIN;
INSERT INTO `UserRole` VALUES (1, 'apollo', 1, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `UserRole` VALUES (2, 'apollo', 2, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `UserRole` VALUES (3, 'apollo', 3, b'0', '','2019-04-14 14:12:42','', '2019-04-14 14:12:42');
INSERT INTO `UserRole` VALUES (4, 'apollo', 4, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `UserRole` VALUES (5, 'apollo', 5, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `UserRole` VALUES (6, 'apollo', 6, b'0', 'apollo', '2019-04-16 13:41:28', 'apollo', '2019-04-16 13:41:28');
INSERT INTO `UserRole` VALUES (7, 'apollo', 9, b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
INSERT INTO `UserRole` VALUES (8, 'apollo', 10, b'0', 'apollo', '2019-04-16 13:57:05', 'apollo', '2019-04-16 13:57:05');
COMMIT;
-- ----------------------------
-- Table structure for Users
-- ----------------------------
DROP TABLE IF EXISTS `Users`;
CREATE TABLE `Users` (`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增 Id',
`Username` varchar(64) NOT NULL DEFAULT 'default' COMMENT '用户名',
`Password` varchar(64) NOT NULL DEFAULT 'default' COMMENT '密码',
`Email` varchar(64) NOT NULL DEFAULT 'default' COMMENT '邮箱地址',
`Enabled` tinyint(4) DEFAULT NULL COMMENT '是否有效',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
-- ----------------------------
-- Records of Users
-- ----------------------------
BEGIN;
INSERT INTO `Users` VALUES (1, 'apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo@acme.com', 1);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
- 下载源码
https://gitee.com/lepdou/apol… - Main class 配置
com.ctrip.framework.apollo.assembly.ApolloApplication
-
VM options 配置
-Dapollo_profile=github -Dspring.datasource.url=jdbc:mysql://localhost:3306/ApolloConfigDB?characterEncoding=utf8 -Dspring.datasource.username=root -Dspring.datasource.password=welcome1 -Dlogging.file=/Users/liulq/Documents/logs/apollo-assembly.log
- Program arguments 配置
–configservice –adminservice -
Apollo-Portal 配置
Main class 配置:com.ctrip.framework.apollo.portal.PortalApplication
VM options 配置:-Dapollo_profile=github,auth -Ddev_meta=http://localhost:8080/ -Dserver.port=8070 -Dspring.datasource.url=jdbc:mysql://localhost:3306/ApolloPortalDB?characterEncoding=utf8 -Dspring.datasource.username=root -Dspring.datasource.password=welcome1 -Dlogging.file=//Users/liulq/Documents/logs/apollo-portal.log
- 启动 ApolloApplication 和 PortalApplication
访问 http://localhost:8070/
初始账号密码是:apollo/admin
创建项目,输入 appId 为 myapp, 添加完项目会默认带一个私有配置文件 (application.properties), 在配置文件中添加配置:spring.test=hello apollo - 列表项目客户端接入
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.de.apollo</groupId>
<artifactId>apollodemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>apollodemo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<!-- for spring boot demo -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<!-- for refresh scope demo -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<!-- take over jcl -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
在 resources 目录下创建 META-INF 文件夹,在 META-INF 文件夹下创建 app.properties 文件
app.id=myapp
- 客户端 VM options 配置
-Dapollo.meta=http://localhost:8080
-Dapp.id=myapp
-Denv=DEV
- 添加 controller 读取配置
@RestController
public class Testontroller {@Value("${spring.test}")
private String test;
@GetMapping("/test")
public String xdadxa() {System.out.println(test);
return test;
}
}
- 详细使用
https://github.com/ctripcorp/…
https://github.com/ctripcorp/…
正文完
发表至:无分类
2019-04-30