# mall **Repository Path**: jack_whl/mall ## Basic Information - **Project Name**: mall - **Description**: SpringCloud Alibaba & SpringBoot & Redis双写一致性 & MyCat 分库,独立库 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2020-04-28 - **Last Updated**: 2021-08-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mall #### 介绍 springboot alibaba #### 软件架构 软件架构说明 1. Spring Alibaba Cloud & Springboot & nacos & sentinel & seata 2. Redis缓存Mysql数据双写一致性代码实现 3. 后期则加入Mycat 分库,拆分独立库 #### 安装教程 1. 下载 mall-nacos,解压后启动(windows直接start.cmd启动,linux则start.sh启动),nacos既是注册中心也是配置中心。 启动nacos后打开 http://localhost:8848/nacos 用户名为 nacos 密码为 nacos 。 进入后则新建命名空间,命名空间产生的ID则是 bootstrap.yml 中的 namespace,新建配置的时候也可以新建组, 则对应 bootstrap.yml 中的 group。 然后可以进行各项服务的统一配置和获取。可以用命名空间和组区分生产和测试和开发环境。 2. 下载 sentinel https://github.com/alibaba/Sentinel/releases/download/1.7.2/sentinel-dashboard-1.7.2.jar 黏贴到迅雷比 较快。 启动条件 8080 不能占用,jdk8 启动 java -jar sentinel-dashboard-1.7.2.jar 访问地址 http://localhost:8080 用户名密码 sentinel sentinel \ \org.springframework.cloud\ \spring-cloud-starter-alibaba-sentinel\ \>2.1.1.RELEASE\> \ sentinel: transport: dashboard: localhost:8080 port: 8719 sentinel 持久化 boostrap.yml 配置 sentinel: > transport: >>dashboard: localhost:8080 port: 8719 >>>datasource: >>>>ds1: >>>>>nacos: >>>>>>server-addr: localhost:8848 dataId: mall-order-provider groupId: DEFAULT_GROUP data-type: json rule-type: flow nacos配置: dataID 和 Group 和 boostrap.yml 的对应一致 [ { "resource":"", "limitApp":"default", "grade":1, "count":1, "strategy":0, "controlBehavior":0, "clusterMode":false } ] resource: 资源名称 limitApp: 来源应用 grade: 阈值类型 0线程数 1QPS count: 单机阈值 strategy: 流控模式 0表示直接 1表示关联 2表示链路 controlBehavior: 流控效果,0表示快速失败 1表示 warm up 2 表示排队等待 clusterMode: 是否集群 项目启动好进入sentinel则有流控规则。 3. Seata: Seata 是一款开源的分布式事务解决方案,致力于提供高性能和简单易用的分布式事务服务。 Seata 将为用户提供了 AT、TCC、SAGA 和 XA 事务模式,为用户打造一站式的分布式解决方案。 详见 http://seata.io/zh-cn/ 下载 seata 解压后修改conf下的两个文件:file.conf 和 registry.conf file.conf 修改 service中的 vgroup_mapping 和 store 改成db,然后填写数据库信息。 registry.conf 修改 nacos 地址 修改项目 boostrap.yml 将 file.conf group 配置到yml中 . 然后将 file.conf 和 registry.conf 分别放置 resources 目录下 创建 数据库 seata 将 store.sql 运行,在业务数据库则 运行db_undo_log.sql 4. mall-mycat 是mycat的工具,xml配置容易出错,可以添加schema db datanode 等等。 java -jar mall-mycat-web-1.0-SNAPSHOT.jar --spring.profiles.active=prod & 5. 相关下载 https://pan.baidu.com/s/1M_dTXQAyGWSR9s25NpCwoA bjuq #### 使用说明 1. 运行nacos 2. 运行seata 3. 运行sentinel(可选) 4. 运行项目 #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)