我问问
环境介质的准备
创建了上面的三个数据库
接下来我们要修改下首页访问的的数据库apolloportaldb这个数据库,需要修改下面的几个配置,在serverconfig中需要增加你当前需要支持的环境的类型现在支持dev、pro,修改变成下面的形式
如果要增加组织机构,只需要在organizations上面添加数据
[{"orgId":"TEST1","orgName":"应用平台部"},{"orgId":"TEST2","orgName":"零售企金"}]
接下来我们来查看下poortal的文件的目录结构
接下来修改对于的portal的配置文件
首先修改apollo-portal.conf,在里面配置portal运行产生的日志的存储目录,这里的100003173是对于的porttal这个进程运行的唯一ID,默认不用修改
这个目录下配置的日志路径要首先在服务器节点上面创建好
接下来进入到H:\apollo-1.7.1-all\apollo-portal-1.7.1-github\config目录下,我们来继续修改配置文件
apollo-env.properties配置文件主要是一个portal可以管理多套环境,apollo-env.properties里面主要配置每套环境对应的meta-server的地址,portal通过meta-server来查询每套环境的admin server用来发布配置
从而一个portal就能够管理多套环境
1.7版本默认 meta-server、Eureka注册中心server、config server都是部署在同一个jvm 进程中,这里我模拟一台电脑上搭建两套环境,一个dev 一个是pro,dev对于的config server的端口为8081,pro对应的configserver的端口为8082
接下来修改下application-github.properties配置文件,里面主要修改portal首页访问的数据库的信息
如果需要修改portal对应的端口,需要进入scripts下修改下startup.sh中
这样整个portal就已经正常配置成功了
同理接下来配置config server,这里就介绍配置apollo-configservice-1.7.1-dev,配置apollo-configservice-1.7.1-pro类型学
apollo-configservice.conf里面主要设置日志的路径
接下来进入到H:\apollo-1.7.1-all\apollo-configservice-1.7.1-dev\config目录下面
app.properties中主要是当前config server应用唯一的编号id,默认情况下不用修改
这里需要注意的是:如果你在一台机器上面模拟启动两套环境,就要启动两个configserve进程,在这里就要修改下appID保证唯一性,在启动apollo-configservice-1.7.1-pro就需要修改下编号
application-github.properties
里面主要是修改数据库的配置
apollo-configservice-1.7.1-pro启动的时候配置的数据库就是对于ApolloConfigDB-pro
这样配置就配置成功了,接下来,我们需要指定当前config server启动的端口是啥了,我们进入到H:\apollo-1.7.1-all\apollo-configservice-1.7.1-dev\scripts目录下
我们需要修改startup.sh这个脚本
第一个修改端口,第二个修改日志路径一定要和上面apollo-configservice.conf中配置的一样,修改之后如下
这里congsevice就已经配置完成了。接下来我们修改下adminserver
我们进入到apollo-adminservice-1.7.1-dev目录下
首先修改下apollo-adminservice.conf的日志配置数据信息
同理修改下config下面的配置,apollo-adminservice-1.7.1-dev和apollo-configservice-1.7.1-dev是同一套dev环境用的是同一套数据库
同理需要修改下startup.sh里面的端口和日志路径
接下来有一个很重要的点:
apollo-adminservice-1.7.1-dev和apollo-configservice-1.7.1-dev是同一套dev环境用的是同一套数据库ApolloConfigDB-dev,
在dev这个环境中adminservice-和configservice我们可以部署多个节点保证高可用,adminservice-和configservice都需要注册到注册中心上面,我们指定erureka server部署和config server部署在同一个jvm进程中,注册中心的地址就是config-server的地址,我们需要修改下面的配置
注意点如下
对于pro环境的配置同上面配置一样apollo-configservice-1.7.1-pro和apollo-adminservice-1.7.1-pro连接的数据库变成了ApolloConfigDB-pro
其次就是需要修改下configservice、adminservice的启动端口和日志路径
启动之后默认的用户名是apollo,密码是admin
使用nginx代理阿apollo的portal
接下来我们重点来看下全部的配置
首先看下apollo-portal-1.7.1-github
apollo-portal.conf
MODE=service PID_FOLDER=. LOG_FOLDER=H:\apollo-1.7.1-all\apollo-portal-1.7.1-github\logs\100003173
apollo-env.properties这个配置最为重要,portal要管理两套环境,一套是dev环境,一套是pro环境,portal通过每套环境下面meta-server找到每套环境下的adminserver的节点的地址,然后调用adminserver的接口来发布配置,所以这里配置dev环境下面meta-server的地址、pro环境下面meta-server的地址,由于meta-server和configserver部署在同一个进程中,所以这里配置configserver的地址
由于同一台电脑要启动两个configserve的地址,dev环境下面的configserver的端口为18081,dev环境下面的configserver的端口为18082
apollo-env.properties
dev.meta=http://localhost:8081 pro.meta=http://localhost:8082
app.properties默认不用修改
appId=100003173 jdkVersion=1.8
application-github.properties主要配置portal访问的数据库的信息
# DataSource spring.datasource.url = jdbc:mysql://127.0.0.1:3306/ApolloPortalDB?characterEncoding=utf8&serverTimezone=UTC spring.datasource.username = root spring.datasource.password = 123456
ApolloPortalDB有两个地址需要注意,需要在serverConfig表中指定当前portal管理dev、pro的信息
整个
ApolloPortalDB脚本的值如下
/* Navicat Premium Data Transfer Source Server : apollo Source Server Type : MySQL Source Server Version : 50718 Source Host : localhost:3306 Source Schema : apolloportaldb Target Server Type : MySQL Target Server Version : 50718 File Encoding : 65001 Date: 26/08/2020 18:27:27 */ 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `Name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '应用名', `OrgId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '部门Id', `OrgName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '部门名字', `OwnerName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ownerName', `OwnerEmail` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `AppId`(`AppId`(191)) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_Name`(`Name`(191)) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of app -- ---------------------------- INSERT INTO `app` VALUES (1, 'SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `app` VALUES (2, 'dianshangxitongpeiz', '电商系统配置', 'TEST1', '应用平台部', 'apollo', 'apollo@acme.com', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); -- ---------------------------- -- Table structure for appnamespace -- ---------------------------- DROP TABLE IF EXISTS `appnamespace`; CREATE TABLE `appnamespace` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一', `AppId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'app id', `Format` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型', `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共', `Comment` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_AppId`(`AppId`) USING BTREE, INDEX `Name_AppId`(`Name`, `AppId`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用namespace定义' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appnamespace -- ---------------------------- INSERT INTO `appnamespace` VALUES (1, 'application', 'SampleApp', 'properties', b'0', 'default app namespace', b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `appnamespace` VALUES (2, 'application', 'dianshangxitongpeiz', 'properties', b'0', 'default app namespace', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `appnamespace` VALUES (3, 'juo', 'dianshangxitongpeiz', 'properties', b'1', '', b'0', 'apollo', '2020-08-26 10:04:58', 'apollo', '2020-08-26 10:04:58'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `Authority` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`Id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of authorities -- ---------------------------- INSERT INTO `authorities` VALUES (1, 'apollo', 'ROLE_user'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `Name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '应用名', `OrgId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '部门Id', `OrgName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '部门名字', `OwnerName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ownerName', `OwnerEmail` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `AppId`(`AppId`(191)) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '开放API消费者' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '访问的Uri', `Method` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '访问的Method', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_ConsumerId`(`ConsumerId`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'consumer审计表' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_RoleId`(`RoleId`) USING BTREE, INDEX `IX_ConsumerId_RoleId`(`ConsumerId`, `RoleId`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'consumer和role的绑定表' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'token', `Expires` datetime(0) 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_Token`(`Token`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'consumer token表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for favorite -- ---------------------------- DROP TABLE IF EXISTS `favorite`; CREATE TABLE `favorite` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', `UserId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '收藏的用户', `AppId` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `AppId`(`AppId`(191)) USING BTREE, INDEX `IX_UserId`(`UserId`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用收藏表' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限类型', `TargetId` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '权限对象类型', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_TargetId_PermissionType`(`TargetId`(191), `PermissionType`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'permission表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of permission -- ---------------------------- INSERT INTO `permission` VALUES (1, 'CreateCluster', 'SampleApp', b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `permission` VALUES (2, 'CreateNamespace', 'SampleApp', b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `permission` VALUES (3, 'AssignRole', 'SampleApp', b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `permission` VALUES (4, 'ModifyNamespace', 'SampleApp+application', b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `permission` VALUES (5, 'ReleaseNamespace', 'SampleApp+application', b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `permission` VALUES (6, 'CreateApplication', 'SystemRole', b'0', 'apollo', '2020-08-26 08:53:31', 'apollo', '2020-08-26 08:53:31'); INSERT INTO `permission` VALUES (7, 'AssignRole', 'dianshangxitongpeiz', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (8, 'CreateNamespace', 'dianshangxitongpeiz', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (9, 'CreateCluster', 'dianshangxitongpeiz', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (10, 'ManageAppMaster', 'dianshangxitongpeiz', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (11, 'ModifyNamespace', 'dianshangxitongpeiz+application', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (12, 'ReleaseNamespace', 'dianshangxitongpeiz+application', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (13, 'ModifyNamespace', 'dianshangxitongpeiz+application+DEV', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (14, 'ReleaseNamespace', 'dianshangxitongpeiz+application+DEV', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `permission` VALUES (15, 'ModifyNamespace', 'dianshangxitongpeiz+application+PRO', b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `permission` VALUES (16, 'ReleaseNamespace', 'dianshangxitongpeiz+application+PRO', b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `permission` VALUES (17, 'ModifyNamespace', 'dianshangxitongpeiz+juo', b'0', 'apollo', '2020-08-26 10:04:58', 'apollo', '2020-08-26 10:04:58'); INSERT INTO `permission` VALUES (18, 'ReleaseNamespace', 'dianshangxitongpeiz+juo', b'0', 'apollo', '2020-08-26 10:04:58', 'apollo', '2020-08-26 10:04:58'); INSERT INTO `permission` VALUES (19, 'ModifyNamespace', 'dianshangxitongpeiz+juo+DEV', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `permission` VALUES (20, 'ReleaseNamespace', 'dianshangxitongpeiz+juo+DEV', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `permission` VALUES (21, 'ModifyNamespace', 'dianshangxitongpeiz+juo+PRO', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `permission` VALUES (22, 'ReleaseNamespace', 'dianshangxitongpeiz+juo+PRO', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Role name', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_RoleName`(`RoleName`(191)) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of role -- ---------------------------- INSERT INTO `role` VALUES (1, 'Master+SampleApp', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `role` VALUES (2, 'ModifyNamespace+SampleApp+application', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `role` VALUES (3, 'ReleaseNamespace+SampleApp+application', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `role` VALUES (4, 'CreateApplication+SystemRole', b'0', 'apollo', '2020-08-26 08:53:31', 'apollo', '2020-08-26 08:53:31'); INSERT INTO `role` VALUES (5, 'Master+dianshangxitongpeiz', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `role` VALUES (6, 'ManageAppMaster+dianshangxitongpeiz', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `role` VALUES (7, 'ModifyNamespace+dianshangxitongpeiz+application', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `role` VALUES (8, 'ReleaseNamespace+dianshangxitongpeiz+application', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `role` VALUES (9, 'ModifyNamespace+dianshangxitongpeiz+application+DEV', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `role` VALUES (10, 'ReleaseNamespace+dianshangxitongpeiz+application+DEV', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `role` VALUES (11, 'ModifyNamespace+dianshangxitongpeiz+application+PRO', b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `role` VALUES (12, 'ReleaseNamespace+dianshangxitongpeiz+application+PRO', b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `role` VALUES (13, 'ModifyNamespace+dianshangxitongpeiz+juo', b'0', 'apollo', '2020-08-26 10:04:58', 'apollo', '2020-08-26 10:04:58'); INSERT INTO `role` VALUES (14, 'ReleaseNamespace+dianshangxitongpeiz+juo', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `role` VALUES (15, 'ModifyNamespace+dianshangxitongpeiz+juo+DEV', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `role` VALUES (16, 'ReleaseNamespace+dianshangxitongpeiz+juo+DEV', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `role` VALUES (17, 'ModifyNamespace+dianshangxitongpeiz+juo+PRO', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `role` VALUES (18, 'ReleaseNamespace+dianshangxitongpeiz+juo+PRO', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_RoleId`(`RoleId`) USING BTREE, INDEX `IX_PermissionId`(`PermissionId`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色和权限的绑定表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of rolepermission -- ---------------------------- INSERT INTO `rolepermission` VALUES (1, 1, 1, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `rolepermission` VALUES (2, 1, 2, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `rolepermission` VALUES (3, 1, 3, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `rolepermission` VALUES (4, 2, 4, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `rolepermission` VALUES (5, 3, 5, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `rolepermission` VALUES (6, 4, 6, b'0', 'apollo', '2020-08-26 08:53:31', 'apollo', '2020-08-26 08:53:31'); INSERT INTO `rolepermission` VALUES (7, 5, 7, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (8, 5, 8, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (9, 5, 9, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (10, 6, 10, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (11, 7, 11, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (12, 8, 12, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (13, 9, 13, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (14, 10, 14, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `rolepermission` VALUES (15, 11, 15, b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `rolepermission` VALUES (16, 12, 16, b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `rolepermission` VALUES (17, 13, 17, b'0', 'apollo', '2020-08-26 10:04:58', 'apollo', '2020-08-26 10:04:58'); INSERT INTO `rolepermission` VALUES (18, 14, 18, b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `rolepermission` VALUES (19, 15, 19, b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `rolepermission` VALUES (20, 16, 20, b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `rolepermission` VALUES (21, 17, 21, b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `rolepermission` VALUES (22, 18, 22, b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '配置项Key', `Value` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '配置项值', `Comment` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_Key`(`Key`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '配置服务自身配置' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of serverconfig -- ---------------------------- INSERT INTO `serverconfig` VALUES (1, 'apollo.portal.envs', 'dev,pro', '可支持的环境列表', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:18:30'); INSERT INTO `serverconfig` VALUES (2, 'organizations', '[{\"orgId\":\"TEST1\",\"orgName\":\"应用平台部\"},{\"orgId\":\"TEST2\",\"orgName\":\"零售企金\"}]', '部门列表', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:24:31'); INSERT INTO `serverconfig` VALUES (3, 'superAdmin', 'apollo', 'Portal超级管理员', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `serverconfig` VALUES (4, 'api.readTimeout', '10000', 'http接口read timeout', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `serverconfig` VALUES (5, 'consumer.token.salt', 'someSalt', 'consumer token salt', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `serverconfig` VALUES (6, 'admin.createPrivateNamespace.switch', 'true', '是否允许项目管理员创建私有namespace', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `serverconfig` VALUES (7, 'configView.memberOnly.envs', 'dev,pro', '只对项目成员显示配置信息的环境列表,多个env以英文逗号分隔', b'0', 'default', '2020-08-26 14:09:38', '', '2020-08-26 14:18:39'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_RoleId`(`RoleId`) USING BTREE, INDEX `IX_UserId_RoleId`(`UserId`, `RoleId`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户和role的绑定表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of userrole -- ---------------------------- INSERT INTO `userrole` VALUES (1, 'apollo', 1, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `userrole` VALUES (2, 'apollo', 2, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `userrole` VALUES (3, 'apollo', 3, b'0', '', '2020-08-26 14:09:38', '', '2020-08-26 14:09:38'); INSERT INTO `userrole` VALUES (4, 'apollo', 5, b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); INSERT INTO `userrole` VALUES (5, 'apollo', 7, b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `userrole` VALUES (6, 'apollo', 8, b'0', 'apollo', '2020-08-26 09:20:49', 'apollo', '2020-08-26 09:20:49'); INSERT INTO `userrole` VALUES (7, 'apollo', 13, b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `userrole` VALUES (8, 'apollo', 14, b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '用户名', `Password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '密码', `Email` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '邮箱地址', `Enabled` tinyint(4) DEFAULT NULL COMMENT '是否有效', PRIMARY KEY (`Id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of users -- ---------------------------- INSERT INTO `users` VALUES (1, 'apollo', '$2a$10$7r20uS.BQ9uBpf3Baj3uQOZvMVvB1RN3PYoKE94gtz2.WAOuiiwXS', 'apollo@acme.com', 1); SET FOREIGN_KEY_CHECKS = 1;
接下来就是修改startup.sh,在里面记得修改下日志和端口的信息,portal默认访问的端口是8070,默认的登录用户是apollo,密码是admin
接下来我们来看dev环境下configserver和adminserver的配置,apollo每一套环境需要连接一个数据库,这里连接的数据库为apolloconfigdb-dev
我们原理同上我们来看下apollo-configservice-1.7.1-dev的配置
apollo-configservice.conf
MODE=service PID_FOLDER=. LOG_FOLDER=H:\apollo-1.7.1-all\apollo-configservice-1.7.1-dev\logs\100003171
app.properties
appId=100003171 jdkVersion=1.8
application-github.properties
# DataSource spring.datasource.url = jdbc:mysql://127.0.0.1:3306/apolloconfigdb-dev?characterEncoding=utf8&serverTimezone=UTC spring.datasource.username = root spring.datasource.password = 123456
startup.sh
接下来我们来看看apollo-adminservice-1.7.1-dev的配置
apollo-adminservice.conf
MODE=service PID_FOLDER=. LOG_FOLDER=H:\apollo-1.7.1-all\apollo-adminservice-1.7.1-dev\logs\100003172
app.properties
appId=100003172 jdkVersion=1.8
application-github.properties
# DataSource spring.datasource.url = jdbc:mysql://127.0.0.1:3306/apolloconfigdb-dev?characterEncoding=utf8&serverTimezone=UTC spring.datasource.username = root spring.datasource.password = 123456
对应的启动脚本为
接下来也在最为重要的我们需要对数据库apolloconfigdb-dev中的配置进行修改,我们知道一个dev环境下面的configserver和adminserver我们可以部署多个,configserver和adminserver节点需要注册到注册中心上面,配置中心meta-server 、Eureka服务器、configserver三个组件默认在同一个jvm进程中启动,所有dev环境下默认的注册中心服务器的地址就是configserver进程的地址,这里就是127.0.0.1:18081
注册中心的地址我们需要在apolloconfigdb-dev库中的serverConfig中进行配置
meta-server 、Eureka服务器、configserver三个组件默认在同一个jvm进程中启动,当我们启动config server进程的时候,实际上这个进程也是一个Eureka的注册中心,我们可以输入config server的地址我们来查看下:http://localhost:8081/,我们可以看到当前dev环境下部署了多少configserver和adminserver的节点
整个apolloconfigdb-dev的脚本如下
/* Navicat Premium Data Transfer Source Server : apollo Source Server Type : MySQL Source Server Version : 50718 Source Host : localhost:3306 Source Schema : apolloconfigdb-dev Target Server Type : MySQL Target Server Version : 50718 File Encoding : 65001 Date: 26/08/2020 18:49:14 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for accesskey -- ---------------------------- DROP TABLE IF EXISTS `accesskey`; CREATE TABLE `accesskey` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键', `AppId` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `Secret` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Secret', `IsEnabled` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: enabled, 0: disabled', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `AppId`(`AppId`(191)) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '访问密钥' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for app -- ---------------------------- DROP TABLE IF EXISTS `app`; CREATE TABLE `app` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', `AppId` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `Name` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '应用名', `OrgId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '部门Id', `OrgName` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '部门名字', `OwnerName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ownerName', `OwnerEmail` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `AppId`(`AppId`(191)) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_Name`(`Name`(191)) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of app -- ---------------------------- INSERT INTO `app` VALUES (1, 'SampleApp', 'Sample App', 'TEST1', '样例部门1', 'apollo', 'apollo@acme.com', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); INSERT INTO `app` VALUES (2, 'dianshangxitongpeiz', '电商系统配置', 'TEST1', '应用平台部', 'apollo', 'apollo@acme.com', b'0', 'apollo', '2020-08-26 09:20:48', 'apollo', '2020-08-26 09:20:48'); -- ---------------------------- -- Table structure for appnamespace -- ---------------------------- DROP TABLE IF EXISTS `appnamespace`; CREATE TABLE `appnamespace` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一', `AppId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'app id', `Format` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型', `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共', `Comment` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_AppId`(`AppId`) USING BTREE, INDEX `Name_AppId`(`Name`, `AppId`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用namespace定义' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appnamespace -- ---------------------------- INSERT INTO `appnamespace` VALUES (1, 'application', 'SampleApp', 'properties', b'0', 'default app namespace', b'0', '', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); INSERT INTO `appnamespace` VALUES (2, 'application', 'dianshangxitongpeiz', 'properties', b'0', 'default app namespace', b'0', 'apollo', '2020-08-26 09:20:50', 'apollo', '2020-08-26 09:20:50'); INSERT INTO `appnamespace` VALUES (3, 'juo', 'dianshangxitongpeiz', 'properties', b'1', '', b'0', 'apollo', '2020-08-26 10:04:58', 'apollo', '2020-08-26 10:04:58'); -- ---------------------------- -- Table structure for audit -- ---------------------------- DROP TABLE IF EXISTS `audit`; CREATE TABLE `audit` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', `EntityName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '表名', `EntityId` int(10) UNSIGNED DEFAULT NULL COMMENT '记录ID', `OpName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '操作类型', `Comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '日志审计表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of audit -- ---------------------------- INSERT INTO `audit` VALUES (1, 'App', 2, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 09:20:50', NULL, '2020-08-26 09:20:50'); INSERT INTO `audit` VALUES (2, 'AppNamespace', 2, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 09:20:50', NULL, '2020-08-26 09:20:50'); INSERT INTO `audit` VALUES (3, 'Cluster', 2, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 09:20:50', NULL, '2020-08-26 09:20:50'); INSERT INTO `audit` VALUES (4, 'Namespace', 2, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 09:20:50', NULL, '2020-08-26 09:20:50'); INSERT INTO `audit` VALUES (5, 'Cluster', 3, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 09:21:59', NULL, '2020-08-26 09:21:59'); INSERT INTO `audit` VALUES (6, 'Namespace', 3, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 09:21:59', NULL, '2020-08-26 09:21:59'); INSERT INTO `audit` VALUES (7, 'Namespace', 4, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 10:04:59', NULL, '2020-08-26 10:04:59'); INSERT INTO `audit` VALUES (8, 'Namespace', 5, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 10:04:59', NULL, '2020-08-26 10:04:59'); INSERT INTO `audit` VALUES (9, 'AppNamespace', 3, 'INSERT', NULL, b'0', 'apollo', '2020-08-26 10:04:59', NULL, '2020-08-26 10:04:59'); -- ---------------------------- -- Table structure for cluster -- ---------------------------- DROP TABLE IF EXISTS `cluster`; CREATE TABLE `cluster` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '集群名字', `AppId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_AppId_Name`(`AppId`, `Name`) USING BTREE, INDEX `IX_ParentClusterId`(`ParentClusterId`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '集群' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of cluster -- ---------------------------- INSERT INTO `cluster` VALUES (1, 'default', 'SampleApp', 0, b'0', '', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); INSERT INTO `cluster` VALUES (2, 'default', 'dianshangxitongpeiz', 0, b'0', 'apollo', '2020-08-26 09:20:50', 'apollo', '2020-08-26 09:20:50'); INSERT INTO `cluster` VALUES (3, 'jiqun1', 'dianshangxitongpeiz', 0, b'0', 'apollo', '2020-08-26 09:21:59', 'apollo', '2020-08-26 09:21:59'); -- ---------------------------- -- Table structure for commit -- ---------------------------- DROP TABLE IF EXISTS `commit`; CREATE TABLE `commit` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', `ChangeSets` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '修改变更集', `AppId` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `Comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `AppId`(`AppId`(191)) USING BTREE, INDEX `ClusterName`(`ClusterName`(191)) USING BTREE, INDEX `NamespaceName`(`NamespaceName`(191)) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'commit 历史表' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for grayreleaserule -- ---------------------------- DROP TABLE IF EXISTS `grayreleaserule`; CREATE TABLE `grayreleaserule` ( `Id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', `AppId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', `NamespaceName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', `BranchName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'branch name', `Rules` varchar(16000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_Namespace`(`AppId`, `ClusterName`, `NamespaceName`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '灰度规则表' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `DataCenter` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Data Center Name', `Ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'instance ip', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_UNIQUE_KEY`(`AppId`, `ClusterName`, `Ip`, `DataCenter`) USING BTREE, INDEX `IX_IP`(`Ip`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '使用配置的应用实例' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Config App Id', `ConfigClusterName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name', `ConfigNamespaceName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name', `ReleaseKey` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '发布的Key', `ReleaseDeliveryTime` timestamp(0) DEFAULT NULL COMMENT '配置获取时间', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_UNIQUE_KEY`(`InstanceId`, `ConfigAppId`, `ConfigNamespaceName`) USING BTREE, INDEX `IX_ReleaseKey`(`ReleaseKey`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_Valid_Namespace`(`ConfigAppId`, `ConfigClusterName`, `ConfigNamespaceName`, `DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用实例的配置信息' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '配置项Key', `Value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '配置项值', `Comment` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_GroupId`(`NamespaceId`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '配置项目' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of item -- ---------------------------- INSERT INTO `item` VALUES (1, 1, 'timeout', '100', 'sample timeout配置', 1, b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); -- ---------------------------- -- Table structure for namespace -- ---------------------------- DROP TABLE IF EXISTS `namespace`; CREATE TABLE `namespace` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键', `AppId` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', `NamespaceName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `AppId_ClusterName_NamespaceName`(`AppId`(191), `ClusterName`(191), `NamespaceName`(191)) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_NamespaceName`(`NamespaceName`(191)) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '命名空间' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of namespace -- ---------------------------- INSERT INTO `namespace` VALUES (1, 'SampleApp', 'default', 'application', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); INSERT INTO `namespace` VALUES (2, 'dianshangxitongpeiz', 'default', 'application', b'0', 'apollo', '2020-08-26 09:20:50', 'apollo', '2020-08-26 09:20:50'); INSERT INTO `namespace` VALUES (3, 'dianshangxitongpeiz', 'jiqun1', 'application', b'0', 'apollo', '2020-08-26 09:21:59', 'apollo', '2020-08-26 09:21:59'); INSERT INTO `namespace` VALUES (4, 'dianshangxitongpeiz', 'default', 'juo', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); INSERT INTO `namespace` VALUES (5, 'dianshangxitongpeiz', 'jiqun1', 'juo', b'0', 'apollo', '2020-08-26 10:04:59', 'apollo', '2020-08-26 10:04:59'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'default' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', `IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除', PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_NamespaceId`(`NamespaceId`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'namespace的编辑锁' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for release -- ---------------------------- DROP TABLE IF EXISTS `release`; CREATE TABLE `release` ( `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键', `ReleaseKey` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '发布的Key', `Name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '发布名字', `Comment` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发布说明', `AppId` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `Configurations` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `AppId_ClusterName_GroupName`(`AppId`(191), `ClusterName`(191), `NamespaceName`(191)) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_ReleaseKey`(`ReleaseKey`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '发布' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of release -- ---------------------------- INSERT INTO `release` VALUES (1, '20161009155425-d3a0749c6e20bc15', '20161009155424-release', 'Sample发布', 'SampleApp', 'default', 'application', '{\"timeout\":\"100\"}', b'0', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `BranchName` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '发布上下文信息', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_Namespace`(`AppId`, `ClusterName`, `NamespaceName`, `BranchName`) USING BTREE, INDEX `IX_ReleaseId`(`ReleaseId`) USING BTREE, INDEX `IX_DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '发布历史' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of releasehistory -- ---------------------------- INSERT INTO `releasehistory` VALUES (1, 'SampleApp', 'default', 'application', 'default', 1, 0, 0, '{}', b'0', 'apollo', '2020-08-26 14:14:17', 'apollo', '2020-08-26 14:14:17'); -- ---------------------------- -- Table structure for releasemessage -- ---------------------------- DROP TABLE IF EXISTS `releasemessage`; CREATE TABLE `releasemessage` ( `Id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Message` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '发布的消息内容', `DataChange_LastTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE, INDEX `IX_Message`(`Message`(191)) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '发布消息' ROW_FORMAT = Dynamic; -- ---------------------------- -- 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '配置项Key', `Cluster` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default为不针对特定的集群', `Value` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '配置项值', `Comment` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp(0) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间', PRIMARY KEY (`Id`) USING BTREE, INDEX `IX_Key`(`Key`) USING BTREE, INDEX `DataChange_LastTime`(`DataChange_LastTime`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '配置服务自身配置' ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of serverconfig -- ---------------------------- INSERT INTO `serverconfig` VALUES (1, 'eureka.service.url', 'default', 'http://127.0.0.1:8081/eureka/', 'Eureka服务Url,多个service以英文逗号分隔', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 17:12:12'); INSERT INTO `serverconfig` VALUES (2, 'namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); INSERT INTO `serverconfig` VALUES (3, 'item.value.length.limit', 'default', '20000', 'item value最大长度限制', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); INSERT INTO `serverconfig` VALUES (4, 'config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); INSERT INTO `serverconfig` VALUES (5, 'item.key.length.limit', 'default', '128', 'item key 最大长度限制', b'0', 'default', '2020-08-26 14:14:17', '', '2020-08-26 14:14:17'); SET FOREIGN_KEY_CHECKS = 1;
接下来我们来看pro环境下configserver和adminserver的配置,apollo每一套环境需要连接一个数据库,这里连接的数据库为apolloconfigdb-pro,这里因为在一台机器上面要启动多个configserver和adminserver,一定要保证startup.sh中启动脚本端口的唯一性,pro中configserver端口修改为18082.adminserver的端口修改为8093,此外,pro中configserver中的app.properties指定应用的id为了避免和dev环境的有冲突,这里也进行了修改,我们来看具体的配置
apollo-configservice-1.7.1-pro
apollo-configservice.conf
MODE=service PID_FOLDER=. LOG_FOLDER=H:\apollo-1.7.1-all\apollo-configservice-1.7.1-pro\logs\100003175
app.properties
appId=100003175 jdkVersion=1.8
application-github.properties
# DataSource spring.datasource.url = jdbc:mysql://127.0.0.1:3306/apolloconfigdb-pro?characterEncoding=utf8&serverTimezone=UTC spring.datasource.username = root spring.datasource.password = 123456
启动脚本为
接下来我们来看apollo-adminservice-1.7.1-pro
apollo-adminservice.conf
MODE=service PID_FOLDER=. LOG_FOLDER=H:\apollo-1.7.1-all\apollo-adminservice-1.7.1-pro\logs\100003176
app.properties
appId=100003176 jdkVersion=1.8
application-github.properties
# DataSource spring.datasource.url = jdbc:mysql://127.0.0.1:3306/apolloconfigdb-pro?characterEncoding=utf8&serverTimezone=UTC spring.datasource.username = root spring.datasource.password = 123456
启动脚本为
接下来也在最为重要的我们需要对数据库apolloconfigdb-pro中的配置进行修改,我们知道一个pro环境下面的configserver和adminserver我们可以部署多个,configserver和adminserver节点需要注册到注册中心上面,配置中心meta-server 、Eureka服务器、configserver三个组件默认在同一个jvm进程中启动,所有pro环境下默认的注册中心服务器的地址就是configserver进程的地址,这里就是127.0.0.1:18082
注册中心的地址我们需要在apolloconfigdb-pro库中的serverConfig中进行配置
接下来就是项目的创建了
接下来就是授权,点击授权能够让某人具有配置的修改和发布权限
通过添加namespace管理其他应用的配置
接下来是灰度发布的流程:
apollo客户端的
客户端的使用需要添加下面的依赖
实例列表可以看到哪些实例在读取这些配置
posted on 2020-08-26 14:09 luzhouxiaoshuai 阅读(1157) 评论(0) 编辑 收藏 举报