spring cloud seata集成

news2024/9/24 7:25:48

目录

一、seata使用场景 

二、seata组成

三、seata服务端搭建

四、客户端使用seata

4.1 客户端增加undo_log表

4.2 客户端增加seata相关配置

4.3 客户端使用注解

五、测试


一、seata使用场景 

微服务中,一个业务涉及到多个微服务系统,每个微服务系统连接不同的数据库,要求数据一致性时使用。如下订单操作,调用下订单方法后,需要增加订单记录、减少产品库存;订单记录和产品库存 调用不同的微服务  数据存储在不同的数据库中;

调用下订单方法时,订单服务或库存服务任何一个出现问题,此方法执行失败,数据库记录需回滚。

理论支持:cap、base;

理论依据:二阶段提交法(准备、执行);三阶段提交法(询问、准备、执行);消息最终一致性;最大努力通知法;

解决方案:tcc(try-confirm-cancel)、sega、X/A等。

二、seata组成

seata是spring cloud生态中的分布式事务解决方案,包括seata服务端和客户端;

seata服务端是独立部署的;(seata担当事务协调器角色)

seata客户端,即每个微服务增加相关依赖和配置,使用@GlobalTransactional(rollbackFor = Exception.class)注解即可;

三、seata服务端搭建

1. 下载seata服务端包;

本文使用的是seata1.7.0版本的包。

2. 修改seata配置文件 application.yml,使用nacos注册seata服务,管理seata服务配置;

路径seata>conf,application.yml

#  Copyright 1999-2019 Seata.io Group.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

server:
  port: 7091

spring:
  application:
    name: seata-server

logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash
console:
  user:
    username: seata
    password: seata

seata:
  config:
    # support: nacos 、 consul 、 apollo 、 zk  、 etcd3
    type: nacos
    nacos:
      server-addr: 127.0.0.1:8948
      namespace:
      group: SEATA_GROUP
      username: nacos
      password: 
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
      data-id: seataServer.properties
  registry:
    # support: nacos 、 eureka 、 redis 、 zk  、 consul 、 etcd3 、 sofa
    type: nacos
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:8948
      group: SEATA_GROUP
      namespace:
      cluster: default
      username: nacos
      password: 
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
  security:
    secretKey: 
    tokenValidityInMilliseconds: 1800000
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login

在nacos中增加seata配置:

seataServer.properties配置文件:

#For details about configuration items, see https://seata.io/zh-cn/docs/user/configurations.html
#Transport configuration, for client and server
transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableTmClientBatchSendRequest=false
transport.enableRmClientBatchSendRequest=true
transport.enableTcServerBatchSendResponse=false
transport.rpcRmRequestTimeout=30000
transport.rpcTmRequestTimeout=30000
transport.rpcTcRequestTimeout=30000
transport.threadFactory.bossThreadPrefix=NettyBoss
transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
transport.threadFactory.shareBossWorker=false
transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
transport.threadFactory.clientSelectorThreadSize=1
transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
transport.threadFactory.bossThreadSize=1
transport.threadFactory.workerThreadSize=default
transport.shutdown.wait=3
transport.serialization=seata
transport.compressor=none

#Transaction routing rules configuration, only for the client
service.vgroupMapping.default_tx_group=default
#If you use a registry, you can ignore it
service.default.grouplist=127.0.0.1:8091
service.enableDegrade=false
service.disableGlobalTransaction=false

#Transaction rule configuration, only for the client
client.rm.asyncCommitBufferLimit=10000
client.rm.lock.retryInterval=10
client.rm.lock.retryTimes=30
client.rm.lock.retryPolicyBranchRollbackOnConflict=true
client.rm.reportRetryCount=5
client.rm.tableMetaCheckEnable=true
client.rm.tableMetaCheckerInterval=60000
client.rm.sqlParserType=druid
client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.rm.sagaJsonParser=fastjson
client.rm.tccActionInterceptorOrder=-2147482648
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
client.tm.degradeCheck=false
client.tm.degradeCheckAllowTimes=10
client.tm.degradeCheckPeriod=2000
client.tm.interceptorOrder=-2147482648
client.undo.dataValidation=true
client.undo.logSerialization=jackson
client.undo.onlyCareUpdateColumns=true
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
client.undo.logTable=undo_log
client.undo.compress.enable=true
client.undo.compress.type=zip
client.undo.compress.threshold=64k
#For TCC transaction mode
tcc.fence.logTableName=tcc_fence_log
tcc.fence.cleanPeriod=1h

#Log rule configuration, for client and server
log.exceptionRate=100

#Transaction storage configuration, only for the server. The file, db, and redis configuration values are optional.
store.mode=db
store.lock.mode=db
store.session.mode=db
#Used for password encryption
store.publicKey=

#These configurations are required if the `store mode` is `db`. If `store.mode,store.lock.mode,store.session.mode` are not equal to `db`, you can remove the configuration block.
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.cj.jdbc.Driver
store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
store.db.user=root
store.db.password=
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.distributedLockTable=distributed_lock
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000

#Transaction rule configuration, only for the server
server.recovery.committingRetryPeriod=1000
server.recovery.asynCommittingRetryPeriod=1000
server.recovery.rollbackingRetryPeriod=1000
server.recovery.timeoutRetryPeriod=1000
server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
server.rollbackRetryTimeoutUnlockEnable=false
server.distributedLockExpireTime=10000
server.xaerNotaRetryTimeout=60000
server.session.branchAsyncQueueSize=5000
server.session.enableBranchAsyncRemove=false
server.enableParallelRequestHandle=false

#Metrics configuration, only for the server
metrics.enabled=false
metrics.registryType=compact
metrics.exporterList=prometheus
metrics.exporterPrometheusPort=9898

3. 创建seata服务所需数据库表;

在seata script目录下找到sql脚本

执行sql语句建表:

-- -------------------------------- The script used when storeMode is 'db' --------------------------------
-- the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS `global_table`
(
    `xid`                       VARCHAR(128) NOT NULL,
    `transaction_id`            BIGINT,
    `status`                    TINYINT      NOT NULL,
    `application_id`            VARCHAR(32),
    `transaction_service_group` VARCHAR(32),
    `transaction_name`          VARCHAR(128),
    `timeout`                   INT,
    `begin_time`                BIGINT,
    `application_data`          VARCHAR(2000),
    `gmt_create`                DATETIME,
    `gmt_modified`              DATETIME,
    PRIMARY KEY (`xid`),
    KEY `idx_status_gmt_modified` (`status` , `gmt_modified`),
    KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(
    `branch_id`         BIGINT       NOT NULL,
    `xid`               VARCHAR(128) NOT NULL,
    `transaction_id`    BIGINT,
    `resource_group_id` VARCHAR(32),
    `resource_id`       VARCHAR(256),
    `branch_type`       VARCHAR(8),
    `status`            TINYINT,
    `client_id`         VARCHAR(64),
    `application_data`  VARCHAR(2000),
    `gmt_create`        DATETIME(6),
    `gmt_modified`      DATETIME(6),
    PRIMARY KEY (`branch_id`),
    KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
    `row_key`        VARCHAR(128) NOT NULL,
    `xid`            VARCHAR(128),
    `transaction_id` BIGINT,
    `branch_id`      BIGINT       NOT NULL,
    `resource_id`    VARCHAR(256),
    `table_name`     VARCHAR(32),
    `pk`             VARCHAR(36),
    `status`         TINYINT      NOT NULL DEFAULT '0' COMMENT '0:locked ,1:rollbacking',
    `gmt_create`     DATETIME,
    `gmt_modified`   DATETIME,
    PRIMARY KEY (`row_key`),
    KEY `idx_status` (`status`),
    KEY `idx_branch_id` (`branch_id`),
    KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `distributed_lock`
(
    `lock_key`       CHAR(20) NOT NULL,
    `lock_value`     VARCHAR(20) NOT NULL,
    `expire`         BIGINT,
    primary key (`lock_key`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);

四、客户端使用seata

示例由三个服务组成,seataDemoWeb、demo-order、demo-product;

其中seataDemoWeb服务提供rest接口test,此接口调用demo-order和demo-product服务,增加订单记录,修改库存。

4.1 客户端增加undo_log表

demo-order和demo-product,两个服务对应的数据库均需增加undo_log表;

建表语句:

CREATE TABLE `undo_log` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) NOT NULL,
  `xid` varchar(100) NOT NULL,
  `context` varchar(128) NOT NULL,
  `rollback_info` longblob NOT NULL,
  `log_status` int(11) NOT NULL,
  `log_created` datetime NOT NULL,
  `log_modified` datetime NOT NULL,
  `ext` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

4.2 客户端增加seata相关配置

seataDemoWeb、demo-order和demo-product在application.properties中增加seata配置

seata.enabled=true
seata.application-id=${spring.application.name}
seata.tx-service-group=seata-tx-group
seata.service.vgroup-mapping.seata-tx-group=default
seata.registry.type=nacos
seata.registry.nacos.server-addr=127.0.0.1:8948
seata.registry.nacos.username=nacos
seata.registry.nacos.password=
seata.registry.nacos.namespace=public
seata.registry.nacos.group=SEATA_GROUP
seata.registry.nacos.application=seata-server

pom增加seata依赖,完整pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.10.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>hj.example</groupId>
    <artifactId>productDemo</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <properties>
        <lombok.version>1.18.24</lombok.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>hj.example</groupId>
            <artifactId>demoCommon</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.12</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
        <!-- nacos -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
            <version>2.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
            <version>2.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-dubbo</artifactId>
            <version>2.2.5.RELEASE</version>
        </dependency>

        <!-- seata -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
            <version>2.2.5.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>io.seata</groupId>
                    <artifactId>seata-spring-boot-starter</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
            <version>1.7.0</version>
        </dependency>
    </dependencies>
</project>

 

4.3 客户端使用注解

在seataDemoWeb服务中,增加@GlobalTransaction注解

package hj.example.seatademoweb.controller;

import com.baomidou.mybatisplus.extension.service.IService;
import hj.example.democommon.entity.DemoOrder;
import hj.example.democommon.entity.DemoProduct;
import hj.example.democommon.entity.StateEnum;
import hj.example.democommon.services.DemoOrderService;
import hj.example.democommon.services.DemoProductService;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @Description: TODO
 * @Author: 
 * @Date: 2023/8/29
 **/
@RestController
public class TestController {
    @DubboReference(interfaceName = "demoOrderService")
    private DemoOrderService demoOrderService;

    @DubboReference(interfaceName = "demoProductService")
    private DemoProductService demoProductService;

    @RequestMapping("/test")
    @GlobalTransactional(rollbackFor = Exception.class)
    public ResponseEntity<Object> test() {
        DemoOrder demoOrder =new DemoOrder();
        demoOrder.setAccountId("1");
        demoOrder.setState(StateEnum.NEW.name());
        demoOrderService.save(demoOrder);

        DemoProduct demoProduct = new DemoProduct();
        demoProduct.setNum(Math.random()*10000);
        demoProductService.save(demoProduct);
        return new ResponseEntity<>("success", HttpStatus.OK);
    }
}

五、测试

修改4.3中的代码,debug查看回滚

DemoProduct demoProduct = new DemoProduct();
demoProduct.setNum(1/0);
demoProductService.save(demoProduct);

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/958471.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

elementUI中的table动态表单记录

form表单与table一起使用 之前一直以为form表单是单独使用&#xff0c;现在联动起来发现只是套了一层外壳&#xff0c;并不是很麻烦的事情 form的单独使用 <el-form :model"ruleForm" status-icon :rules"rules" ref"ruleForm" label-widt…

前端进阶之——模块化

在做项目的时候越来越发现模块化的重要性&#xff0c;做好模块化开发不仅给后期的维护带来不少好处而且大大提升项目开发效率&#xff0c;接下来整理一下模块化相关知识吧。 模块化开发的优点 封装方法、提高代码的复用性、可维护性和可读性隔离作用域&#xff0c;避免污染全…

【SpringSecurity】十、JWT工具类

文章目录 1、jwt类库与相关依赖2、工具类3、总结 1、jwt类库与相关依赖 <!-- 添加jwt的依赖 --> <dependency><groupId>com.auth0</groupId><artifactId>java-jwt</artifactId><version>3.11.0</version> </dependency>…

如何看待中小企业实现数字化转型难的问题?有哪些工具可以降低企业数字化的门槛?

中小企业 (SME) 数字化转型的难度可能存在很大差异&#xff0c;具体取决于行业、现有技术基础设施、领导层的数字素养、预算限制以及变革的整体准备程度等因素。但总体而言&#xff0c;中小企业在进行数字化转型时往往面临以下几个挑战&#xff1a; 1.资源有限&#xff1a;与大…

Openlayer系列:利用GeoServer和Openlayer地图显示区域掩模

前言 利用GeoServer和Openlayer地图显示区域掩模 利用GeoServer进行图层发布 Openlayer地图显示区域掩模 对界面地图进行切换&#xff0c;卫星图利用GeoServer&#xff0c;水系等根据geojson文件生成图层&#xff0c;效果如下 卫星图部分代码如下&#xff1a; // 创建卫星图…

淘宝API接口,可以运用到多种业务场景中

淘宝API接口可以运用到多种业务场景中&#xff0c;以下列举了一些主要的场景&#xff1a; 商品信息展示&#xff1a;通过调用淘宝API详情接口&#xff0c;可以获取商品的详细信息&#xff0c;如商品标题、价格、库存、销量、评价等数据。这些信息可以用于在自己的网站或应用程…

@24计算机考研er,招生简章超全汇总来了!持续更新请收藏

今天是8月最后一天&#xff0c;大家复习进度如何&#xff1f;目前已经有多所计算机招生院校公布了24考研的研招通知&#xff0c;包含&#xff1a;招生简章、专业目录、参考书目、考试大纲等。学姐整理成了24计算机考研招生官方信息汇总表&#xff01;终于不用自己一个个去官网翻…

泼辣修图Ploarr5.11.7电脑最新简体中文版下载

泼辣修图专业版是一款强大的专业修图软件&#xff0c;拥有上百款调色工具还有丰富的图层素材&#xff0c; 更有智能的人像修饰面板&#xff0c;具备物体识别的智能蒙板&#xff0c;高效的滤镜管理系统和强大的文字工具&#xff0c;支持批量处理。一切围绕摄影&#xff0c;无论是…

XSS漏洞及分析·

XSS漏洞和分析 知识点模板字符串定时器焦点jquerydom破坏 漏洞复现 xss测试网站&#xff1a;https://xss.pwnfunction.com/ 知识点 模板字符串 模板字面量是用反引号&#xff08;&#xff09;分隔的字面量&#xff0c;允许多行字符串、带嵌入表达式的字符串插值和一种叫带标签…

LLM - LLaMA-2 获取文本向量并计算 Cos 相似度

目录 一.引言 二.获取文本向量 1.hidden_states 与 last_hidden_states ◆ hidden_states ◆ last_hidden_states 2.LLaMA-2 获取 hidden_states ◆ model config ◆ get Embedding 三.获取向量 Cos 相似度 1.向量选择 2.Cos 相似度 3.BERT-whitening 特征白化 …

用户体验地图是什么?UX设计心得分享

大家好&#xff0c;我是设计师l1m0身。本篇文章是关于UX设计中的用户体验地图。 对于新手设计师来说&#xff0c;建立用户体验地图会有一些难度。本篇文章中&#xff0c;我会以简单、易懂的语言分享UX设计师如何制作用户体验地图&#xff0c;希望对你的日常项目体验提升有所帮…

私有化部署无忧企业文档2.1.7版本功能清单已更新!

无忧企业文档是软开企服研发的一款基于云端的在线文档管理工具&#xff0c;适用于团队内部协作、知识管理、项目管理等多个领域。与其他在线文档工具相比&#xff0c;无忧企业文档更注重团队协作和安全性&#xff0c;适合企业和团队使用。并且它还提供了丰富的API接口&#xff…

使用Dbeaver连接GaussDB

1.下载DBeaver&#xff0c;官网地址 2.安装软件&#xff0c;打开软件&#xff0c;点击数据库->驱动管理器&#xff0c;具体操作如下图&#xff1a; 3、选择新建后进行参数设置&#xff0c;如下图&#xff1a; 具体参数如下图 驱动名称: GS #随便定义 驱动类型&#…

Pytorch 的基本概念和使用场景介绍

文章目录 一、基本概念1. 张量&#xff08;Tensor&#xff09;2. 自动微分&#xff08;Autograd&#xff09;3. 计算图&#xff08;Computation Graph&#xff09;4. 动态计算图&#xff08;Dynamic Computation Graph&#xff09;5. 变量&#xff08;Variable&#xff09; 二、…

Nodejs入门 token校验

Nodejs入门token校验之jsonwebtoken的使用 前言 token校验作为项目里的必要项&#xff0c;其重要性不言而喻&#xff0c;今天介绍一个在Node.js中备受推崇的神奇工具——jsonwebtoken 一、token是什么jsonwebtoken是什么&#xff1f; 在互联网世界中&#xff0c;Token是一种用于…

路由技术介绍

路由技术介绍 一、路由概述1.1、为什么需要路由1.2、路由的定义1.3、直接路由数据通信分析1.4、间接路由数据通信分析1.5、认识路由设备1.6、路由的下一跳1.7、路由表的构成与维护1.8、路由表的构成1.9、路由表的度量值1.10、路由表的内容1.11、管理距离1.12、路由加表原则1.13…

ESP32在线仿真器

1. Wokwi是一个电子在线仿真平台&#xff0c;支持的芯片有ESP32,STM32,树莓派&#xff0c;Arduino 网址&#xff1a; https://wokwi.com ; 而且支持在vscode内置插件仿真 2. ESP32可以使用microPython开发&#xff0c;相关sdk说明MicroPython&#xff08;ESP32&#xff09;快…

IndexDB

1 新建一个数据库 (1)在utils文件中新建一个indexedDB.ts export default class DB {private dbName: string // 数据库名称constructor(dbName: string){this.dbName dbName}// 打开数据库public openStore() {const request window.indexedDB.open(this.dbName,1)request…

关于linux openssl的自签证书认证与nginx配置

自签文档链接 重点注意这块&#xff0c;不能写一样的&#xff0c;要是一样的话登录界面锁会报不安全 域名这块跟最后发布的一致 nginx配置的话 server {listen 443 ssl; //ssl 说明为https 默认端口为443server_name www.skyys.com; //跟openssl设置的域名保持一致s…

GD32F4_CAN1无法进入接收中断

Q、GD32F450/470的外设CAN1按正常的初始化顺序配置后在正常和回环模式下都无法进入接收中断。 A、注意以下两点 【1】要使用CAN1的接收中断必须要开启CAN0的时钟 【2】CAN1的接收过滤序号应设置为15