CREATE TABLE `gray` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`project` varchar(45) NOT NULL,
`shopId` text,
`status` tinyint(1) unsigned NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
INSERT INTO `cpx_prod`.`gray` (`id`, `project`, `shopId`, `status`, `created_at`, `updated_at`) VALUES ('2', 'kufang', '1804', '1', '2018-05-28 17:04:25', '2018-05-28 17:04:25');
灰度开发方案
- 设计灰度表结构和存储位置
- 设计redis键,选择灰度发布使用的redis服务器
- 在ops平台上开发店铺灰度灰度状态管理页面
- 使用ops现有的指定发布功能发布灰度代码
- nginx lua根据店铺的灰度状态走不同的项目路径
灰度缓存更新
- ops灰度系统设置了店铺灰度后更新灰度缓存
- lua检测到redis里没有缓存key,从mysql中读取店铺灰度数据,缓存到redis中,redis使用一个key保存所有灰度店铺的id,使用json序列化
灰度代码发布
- 灰度代码发布复用ops上的指定发布