Skip to content

Commit

Permalink
cc v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shichen committed Apr 22, 2021
1 parent 9b020b8 commit 20913a5
Show file tree
Hide file tree
Showing 175 changed files with 5,694 additions and 1,761 deletions.
28 changes: 14 additions & 14 deletions README.md
Expand Up @@ -8,27 +8,27 @@
* [七、图书分享](#cc7)
* [八、支持与帮助](#cc8)

<a name="cc1"/>
<a name="cc1"/>

## 一、CacheCloud是什么

CacheCloud是一个Redis云管理平台:支持Redis多种架构(Standalone、Sentinel、Cluster)高效管理、有效降低大规模redis运维成本,提升资源管控能力和利用率。平台提供快速搭建/迁移,运维管理,弹性伸缩,统计监控,客户端整合接入等功能。
CacheCloud是一个Redis云管理平台:支持Redis多种架构(Standalone、Sentinel、Cluster)高效管理、有效降低大规模redis运维成本,提升资源管控能力和利用率。平台提供快速搭建/迁移,运维管理,弹性伸缩,统计监控,客户端整合接入等功能。

![cachecloud云平台](cachecloud-web/src/main/resources/static/img/readme/cachecloud.png)

<a name="cc2"/>
<a name="cc2"/>

## 二、CacheCloud功能架构

+ Redis搭建:环境初始化、实例部署安装、类型架构支持;
+ 客户端接入:Java-SDK接入、客户端监控、其他语言接入;
+ 运维管理:宿主环境、资源管理、应用审计、应用运维、应用质量监控、应用拓扑诊断;
+ 弹性伸缩:资源评估、垂直伸缩、水平伸缩、外部接入;
+ 统计监控:指标采集、应用统计、节点统计、机器统计、监控报警、问题诊断;
+ 统计监控:指标采集、应用统计、节点统计、机器统计、监控报警、问题诊断;

<img src="cachecloud-web/src/main/resources/static/img/readme/CacheCloud功能架构.png" width="100%"/>

<a name="cc3"/>
<a name="cc3"/>

## 三、CacheCloud使用规模

Expand All @@ -37,34 +37,34 @@ CacheCloud是一个Redis云管理平台:支持Redis多种架构(Standalone、S
+ 300+ app Total / 3000+ Instances Total
+ 200+ Machines Total

<a name="cc4"/>
<a name="cc4"/>

## 四、阿里云ecs试用版本

+ CacheCloud后台地址:[地址](http://47.97.112.178:8080/admin/app/list)
+ 用户名/登录密码:cachecloud_user:cachecloud_user
+ 开源版本试用截止时间:2021-01-18,如果大家有空闲公网资源可以贡献,请[联系我们](#cc8)

<a name="cc5"/>
<a name="cc5"/>

## 五、FAQ快速接入

+ [快速开始](cachecloud-web/src/main/resources/static/wiki/quickstart/index.md)
+ [客户端接入](cachecloud-web/src/main/resources/static/wiki/access/client.md)

<a name="cc6"/>
<a name="cc6"/>

## 六、服务用户

<img src="cachecloud-web/src/main/resources/static/img/readme/user.png" width="60%"/>

<a name="cc7"/>
<a name="cc7"/>

## 七、图书

由CacheCloud团队撰写的实体书《Redis开发与运维》(机械工业出版)已在各大网店售卖,本书包含了CacheCloud团队在Redis规模化开发运维大量经验,以及Cachecloud系统使用介绍。
由CacheCloud团队撰写的实体书《Redis开发与运维》(机械工业出版)已在各大网店售卖,本书包含了CacheCloud团队在Redis规模化开发运维大量经验,以及Cachecloud系统使用介绍。

### 相关样章分享
### 相关样章分享

+ 1.[Redis架构之防雪崩设计](https://mp.weixin.qq.com/s/TBCEwLVAXdsTszRVpXhVug)
+ 2.[Redis的内存优化](https://cachecloud.github.io/2017/02/16/Redis%E5%86%85%E5%AD%98%E4%BC%98%E5%8C%96/)
Expand All @@ -73,17 +73,17 @@ CacheCloud是一个Redis云管理平台:支持Redis多种架构(Standalone、S
+ 5.[Redis热点key寻找与优化](https://cachecloud.github.io/2017/02/20/Redis%E7%83%AD%E7%82%B9key%E5%AF%BB%E6%89%BE%E4%B8%8E%E4%BC%98%E5%8C%96/)
+ 6.[Redis无限全量复制问题分析与优化](https://cachecloud.github.io/2016/11/24/%E5%85%A8%E9%87%8F%E5%A4%8D%E5%88%B6%E9%97%AE%E9%A2%98/)

<a name="cc8"/>
<a name="cc8"/>

## 八、支持与帮助

+ QQ群:534429768
+ Redis开发运维公众号:关注Redis开发运维实战,发布Cachecloud最新动态,帮大家减轻工作负担。
+ Redis开发运维公众号:关注Redis开发运维实战,发布Cachecloud最新动态,帮大家减轻工作负担。

<img src="cachecloud-web/src/main/resources/static/img/readme/subcribe.png" width="40%"/>

+ 微信:如果大家有公网资源可以联系我,会加入到开源版本服务资源部署试用,提高大家的用户体验。


<img src="cachecloud-web/src/main/resources/static/img/readme/wechat.png" width="40%"/>

如果你觉得CacheCloud对你有帮助,欢迎Star。
2 changes: 2 additions & 0 deletions cachecloud-client/cachecloud-client-redis/pom.xml
Expand Up @@ -42,6 +42,8 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>


</dependencies>

<build>
Expand Down
Expand Up @@ -16,8 +16,8 @@ public interface EmailComponent {
* @return
*/
boolean sendMail(String title, String content, List<String> emailList, List<String> ccList);


/**
* 发送邮件
* @param title
Expand All @@ -35,7 +35,7 @@ public interface EmailComponent {
*/
boolean sendMailToAdmin(String title, String content);


/**
* 获取管理员邮件组
* @return
Expand Down
29 changes: 29 additions & 0 deletions cachecloud-web/sql/update2.0-2.1.sql
@@ -0,0 +1,29 @@
create or replace table app_import(
id bigint auto_increment
primary key,
app_id bigint null comment '目标应用id',
instance_info text null comment '源redis实例信息',
redis_password varchar (200) null comment '源redis密码',
status int null comment '迁移状态:PREPARE(0, "准备", "应用导入-未开始"),
START(1, "进行中...", "应用导入-开始"),
ERROR(2, "error", "应用导入-出错"),
VERSION_BUILD_START(11, "进行中...", "新建redis版本-进行中"),
VERSION_BUILD_ERROR(12, "error", "新建redis版本-出错"),
VERSION_BUILD_END(20, "成功", "新建redis版本-完成"),
APP_BUILD_INIT(21, "准备就绪", "新建redis应用-准备就绪"),
APP_BUILD_START(22, "进行中...", "新建redis应用-进行中"),
APP_BUILD_ERROR(23, "error", "新建redis应用-出错"),
APP_BUILD_END(30, "成功", "新建redis应用-完成"),
MIGRATE_INIT(31, "准备就绪", "数据迁移-准备就绪"),
MIGRATE_START(32, "进行中...", "数据迁移-进行中"),
MIGRATE_ERROR(33, "error", "数据迁移-出错"),
MIGRATE_END(3, "成功", "应用导入-成功")',
step int null comment '导入阶段',
create_time timestamp default CURRENT_TIMESTAMP not null,
update_time timestamp default CURRENT_TIMESTAMP null,
migrate_id bigint null comment '数据迁移id',
mem_size int null comment '目标应用内存大小,单位G',
redis_version_name varchar (20) null comment '目标应用redis版本,格式:redis-x.x.x',
app_build_task_id bigint null comment '目标应用部署任务id',
source_type int null comment '源redis类型:7:cluster, 6:sentinel, 5:standalone'
);
Expand Up @@ -145,6 +145,12 @@ public Map<String, Object> getRedisStandaloneInfo(boolean clientRequest) {
if (CollectionUtils.isEmpty(instanceList)) {
instanceList = instanceDao.getInstListByAppId(appId);
}
String shardsInfo = ObjectConvert.assembleInstance(instanceList);
if (StringUtils.isBlank(shardsInfo)) {
model.put("status", ClientStatusEnum.ERROR.getStatus());
model.put("message", "ERROR: appId:" + appId + "shardsInfo为空 ");
return model;
}
String standalone = null;
for (InstanceInfo instanceInfo : instanceList) {
if (instanceInfo.isOffline()) {
Expand Down Expand Up @@ -175,6 +181,12 @@ public Map<String, Object> getRedisSentinelInfo(boolean clientRequest) {
model.put("message", "appId: " + appId + " 实例集合为空 ");
return model;
}
String shardsInfo = ObjectConvert.assembleInstance(instanceList);
if (StringUtils.isBlank(shardsInfo)) {
model.put("status", ClientStatusEnum.ERROR.getStatus());
model.put("message", "ERROR: appId:" + appId + "shardsInfo为空 ");
return model;
}
String masterName = null;
List<String> sentinelList = new ArrayList<String>();
for (InstanceInfo instance : instanceList) {
Expand Down
@@ -0,0 +1,21 @@
package com.sohu.cache.configuration;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ForkJoinPool;

@Configuration
@Slf4j
public class AsyncConfiguration {

private int parallelism=256;

@Bean
public ForkJoinPool forkJoinPool() {
log.info("availableProcessors:{}, parallelism:{}", Runtime.getRuntime().availableProcessors(), parallelism);
ForkJoinPool forkJoinPool = new ForkJoinPool(parallelism);
return forkJoinPool;
}
}
Expand Up @@ -9,17 +9,19 @@
public enum AppAuditType {
APP_AUDIT(0, "申请集群"),
APP_SCALE(1, "集群容量变更"),
APP_MODIFY_CONFIG(2,"集群修改配置"),
APP_MODIFY_CONFIG(2, "集群修改配置"),
REGISTER_USER_APPLY(3, "用户注册"),
INSTANCE_MODIFY_CONFIG(4, "实例修改配置"),
APP_MONITOR_CONFIG(5,"全局报警配置修改"),
APP_MONITOR_CONFIG(5, "全局报警配置修改"),
KEY_ANALYSIS(6, "键值分析"),
FLUSHALL_DATA(7, "清理数据"),
APP_DIAGNOSTIC(8,"应用诊断"),
APP_DIAGNOSTIC(8, "应用诊断"),
APP_OFFLINE(10, "应用下线"),
APP_MIGRATE(11,"应用数据迁移");
APP_MIGRATE(11, "应用数据迁移"),
APP_IMPORT(12, "应用导入");

private final static Map<Integer, AppAuditType> MAP = new HashMap<Integer, AppAuditType>();

static {
for (AppAuditType appAuditType : AppAuditType.values()) {
MAP.put(appAuditType.getValue(), appAuditType);
Expand Down
Expand Up @@ -81,4 +81,35 @@ public String getInfo() {

}

public static enum MachineEnum {
HOST("host"),
CONTAINER("container");

private String value;

MachineEnum(String value) {
this.value = value;
}

public String getValue() {
return value;
}
}

public static enum MachineTypeEnum {
HOST(1),
CONTAINER(2),
ALL(3);

private int value;

MachineTypeEnum(int value) {
this.value = value;
}

public int getValue() {
return value;
}
}

}
Expand Up @@ -20,6 +20,8 @@ public interface AppDataMigrateStatusDao {

AppDataMigrateStatus get(@Param("id") long id);

AppDataMigrateStatus getByMigrateId(@Param("migrateId") long migrateId);

int updateStatus(@Param("id") long id, @Param("status") int status);

int getMigrateTaskCount(@Param("appDataMigrateSearch") AppDataMigrateSearch appDataMigrateSearch);
Expand Down
21 changes: 21 additions & 0 deletions cachecloud-web/src/main/java/com/sohu/cache/dao/AppImportDao.java
@@ -0,0 +1,21 @@
package com.sohu.cache.dao;


import com.sohu.cache.entity.AppImport;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @Author: rucao
* @Date: 2021/1/7 下午6:03
*/
public interface AppImportDao {
AppImport get(@Param("id") Long id);

int save(AppImport appImport);

int update(AppImport appImport);

List<AppImport> getAppImports(@Param("status") int status);
}
Expand Up @@ -10,6 +10,10 @@
*/
@Data
public class AppDataMigrateSearch {
/**
* 迁移id
*/
private Long migrateId;
/**
* 源应用id
*/
Expand Down
26 changes: 26 additions & 0 deletions cachecloud-web/src/main/java/com/sohu/cache/entity/AppImport.java
@@ -0,0 +1,26 @@
package com.sohu.cache.entity;

import lombok.Data;

import java.util.Date;

/**
* @Author: rucao
* @Date: 2021/1/7 下午6:00
*/
@Data
public class AppImport {
private long id;
private long appId;
private int memSize;
private int sourceType;
private String redisVersionName;
private String instanceInfo;
private String redisPassword;
private int status;
private int step;
private long appBuildTaskId;
private long migrateId;
private Date createTime;
private Date updateTime;
}
Expand Up @@ -4,8 +4,12 @@
import com.sohu.cache.util.ConstUtils;
import com.sohu.cache.web.enums.BooleanEnum;
import lombok.Data;
import redis.clients.jedis.Module;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
* 实例信息
* User: lingguo
Expand Down Expand Up @@ -57,6 +61,9 @@ public class InstanceInfo implements Serializable {
private String roleDesc;
private int groupId;
private Date updateTime;

private List<Module> modules;

public String getTypeDesc() {
if (type <= 0) {
typeDesc = "";
Expand Down
Expand Up @@ -51,6 +51,10 @@ public class MachineStats{

private MachineMemInfo machineMemInfo;

private Map<String,Object> moduleInfo;

private String versionInfo;

private Map<String/**挂载点*/, String/**使用百分比*/> diskUsageMap;

/**
Expand Down

0 comments on commit 20913a5

Please sign in to comment.