资讯详情

2022/6/18 Spring Cloud Alibaba入门(基础环境准备)

1丶Spring Cloud Alibaba简介

2丶Spring Cloud Netflix

2.维护模式是什么?

2.2丶替代品

3丶Spring Cloud Alibaba介绍

3.1丶主要功能

3.2丶组件

3.三、版本管理规范

3.4.毕业版依赖关系(推荐使用)

3.4.1丶2021.x 分支

3.4.2丶2.2.x 分支

3.4.三、组件版本关系

4丶基础环境准备

4.1丶Dokcer-compose安装

4.2丶Dokcer-compose常用命令

4.3丶容器化

4.3.1丶安装 Nacos

4.3.2丶MySQL

4.3.3丶Nacos

4.3.4丶Sentinel

4.3.5丶Seata

4.3.6丶docker-compose

5丶环境验证

5.1丶nacos

5.2丶sentinel


1丶Spring Cloud Alibaba简介

Spring Cloud Alibaba 致力于。此项目包含开发分布式应用微服务的必需组件,方便开发者通过 Spring Cloud 编程模型轻松使用这些组件来开发分布式应用服务。

依托 Spring Cloud Alibaba,您只需要添加一些注解和少量配置,就可以将 Spring Cloud 应用接入阿里微服务解决方案,通过阿里中间件来迅速搭建分布式应用系统。

2丶Spring Cloud Netflix

Spring Cloud 为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智能路由,微代理,控制总线)。分布式系统的协调导致了样板模式, 使用 Spring Cloud 开发人员可以快速地支持实现这些模式的服务和应用程序。他们将在任何分布式环境中运行良好,包括开发人员自己的笔记本电脑,裸机数据中心,以及 Cloud Foundry 等托管平台。

【官方新闻】Spring Cloud Greenwich.RC1 available now

将模块置于维护模式,意味着 Spring Cloud 团队将不会再向模块添加新功能。我们将修复 block 级别的 bug 以及安全问题,我们也会考虑并审查社区的小型 pull request

        2.2丶替代品

我们建议对这些模块提供的功能进行以下替换:

Spring Cloud for Alibaba 0.2.0 released

The Spring Cloud Alibaba project, consisting of Alibaba’s open-source components and several Alibaba Cloud products, aims to implement and expose well known Spring Framework patterns and abstractions to bring the benefits of Spring Boot and Spring Cloud to Java developers using Alibaba products.

Spring Cloud for Alibaba,它是由一些阿里巴巴的开源组件和云产品组成的。这个项目的目的是为了让大家所熟知的 Spring 框架,其优秀的设计模式和抽象理念,以给使用阿里巴巴产品的 Java 开发者带来使用 Spring Boot 和 Spring Cloud 的更多便利。

 3丶Spring Cloud Alibaba介绍

        github地址

        3.1丶主要功能

  • :默认支持 WebServlet、WebFlux、OpenFeign、RestTemplate、Spring Cloud Gateway、Zuul、Dubbo 和 RocketMQ 限流降级功能的接入,可以在运行时通过控制台实时修改限流降级规则,还支持查看限流降级 Metrics 监控。
  • :适配 Spring Cloud 服务注册与发现标准,默认集成了 Ribbon 的支持。
  • :支持分布式系统中的外部化配置,配置更改时自动刷新。
  • :基于 Spring Cloud Stream 为微服务应用构建消息驱动能力。
  • :使用 @GlobalTransactional 注解, 高效并且对业务零侵入地解决分布式事务问题。
  • :阿里云提供的海量、安全、低成本、高可靠的云存储服务。支持在任何应用、任何时间、任何地点存储和访问任意类型的数据。
  • :提供秒级、精准、高可靠、高可用的定时(基于 Cron 表达式)任务调度服务。同时提供分布式的任务执行模型,如网格任务。网格任务支持海量子任务均匀分配到所有 Worker(schedulerx-client)上执行。
  • :覆盖全球的短信服务,友好、高效、智能的互联化通讯能力,帮助企业迅速搭建客户触达通道。

        3.2丶组件

版本管理规范

项目的版本号格式为 x.x.x 的形式,其中 x 的数值类型为数字,从 0 开始取值,且不限于 0~9 这个范围。项目处于孵化器阶段时,第一位版本号固定使用 0,即版本号为 0.x.x 的格式。

由于 Spring Boot 1 和 Spring Boot 2 在 Actuator 模块的接口和注解有很大的变更,且spring-cloud-commons 从 1.x.x 版本升级到 2.0.0 版本也有较大的变更,因此我们采取跟 SpringBoot 版本号一致的版本:

  • 1.5.x 版本适用于 Spring Boot 1.5.x
  • 2.0.x 版本适用于 Spring Boot 2.0.x
  • 2.1.x 版本适用于 Spring Boot 2.1.x
  • 2.2.x 版本适用于 Spring Boot 2.2.x
  • 2021.x 版本适用于 Spring Boot 2.4.x

毕业版本依赖关系(推荐使用)

版本说明 · alibaba/spring-cloud-alibaba Wiki · GitHub

由于 Spring Boot 2.4 以上和一下版本变化较大,目前企业级客户老项目相关 Spring Boot 版本仍停留在 Spring Boot 2.4 以下,为了同时满足存量用户和新用户不同需求,社区以 Spring Boot 2.4 为分界线,同时维护 2.2.x 和 2021.x 两个分支迭代。

                3.4.1丶2021.x 分支

适配 Spring Boot 2.4, Spring Cloud 2021.x 版本及以上的 Spring Cloud Alibaba 版本如下表(最新版本用*标记): (注意,该分支 Spring Cloud Alibaba 版本命名方式进行了调整, 未来将对应 Spring Cloud 版本, 前三位为 Spring Cloud 版本,最后一位为扩展版本,比如适配 Spring Cloud 2021.0.1 版本对应的 Spring Cloud Alibaba 第一个版本为:2021.0.1.0,第个二版本为:2021.0.1.1,依此类推)

Spring Cloud Alibaba Version Spring Cloud Version Spring Boot Version

2021.0.1.0*

Spring Cloud 2021.0.1

2.6.3

                3.4.2丶2.2.x 分支

适配 Spring Boot 为 2.4, Spring Cloud Hoxton 版本及以下的 Spring Cloud Alibaba 版本如下表(最新版本用*标记):

Spring Cloud Alibaba Version Spring Cloud Version Spring Boot Version

2.2.7.RELEASE*

Spring Cloud Hoxton.SR12

2.3.12.RELEASE

2021.1

Spring Cloud 2020.0.1

2.4.2

2.2.6.RELEASE

Spring Cloud Hoxton.SR9

2.3.2.RELEASE

2.1.4.RELEASE

Spring Cloud Greenwich.SR6

2.1.13.RELEASE

2.2.1.RELEASE

Spring Cloud Hoxton.SR3

2.2.5.RELEASE

2.2.0.RELEASE

Spring Cloud Hoxton.RELEASE

2.2.X.RELEASE

2.1.2.RELEASE

Spring Cloud Greenwich

2.1.X.RELEASE

2.0.4.RELEASE(停止维护,建议升级)

Spring Cloud Finchley

2.0.X.RELEASE

1.5.1.RELEASE(停止维护,建议升级)

Spring Cloud Edgware

1.5.X.RELEASE

                3.4.3丶组件版本关系

每个 Spring Cloud Alibaba 版本及其自身所适配的各组件对应版本如下表所示:

 4丶基础环境准备

根据版本说明中的推荐,我们这里选择SpringBoot的版本为2.4.2,SpringCloud Alibaba的版本则为2021.1,组件对应关系如下

  • 注册中心、配置中心 Nacos
  • 限流 Sentinel
  • 分布式事务 Seata
  • 网关 SpringCloud Gateway
  • 认证授权 Spring Cloud Oauth2
  • docker、docker-compose

由于用到的组件相对较多,部署会很繁琐,最关键的是没有资源服务器,所以在开发过程中我会逐渐将一些组件使用docker-compose部署

本篇内容就是使用Dokcer-compose部署Nacos,Sentinel,MySQL,作为后面的文章的基础环境

         4.1丶Dokcer-compose安装

2022/6/15 docker安装与项目部署(入门教程)_Abcdzzr的博客-CSDN博客

# 下载1.25.0 docker compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 添加可执行权限
sudo chmod +x /usr/local/bin/docker-compose
# 测试安装
sudo docker-compose --version
#启动一个容器
docker-compose up -d
#停止容器
docker-compose down

         4.2丶Dokcer-compose常用命令

version: '3.1'
services:
  mysql8:
    image: mysql:8.0.13
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 123456
    command:
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
      --explicit_defaults_for_timestamp=true
      --lower_case_table_names=1
    ports:
      - 3306:3306
    volumes:
      - ./data:/var/lib/mysql

version: '3.1'
services:
  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

version: '3'
services:
    web:
      image: 'twang2218/gitlab-ce-zh'
      restart: always
      hostname: '119.45.140.73'
      environment:
        TZ: 'Asia/Shanghai'
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'http://119.45.140.73:8080'
          gitlab_rails['gitlab_shell_ssh_port'] = 2222
          unicorn['port'] = 8888
          nginx['listen_port'] = 8080
      ports:
        - '8080:8080'
        - '8443:443'
        - '2222:22'
      volumes:
        - ./config:/etc/gitlab
        - ./data:/var/opt/gitlab
        - ./logs:/var/log/gitlab

version: '3.1'
services:
  jenkins:
    restart: always
    image: jenkinsci/jenkins
    container_name: jenkins
    ports:
      - 8080:8080
      - 50000:50000
    environment:
      TZ: Asia/Shanghai
    volumes:
      - data:/var/jenkins_home

volumes:
  data:

version: '3.1'
services:
  tomcat:
    image: tomcat:latest
    restart: always
    ports:
      - 8080:8080

         4.3丶容器化

                4.3.1丶安装 Nacos

docker pull nacos/nacos-server:1.4.1

  • 启动临时容器
docker run --rm --name mysql -e MYSQL_ROOT_PASSWORD=123456 -v /app/cloud/mysql/data:/var/lib/mysql -p 3306:3306 -d mysql:5.7

此处需要挂载宿主机目录,在启动docker-compse后就不需要再次初识化数据。

  • 用mysql客户端连接你的容器,创建数据库(nacos_config)然后导入nacos的数据表

https://github.com/alibaba/nacos/tree/develop/distribution/conf/nacos-mysql.sql:

/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.203.133
 Source Server Type    : MySQL
 Source Server Version : 50736
 Source Host           : 192.168.203.133:3306
 Source Schema         : nacos_config

 Target Server Type    : MySQL
 Target Server Version : 50736
 File Encoding         : 65001

 Date: 04/04/2022 16:42:32
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for config_info
-- ----------------------------
DROP TABLE IF EXISTS `config_info`;
CREATE TABLE `config_info`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
  `group_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
  `md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT 'source user',
  `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip',
  `app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
  `c_desc` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `c_use` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `effect` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `type` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `c_schema` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_configinfo_datagrouptenant`(`data_id`, `group_id`, `tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = 'config_info' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of config_info
-- ----------------------------
INSERT INTO `config_info` VALUES (1, 'itrip-service-orders.yaml', 'orders', 'spring:\n  application:\n    name: itrip-service-orders\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      # 配置控制台\n      transport:\n        dashboard: 192.168.203.130:8858\n      # 消息延时加载设置为false\n      eager: false\n      datasource:\n        ds:\n          nacos:\n            server-addr: 192.168.203.130:8848\n            namespace: cdc378f4-114b-471b-8732-b7d38bcb02ea\n            data-id: itrip-service-orders-sentinel\n            rule-type: flow\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9002\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', 'dc5f493a806a94791af84de50b5833e2', '2022-03-31 09:24:30', '2022-04-01 02:37:47', NULL, '192.168.203.1', '', 'cdc378f4-114b-471b-8732-b7d38bcb02ea', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (2, 'itrip-service-users.yaml', 'users', 'spring:\n  application:\n    name: itrip-service-users\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      datasource:\n        ds:\n          nacos:\n            server-addr: 192.168.203.130:8848\n            data-id: itrip-service-users-sentinel-degrade\n            group-id: DEFAULT_GROUP\n            namespace: faf33017-b8c2-48fa-9b29-09d644006946\n            rule-type: degrade\n      transport:\n        dashboard: 192.168.203.130:8858\n      eager: false\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9001\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', '3e298f3ad9a7e64eae7336a362fb5d36', '2022-03-31 09:25:29', '2022-04-01 03:14:15', NULL, '192.168.203.1', '', 'faf33017-b8c2-48fa-9b29-09d644006946', '用户', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (10, 'itrip-service-orders-sentinel', 'DEFAULT_GROUP', '[\r\n    {\r\n        \"resource\": \"getOrderListByUserId\",\r\n        \"limitApp\": \"default\",\r\n        \"grade\": 1,\r\n        \"count\": 1,\r\n        \"strategy\": 0,\r\n        \"controlBehavior\": 0,\r\n        \"clusterMode\": false\r\n    }\r\n]', '83328c14e75d4a4173eeb10bb4fadf8e', '2022-04-01 02:27:52', '2022-04-01 02:27:52', NULL, '192.168.203.1', '', 'cdc378f4-114b-471b-8732-b7d38bcb02ea', '订单的流控规则持久化配置', NULL, NULL, 'json', NULL);
INSERT INTO `config_info` VALUES (15, 'itrip-service-users-sentinel-degrade', 'DEFAULT_GROUP', '[\r\n    {\r\n    \"resource\": \"/getOrderListByUserId\",\r\n    \"count\": 0.5,\r\n    \"grade\": 1,\r\n    \"passCount\": 0,\r\n    \"timeWindow\": 2\r\n  }\r\n]', '006192ea69dae386bfa1e03916de06b3', '2022-04-01 03:15:52', '2022-04-01 03:15:52', NULL, '192.168.203.1', '', 'faf33017-b8c2-48fa-9b29-09d644006946', '用户调用订单,出现熔断之后的配置', NULL, NULL, 'json', NULL);
INSERT INTO `config_info` VALUES (16, 'itrip-gateway.yaml', 'gateway', 'server:\n  port: 9999\nspring:\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    gateway:\n      discovery:\n        #开启网关拉取nacos的服务\n        locator:\n          enabled: true\n      routes:\n        - id: itrip-service-orders\n          uri: lb://itrip-service-orders\n          predicates:\n            - Path=/orders/**\n          filters:\n            - StripPrefix=1\n        - id: itrip-service-users\n          uri: lb://itrip-service-users\n          predicates:\n            - Path=/users/**\n          filters:\n            - StripPrefix=1\n  application:\n    name: itrip-gateway', '0ad4d3dd795b25e2ad55a748699697eb', '2022-04-02 06:35:45', '2022-04-02 06:40:33', NULL, '192.168.203.1', '', '0cbe8b45-e878-4c59-9ab8-5b8616ac4d57', '网关的配置文件', '', '', 'yaml', '');

-- ----------------------------
-- Table structure for config_info_aggr
-- ----------------------------
DROP TABLE IF EXISTS `config_info_aggr`;
CREATE TABLE `config_info_aggr`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
  `group_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
  `datum_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'datum_id',
  `content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '内容',
  `gmt_modified` datetime(0) NOT NULL COMMENT '修改时间',
  `app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_configinfoaggr_datagrouptenantdatum`(`data_id`, `group_id`, `tenant_id`, `datum_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '增加租户字段' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for config_info_beta
-- ----------------------------
DROP TABLE IF EXISTS `config_info_beta`;
CREATE TABLE `config_info_beta`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
  `app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'app_name',
  `content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
  `beta_ips` varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'betaIps',
  `md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT 'source user',
  `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip',
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_configinfobeta_datagrouptenant`(`data_id`, `group_id`, `tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = 'config_info_beta' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for config_info_tag
-- ----------------------------
DROP TABLE IF EXISTS `config_info_tag`;
CREATE TABLE `config_info_tag`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_id',
  `tag_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'tag_id',
  `app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'app_name',
  `content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
  `md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT 'source user',
  `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_configinfotag_datagrouptenanttag`(`data_id`, `group_id`, `tenant_id`, `tag_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = 'config_info_tag' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for config_tags_relation
-- ----------------------------
DROP TABLE IF EXISTS `config_tags_relation`;
CREATE TABLE `config_tags_relation`  (
  `id` bigint(20) NOT NULL COMMENT 'id',
  `tag_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'tag_name',
  `tag_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'tag_type',
  `data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_id',
  `nid` bigint(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`nid`) USING BTREE,
  UNIQUE INDEX `uk_configtagrelation_configidtag`(`id`, `tag_name`, `tag_type`) USING BTREE,
  INDEX `idx_tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = 'config_tag_relation' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for group_capacity
-- ----------------------------
DROP TABLE IF EXISTS `group_capacity`;
CREATE TABLE `group_capacity`  (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
  `quota` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '配额,0表示使用默认值',
  `usage` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用量',
  `max_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
  `max_aggr_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '聚合子配置最大个数,,0表示使用默认值',
  `max_aggr_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
  `max_history_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大变更历史数量',
  `gmt_create` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_group_id`(`group_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '集群、各Group容量信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for his_config_info
-- ----------------------------
DROP TABLE IF EXISTS `his_config_info`;
CREATE TABLE `his_config_info`  (
  `id` bigint(64) UNSIGNED NOT NULL,
  `nid` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'app_name',
  `content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `gmt_create` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `gmt_modified` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
  `src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `op_type` char(10) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
  PRIMARY KEY (`nid`) USING BTREE,
  INDEX `idx_gmt_create`(`gmt_create`) USING BTREE,
  INDEX `idx_gmt_modified`(`gmt_modified`) USING BTREE,
  INDEX `idx_did`(`data_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '多租户改造' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of his_config_info
-- ----------------------------
INSERT INTO `his_config_info` VALUES (0, 1, 'itrip-service-orders.yaml', 'orders', '', 'spring:\r\n  application:\r\n    name: itrip-service-orders\r\n  # 配置注册中心\r\n  cloud:\r\n    nacos:\r\n      discovery:\r\n        server-addr: 192.168.203.130:8848\r\n    sentinel:\r\n      transport:\r\n        dashboard: 192.168.203.130:8858\r\n      datasource:\r\n        ds:\r\n          nacos:\r\n            server-addr: 192.168.203.130:8848\r\n            data-id: itrip-service-orders-sentinel\r\n            group-id: DEFAULT_GROUP\r\n            rule-type: flow\r\n  datasource:\r\n    driver-class-name: com.mysql.cj.jdbc.Driver\r\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\r\n    username: root\r\n    password: root\r\n\r\nserver:\r\n  port: 9002\r\n\r\nmybatis-plus:\r\n  type-aliases-package: com.changan.entity\r\n  configuration:\r\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n  mapper-locations: classpath*:/mapper/UserMapper.xml\r\n', '3255fc2c19792aa9c53f3644fa3d2840', '2022-03-31 09:24:29', '2022-03-31 09:24:30', NULL, '192.168.203.1', 'I', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (0, 2, 'itrip-service-users.yaml', 'users', '', 'spring:\r\n  application:\r\n    name: itrip-service-users\r\n  # 配置注册中心\r\n  cloud:\r\n    nacos:\r\n      discovery:\r\n        server-addr: 192.168.203.130:8848\r\n  datasource:\r\n    driver-class-name: com.mysql.cj.jdbc.Driver\r\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\r\n    username: root\r\n    password: root\r\n\r\nserver:\r\n  port: 9001\r\n\r\nmybatis-plus:\r\n  type-aliases-package: com.changan.entity\r\n  configuration:\r\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n  mapper-locations: classpath*:/mapper/UserMapper.xml\r\n', 'c405941ae6732e3b0aa463f2c767ba92', '2022-03-31 09:25:29', '2022-03-31 09:25:29', NULL, '192.168.203.1', 'I', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (1, 3, 'itrip-service-orders.yaml', 'orders', '', 'spring:\r\n  application:\r\n    name: itrip-service-orders\r\n  # 配置注册中心\r\n  cloud:\r\n    nacos:\r\n      discovery:\r\n        server-addr: 192.168.203.130:8848\r\n    sentinel:\r\n      transport:\r\n        dashboard: 192.168.203.130:8858\r\n      datasource:\r\n        ds:\r\n          nacos:\r\n            server-addr: 192.168.203.130:8848\r\n            data-id: itrip-service-orders-sentinel\r\n            group-id: DEFAULT_GROUP\r\n            rule-type: flow\r\n  datasource:\r\n    driver-class-name: com.mysql.cj.jdbc.Driver\r\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\r\n    username: root\r\n    password: root\r\n\r\nserver:\r\n  port: 9002\r\n\r\nmybatis-plus:\r\n  type-aliases-package: com.changan.entity\r\n  configuration:\r\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n  mapper-locations: classpath*:/mapper/UserMapper.xml\r\n', '3255fc2c19792aa9c53f3644fa3d2840', '2022-03-31 09:30:31', '2022-03-31 09:30:31', NULL, '192.168.203.1', 'U', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (0, 4, 'itrip-service-orders-sentinel', 'orders', '', '[\r\n    {\r\n        \"resource\": \"getOrderListByUserId\",\r\n        \"limitApp\": \"default\",\r\n        \"grade\": 1,\r\n        \"count\": 1,\r\n        \"strategy\": 0,\r\n        \"controlBehavior\": 0,\r\n        \"clusterMode\": false\r\n    }\r\n]', '83328c14e75d4a4173eeb10bb4fadf8e', '2022-03-31 09:32:29', '2022-03-31 09:32:29', NULL, '192.168.203.1', 'I', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (4, 5, 'itrip-service-orders-sentinel', 'orders', '', '[\r\n    {\r\n        \"resource\": \"getOrderListByUserId\",\r\n        \"limitApp\": \"default\",\r\n        \"grade\": 1,\r\n        \"count\": 1,\r\n        \"strategy\": 0,\r\n        \"controlBehavior\": 0,\r\n        \"clusterMode\": false\r\n    }\r\n]', '83328c14e75d4a4173eeb10bb4fadf8e', '2022-03-31 10:10:20', '2022-03-31 10:10:20', NULL, '192.168.203.1', 'U', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (0, 6, 'itrip-service-users-sentinel-degrade', 'users', '', '[\r\n    {\r\n    \"resource\": \"/getOrderListByUserId\",\r\n    \"count\": 0.5,\r\n    \"grade\": 1,\r\n    \"passCount\": 0,\r\n    \"timeWindow\": 2\r\n  }\r\n]', '006192ea69dae386bfa1e03916de06b3', '2022-03-31 10:19:05', '2022-03-31 10:19:06', NULL, '192.168.203.1', 'I', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (2, 7, 'itrip-service-users.yaml', 'users', '', 'spring:\r\n  application:\r\n    name: itrip-service-users\r\n  # 配置注册中心\r\n  cloud:\r\n    nacos:\r\n      discovery:\r\n        server-addr: 192.168.203.130:8848\r\n  datasource:\r\n    driver-class-name: com.mysql.cj.jdbc.Driver\r\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\r\n    username: root\r\n    password: root\r\n\r\nserver:\r\n  port: 9001\r\n\r\nmybatis-plus:\r\n  type-aliases-package: com.changan.entity\r\n  configuration:\r\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n  mapper-locations: classpath*:/mapper/UserMapper.xml\r\n', 'c405941ae6732e3b0aa463f2c767ba92', '2022-03-31 10:40:41', '2022-03-31 10:40:42', NULL, '192.168.203.1', 'U', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (2, 8, 'itrip-service-users.yaml', 'users', '', 'spring:\n  application:\n    name: itrip-service-users\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      datasource:\n        ds:\n          nacos:\n            server-addr: 192.168.203.130:8848\n            namespace: faf33017-b8c2-48fa-9b29-09d644006946\n            data-id: itrip-service-users-sentinel-degrade\n            group-id: users\n            rule-type: degrade\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9001\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', '6c661b278cc0dfda2b5fef269e655982', '2022-03-31 10:41:10', '2022-03-31 10:41:11', NULL, '192.168.203.1', 'U', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (6, 9, 'itrip-service-users-sentinel-degrade', 'users', '', '[\r\n    {\r\n    \"resource\": \"/getOrderListByUserId\",\r\n    \"count\": 0.5,\r\n    \"grade\": 1,\r\n    \"passCount\": 0,\r\n    \"timeWindow\": 2\r\n  }\r\n]', '006192ea69dae386bfa1e03916de06b3', '2022-03-31 10:48:06', '2022-03-31 10:48:07', NULL, '192.168.203.1', 'U', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (1, 10, 'itrip-service-orders.yaml', 'orders', '', 'spring:\n  application:\n    name: itrip-service-orders\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      transport:\n        dashboard: 192.168.203.130:8858\n      datasource:\n        ds:\n          nacos:\n            server-addr: 192.168.203.130:8848\n            namespace: cdc378f4-114b-471b-8732-b7d38bcb02ea\n            data-id: itrip-service-orders-sentinel\n            group-id: orders\n            rule-type: flow\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9002\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', '42f8fe72683eae64d521570fa9d97c33', '2022-04-01 02:01:34', '2022-04-01 02:01:35', NULL, '192.168.203.1', 'U', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (1, 11, 'itrip-service-orders.yaml', 'orders', '', 'spring:\n  application:\n    name: itrip-service-orders\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      # 配置控制台\n      transport:\n        dashboard: 192.168.203.130:8858\n      # 消息延时加载设置为false\n      eager: false\n      datasource:\n        ds:\n          nacos:\n            server-addr: 192.168.203.130:8848\n            namespace: cdc378f4-114b-471b-8732-b7d38bcb02ea\n            data-id: itrip-service-orders-sentinel\n            group-id: orders\n            rule-type: flow\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9002\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', 'cb15689c7d81942f1d0fc6bf9c7d7970', '2022-04-01 02:05:30', '2022-04-01 02:05:30', NULL, '192.168.203.1', 'U', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (4, 12, 'itrip-service-orders-sentinel', 'orders', '', '[\n    {\n        \"resource\": \"getOrderListByUserId\",\n        \"limitApp\": \"default\",\n        \"grade\": 1,\n        \"count\": 1000,\n        \"strategy\": 0,\n        \"controlBehavior\": 0,\n        \"clusterMode\": false\n    }\n]', '2a4666b2636d74298af48613b7be5989', '2022-04-01 02:05:41', '2022-04-01 02:05:42', NULL, '192.168.203.1', 'D', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (6, 13, 'itrip-service-users-sentinel-degrade', 'users', '', '[\n    {\n    \"resource\": \"/getOrderListByUserId\",\n    \"count\": 0.5,\n    \"grade\": 1,\n    \"passCount\": 0,\n    \"timeWindow\": 2\n  }\n]', '978f5b248f2a0c4411c813583193e770', '2022-04-01 02:05:47', '2022-04-01 02:05:48', NULL, '192.168.203.1', 'D', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (2, 14, 'itrip-service-users.yaml', 'users', '', 'spring:\n  application:\n    name: itrip-service-users\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      transport:\n        dashboard: 192.168.203.130:8858\n      datasource:\n        ds:\n          nacos:\n            server-addr: 192.168.203.130:8848\n            namespace: faf33017-b8c2-48fa-9b29-09d644006946\n            data-id: itrip-service-users-sentinel-degrade\n            group-id: users\n            rule-type: degrade\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9001\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', '2f0bf1b011e7698e09cd664d9baf2b38', '2022-04-01 02:06:11', '2022-04-01 02:06:11', NULL, '192.168.203.1', 'U', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (0, 15, 'itrip-service-orders-sentinel', 'DEFAULT_GROUP', '', '[\r\n    {\r\n        \"resource\": \"getOrderListByUserId\",\r\n        \"limitApp\": \"default\",\r\n        \"grade\": 1,\r\n        \"count\": 1,\r\n        \"strategy\": 0,\r\n        \"controlBehavior\": 0,\r\n        \"clusterMode\": false\r\n    }\r\n]', '83328c14e75d4a4173eeb10bb4fadf8e', '2022-04-01 02:27:51', '2022-04-01 02:27:52', NULL, '192.168.203.1', 'I', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (1, 16, 'itrip-service-orders.yaml', 'orders', '', 'spring:\n  application:\n    name: itrip-service-orders\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      # 配置控制台\n      transport:\n        dashboard: 192.168.203.130:8858\n      # 消息延时加载设置为false\n      eager: false\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9002\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', '14d0845d37d83828299227c893e361b7', '2022-04-01 02:30:14', '2022-04-01 02:30:15', NULL, '192.168.203.1', 'U', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (1, 17, 'itrip-service-orders.yaml', 'orders', '', 'spring:\n  application:\n    name: itrip-service-orders\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      # 配置控制台\n      transport:\n        dashboard: 192.168.203.130:8858\n      # 消息延时加载设置为false\n      eager: false\n      datasource:\n        ds:\n          server-addr: 192.168.203.130:8848\n          username: nacos\n          password: nacos\n          namespace: cdc378f4-114b-471b-8732-b7d38bcb02ea\n          data-id: itrip-service-orders-sentinel\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9002\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', 'fd1fab08f7ffc8dfff53d651a46c7e2d', '2022-04-01 02:31:50', '2022-04-01 02:31:50', NULL, '192.168.203.1', 'U', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (1, 18, 'itrip-service-orders.yaml', 'orders', '', 'spring:\n  application:\n    name: itrip-service-orders\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      # 配置控制台\n      transport:\n        dashboard: 192.168.203.130:8858\n      # 消息延时加载设置为false\n      eager: false\n      datasource:\n        ds:\n          server-addr: 192.168.203.130:8848\n          namespace: cdc378f4-114b-471b-8732-b7d38bcb02ea\n          data-id: itrip-service-orders-sentinel\n          rule-type: flow\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9002\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', 'ffdd9747e1dce76259be511385c11095', '2022-04-01 02:37:47', '2022-04-01 02:37:47', NULL, '192.168.203.1', 'U', 'cdc378f4-114b-471b-8732-b7d38bcb02ea');
INSERT INTO `his_config_info` VALUES (2, 19, 'itrip-service-users.yaml', 'users', '', 'spring:\n  application:\n    name: itrip-service-users\n  # 配置注册中心\n  cloud:\n    nacos:\n      discovery:\n        server-addr: 192.168.203.130:8848\n    sentinel:\n      transport:\n        dashboard: 192.168.203.130:8858\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/itripdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8\n    username: root\n    password: root\n\nserver:\n  port: 9001\n\nmybatis-plus:\n  type-aliases-package: com.changan.entity\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n  mapper-locations: classpath*:/mapper/UserMapper.xml\n', 'c6848c6c2044b081e483c9ab1209f8c0', '2022-04-01 03:14:15', '2022-04-01 03:14:15', NULL, '192.168.203.1', 'U', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (0, 20, 'itrip-service-users-sentinel-degrade', 'DEFAULT_GROUP', '', '[\r\n    {\r\n    \"resource\": \"/getOrderListByUserId\",\r\n    \"count\": 0.5,\r\n    \"grade\": 1,\r\n    \"passCount\": 0,\r\n    \"timeWindow\": 2\r\n  }\r\n]', '006192ea69dae386bfa1e03916de06b3', '2022-04-01 03:15:51', '2022-04-01 03:15:52', NULL, '192.168.203.1', 'I', 'faf33017-b8c2-48fa-9b29-09d644006946');
INSERT INTO `his_config_info` VALUES (0, 21, 'itrip-gateway.yaml', 'gateway', '', 'server:\r\n  port: 9999\r\nspring:\r\n  cloud:\r\n    nacos:\r\n      discovery:\r\n        server-addr: 192.168.203.130:8848\r\n    gateway:\r\n      discovery:\r\n        locator:\r\n          enabled: true\r\n      routes:\r\n        - id: itrip-service-orders\r\n          uri: lb://itrip-service-orders\r\n          predicates:\r\n            - Path=/orders/**\r\n          filters:\r\n            - StripPrefix=1\r\n        - id: itrip-service-users\r\n          uri: lb://itrip-service-users\r\n          predicates:\r\n            - Path=/users/**\r\n          filters:\r\n            - StripPrefix=1\r\n  application:\r\n    name: itrip-gateway', '2ddb48eeabf9fb3d5666d5fdc0eacebc', '2022-04-02 06:35:45', '2022-04-02 06:35:45', NULL, '192.168.203.1', 'I', '0cbe8b45-e878-4c59-9ab8-5b8616ac4d57');
INSERT INTO `his_config_info` VALUES (16, 22, 'itrip-gateway.yaml', 'gateway', '', 'server:\r\n  port: 9999\r\nspring:\r\n  cloud:\r\n    nacos:\r\n      discovery:\r\n        server-addr: 192.168.203.130:8848\r\n    gateway:\r\n      discovery:\r\n        locator:\r\n          enabled: true\r\n      routes:\r\n        - id: itrip-service-orders\r\n          uri: lb://itrip-service-orders\r\n          predicates:\r\n            - Path=/orders/**\r\n          filters:\r\n            - StripPrefix=1\r\n        - id: itrip-service-users\r\n          uri: lb://itrip-service-users\r\n          predicates:\r\n            - Path=/users/**\r\n          filters:\r\n            - StripPrefix=1\r\n  application:\r\n    name: itrip-gateway', '2ddb48eeabf9fb3d5666d5fdc0eacebc', '2022-04-02 06:40:33', '2022-04-02 06:40:33', NULL, '192.168.203.1', 'U', '0cbe8b45-e878-4c59-9ab8-5b8616ac4d57');

-- ----------------------------
-- Table structure for permissions
-- ----------------------------
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions`  (
  `role` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `resource` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `action` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  UNIQUE INDEX `uk_role_permission`(`role`, `resource`, `action`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for roles
-- ----------------------------
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles`  (
  `username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `role` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  UNIQUE INDEX `idx_user_role`(`username`, `role`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of roles
-- ----------------------------
INSERT INTO `roles` VALUES ('nacos', 'ROLE_ADMIN');

-- ----------------------------
-- Table structure for tenant_capacity
-- ----------------------------
DROP TABLE IF EXISTS `tenant_capacity`;
CREATE TABLE `tenant_capacity`  (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Tenant ID',
  `quota` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '配额,0表示使用默认值',
  `usage` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用量',
  `max_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
  `max_aggr_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '聚合子配置最大个数',
  `max_aggr_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
  `max_history_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大变更历史数量',
  `gmt_create` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '租户容量信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for tenant_info
-- ----------------------------
DROP TABLE IF EXISTS `tenant_info`;
CREATE TABLE `tenant_info`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `kp` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'kp',
  `tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_id',
  `tenant_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_name',
  `tenant_desc` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'tenant_desc',
  `create_source` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'create_source',
  `gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
  `gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_tenant_info_kptenantid`(`kp`, `tenant_id`) USING BTREE,
  INDEX `idx_tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = 'tenant_info' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of tenant_info
-- ----------------------------
INSERT INTO `tenant_info` VALUES (1, '1', 'cdc378f4-114b-471b-8732-b7d38bcb02ea', 'orders', '订单的命名空间', 'nacos', 1648718577421, 1648718577421);
INSERT INTO `tenant_info` VALUES (2, '1', 'faf33017-b8c2-48fa-9b29-09d644006946', 'users', '用户的命名空间', 'nacos', 1648718588816, 1648718588816);
INSERT INTO `tenant_info` VALUES (3, '1', '0cbe8b45-e878-4c59-9ab8-5b8616ac4d57', 'gateway', '网关', 'nacos', 1648881242577, 1648881242577);

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users`  (
  `username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `password` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `enabled` tinyint(1) NOT NULL,
  PRIMARY KEY (`username`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', 1);

SET FOREIGN_KEY_CHECKS = 1;
  • 停止容器,由于加了--rm参数,所以容器会自动删除

docker stop containerID

                4.3.3丶Nacos

我们来看看NACOS的环境变量,如下表所示:

配置项

描述

可选参数

默认值

MODE

模式 cluster/standalone

cluster/standalone

cluster

PREFER_HOST_MODE

是否支持 hostname

hostname/

标签: 2218连接器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台