配置中心--Spring Cloud Config

news2025/3/6 21:16:50

目录

概述

环境说明

步骤

创建远端git仓库

准备配置文件

配置中心--服务端

配置中心--客户端

配置中心的高可用

配置中心--服务端

配置中心--客户端

消息总线刷新配置

配置中心--服务端

配置中心--客户端


概述

因为微服务架构有很多个服务,手动一个一个管理各个服务配置很麻烦,不同的环境(开发、测试、生产)往往需要不同的配置文件,运行期间也需要动态调整配置,修改配置后微服务需要自动更新配置,所以需要一个统一管理应用配置的组件。

配置中心是一种统一管理各种应用配置的基础服务组件。本文讲解的配置中心组件为Spring Cloud Config。

本文的操作可在 微服务调用链路追踪 的基础上进行 或者 在 Spring Cloud Stream实践 的基础上进行。

环境说明

jdk1.8

maven3.6.3

mysql8

spring cloud2021.0.8

spring boot2.7.12

idea2022

rabbitmq3.12.4

步骤

创建远端git仓库

创建远端git仓库,管理配置文件,使用gitee,创建仓库名称为config-repo(创建时点击创建README文件,方便直接用浏览器上传文件)

可使用远端仓库管理微服务公共的配置,而非公共的配置可放在各自微服务的application.yml中。

公共的配置,例如:数据库配置、Eureka配置等

非公共的配置,例如:端口号、应用名称等

准备配置文件

配置中心的配置文件命名规则为:

{application}-{profile}.yml
{application}-{profile}.properties

application为应用名称 profile指的开发环境(用于区分开发环境、测试环境、生产环境等)

复制product-serviceapplication.yml,重命名为application-pro.yml,抽取公共配置,例如:数据库配置、zipkin、sleuth、rabbitmq、eureka等,同时添加一个name属性(用于区别不同的环境配置),公共的配置放在远端git仓库。

application-pro.yml

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/shop1?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
    username: root
    password: 123
  jpa:
    database: MySQL
    show-sql: true
    open-in-view: true
    generate-ddl: true #自动创建表
  zipkin:
    sender:
      type: rabbit #数据的传输方式,以rabbit的方式向server端发送数据
  sleuth:
    sampler:
      probability: 1 #采样比,日志的采样比例,默认0.1,测试环境设置为100%收集日志
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
    listener: #这里配置重试策略
      direct:
        retry:
          enabled: true
      simple:
        retry:
          enabled: true

eureka:
  client:
    service-url:
      defaultZone: http://localhost:9000/eureka/
  instance:
    prefer-ip-address: true
    instance-id: ${spring.cloud.client.ip-address}:${server.port}

logging:
  level:
    root: info
    org.springframework.web.servlet.DispatcherServlet: DEBUG
    org.springframework.cloud.sleuth: DEBUG

name: product-pro

复制application-pro.yml得到application-dev.yml

application-dev.yml

配置内容如下,区别在于name的值为product-dev

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/shop1?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
    username: root
    password: 123
  jpa:
    database: MySQL
    show-sql: true
    open-in-view: true
    generate-ddl: true #自动创建表
  zipkin:
    sender:
      type: rabbit #数据的传输方式,以rabbit的方式向server端发送数据
  sleuth:
    sampler:
      probability: 1 #采样比,日志的采样比例,默认0.1,测试环境设置为100%收集日志
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
    listener: #这里配置重试策略
      direct:
        retry:
          enabled: true
      simple:
        retry:
          enabled: true

eureka:
  client:
    service-url:
      defaultZone: http://localhost:9000/eureka/
  instance:
    prefer-ip-address: true
    instance-id: ${spring.cloud.client.ip-address}:${server.port}

logging:
  level:
    root: info
    org.springframework.web.servlet.DispatcherServlet: DEBUG
    org.springframework.cloud.sleuth: DEBUG

name: product-dev

通过浏览器界面,手动上传application-pro.ymlapplication-dev.yml到git仓库

点击上传文件区域,选中需要上传的文件:application-pro.ymlapplication-dev.yml

 填写提交信息,点击提交

上传成功后,如下图

配置中心--服务端

创建子工程config_server

引入依赖

	<dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>
    </dependencies>

启动类

package org.example.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;

@SpringBootApplication
@EnableConfigServer //开启配置中心服务端功能
public class ConfigServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}

配置application.yml

server:
  port: 11111
spring:
  application:
    name: config-server
  cloud:
    config:
      server:
        git:
          uri: https://gitee.com/xxx/config-repo.git

uri的值是刚才创建的远端git仓库的地址,注意修改为自己的仓库地址。

启动config_server服务

浏览器访问

http://localhost:11111/application-dev.yml

访问不到数据

原因是gitee仓库是私有的,需要把仓库公开或者配置gitee的登录信息。

解决方法1:将git仓库开源

解决方法2:修改配置,加上gitee的用户名和密码

cloud:
  config:
    server:
      git:
        uri: https://gitee.com/xxx/config-repo.git
        username: xxx
        password: xxx

两种方法选择其中一个。

解决后,再次访问

http://localhost:11111/application-dev.yml

成功看到数据如下 

配置中心--客户端

配置中心客户端就是各个微服务

这里创建一个微服务:config_client_1

config_client_1项目结构如下

添加依赖

	<dependencies>
        <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.33</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <!--引入EurekaClient-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <!--消息总线bus-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-bus</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>
    </dependencies>

刷新依赖

非公共的配置application.yml

server:
  port: 9101
spring:
  application:
    name: config-client1

bootstrap.yml

spring:
  cloud:
    config:
      name: application #应用名称对应git配置文件的前半部分,例如:application-dev.yml,这里就写application
      profile: dev #开发环境
      label: master #git中的分支
      uri: http://localhost:11111 #config_server的请求地址

ConfigClientApplication.java

package org.example.config.client;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;

@SpringBootApplication
@EntityScan("org.example.config.client.entity.Product")
public class ConfigClientApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConfigClientApplication.class, args);
    }
}

Product.java

package org.example.config.client.entity;


import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 商品实体类
 */
@Data
@Entity
@Table(name="tb_product")
public class Product {
    @Id
    private Long id;
    private String productName;
    private Integer status;
    private BigDecimal price;
    private String productDesc;
    private String caption;
    private Integer inventory;
}

ProductController.java

package org.example.config.client.controller;

import org.example.config.client.entity.Product;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/config-client/product")
public class ProductController {

    @Value("${name}")
    private String name;

    @RequestMapping("/get")
    public Product getProduct(){
        Product product = new Product();
        product.setProductName(name);
        return product;
    }
}

启动eureka、config_server、config_client_1服务

注意:因为远端git仓库的配置文件有eureka配置,所以拉取到配置后,需要启动eureka服务

浏览器访问

http://localhost:9101/config-client/product/get

响应
{"id":null,"productName":"product-dev","status":null,"price":null,"productDesc":null,"caption":null,"inventory":null}

pruductName为product-dev,与git的application-dev.yml的name属性一致

config_client_1bootstrap.yml的profile改为pro

重启config_client_1服务

再次访问

http://localhost:9101/config-client/product/get
响应
{"id":null,"productName":"product-pro","status":null,"price":null,"productDesc":null,"caption":null,"inventory":null}

 pruductName为product-pro,与git的application-pro.yml的name属性一致

修改git的配置

查看application-pro.yml文件,点击编辑

product-pro改为product-pro1 

点击提交

浏览器访问

http://localhost:9101/config-client/product/get

发现数据未更新,还是product-pro

解决方式:

方式一:重启config_client_1服务

发现重启可以拿到最新数据,但是,在生产环境中,重启服务有时候不太方便。

方式二:手动刷新

修改config_client_1服务

pom.xml,引入actuator依赖(之前已引入,跳过)

		<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

在需要的更新数据的类上添加@RefreshScope,开启动态刷新

修改bootstrap.yml

#开启动态刷新的端点
management:
  endpoints:
    web:
      exposure:
        include: refresh

重启config_client_1服务

访问

http://localhost:9101/config-client/product/get

productName是product-pro1

将git配置文件的name值修改为product-pro2

发起post请求刷新数据

curl -X POST "http://localhost:9101/actuator/refresh"

可使用postman或cmd命令行发起请求,这里使用cmd命令行发起post请求

再次访问

http://localhost:9101/config-client/product/get

响应最新的数据:product-pro2

手动刷新操作总结:

  1. 引入actuator依赖

  2. 需要的更新数据的类上添加@RefreshScope,开启动态刷新

  3. bootstrap.yml开启动态刷新的端点

  4. 修改git配置

  5. 发起post请求手动刷新数据

手动刷新能解决在不重启应用情况下,能做到动态刷新配置。但当服务很多时或需要更新的数据接口很多的情况下,就需要发起很多次Post请求,手动刷新显得很麻烦。可以使用消息总线技术解决该问题。

配置中心的高可用

一台配置中心服务容易出现单点故障问题,将配置中心集群化构成高可用的配置中心可以解决配置中心单点故障问题。

将多个配置中心注册到eureka,提供统一的服务名称,客户端通过服务名称调用配置中心。

配置中心--服务端

修改config_server服务

添加依赖

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

刷新依赖

application.yml添加eureka相关配置

eureka:
  client:
    service-url:
      defaultZone: http://localhost:9000/eureka
    instance:
      prefer-ip-address: true
      instance-id: ${spring.cloud.client.ip-address}:${server.port}

修改config_server配置文件,添加default-label: master配置

cloud:
  config:
    server:
      git:
        uri: https://gitee.com/xxx/config-repo.git
        default-label: master

注意修改uri为自己git远端仓库地址。 

启动eureka、config_server服务

查看Eureka Web UI,看到了一台配置中心服务

http://localhost:9000/

通过复制配置方式,得到另外一台配置中心

修改端口号,复制运行配置,再启动一台配置中心服务

刷新查看Eureka Web UI,看到CONFIG-SERVER配置中心服务有两个实例。

配置中心--客户端

config_client_1服务

修改bootstrap.yml,添加eureka配置,修改通过服务名称(config-server)拿到配置

spring:
  cloud:
    config:
      name: application #应用名称对应git配置文件的前半部分,例如:application-dev.yml,这里就写application
      profile: pro #开发环境
      label: master #git中的分支
      #uri: http://localhost:11111 #config_server的请求地址
      discovery:
        enabled: true #开启服务发现
        service-id: config-server #配置服务的服务名称
#开启动态刷新的端点
management:
  endpoints:
    web:
      exposure:
        include: refresh

eureka:
  client:
    service-url:
      defaultZone: http://localhost:9000/eureka
    instance:
      prefer-ip-address: true
      instance-id: ${spring.cloud.client.ip-address}:${server.port}

重启config_client_1服务

访问

http://localhost:9101/config-client/product/get
响应
{"id":null,"productName":"product-pro2","status":null,"price":null,"productDesc":null,"caption":null,"inventory":null}

能正常拿到数据,说明配置正常

高可用测试

测试关闭其中一个服务,是否还可以正常提供服务

再次访问

访问依然正常,说明实现了配置中心的高可用。

总结:

  1. 服务端,添加服务注册依赖及配置,注册到eureka中,开启两个服务。

  2. 客户端,添加eureka配置,使用服务名称获取配置

  3. 测试:断开一个服务,不影响访问

消息总线刷新配置

此前,通过发起Post请求手动刷新配置,服务接口很多时,就需要发起很多次Post请求,显得很麻烦。

通过消息总线刷新配置流程如下:

配置中心--服务端

config_server服务

添加依赖

		<!--消息总线依赖-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>
		<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
        </dependency>

刷新依赖

配置application.yml

配置Spring Cloud Bus的RabbitMQ连接信息,启用Spring Cloud Bus(spring.cloud.bus.enabled=true默认已启动),同时暴露动态刷新的端点。

server:
  port: 11112
spring:
  application:
    name: config-server
  cloud:
    config:
      server:
        git:
          uri: https://gitee.com/liang_123456/config-repo.git
          default-label: master
#    bus:
#      enabled: true
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest

#开启动态刷新的端点
management:
  endpoints:
    bus-refresh:
      enabled: true
    web:
      exposure:
        include: bus-refresh

eureka:
  client:
    service-url:
      defaultZone: http://localhost:9000/eureka
    instance:
      prefer-ip-address: true
      instance-id: ${spring.cloud.client.ip-address}:${server.port}

注意:开启动态刷新端点的management要顶格写

配置中心--客户端

spring-client_1服务

和config_server一样,添加依赖,如果已经存在就不用再添加

		<!--消息总线依赖-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>
		<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
        </dependency>

刷新依赖

配置rabbitmq信息,因为是配置中心,所以在git远端仓库的配置文件配置即可,查看远端git配置文件,已经配置,如下

重启eureka、config_server和spring-client_1服务

访问

http://localhost:9101/config-client/product/get
响应
{"id":null,"productName":"product-pro2","status":null,"price":null,"productDesc":null,"caption":null,"inventory":null}

修改git远端配置

访问

http://localhost:9101/config-client/product/get
响应
{"id":null,"productName":"product-pro2","status":null,"price":null,"productDesc":null,"caption":null,"inventory":null}

响应product-pro2,说明还不是最新配置

发起Post请求, 刷新服务端配置

curl -X POST "http://localhost:11112/actuator/busrefresh"

注意:新版本发起post请求路径要改为busrefresh,而不是bus-refresh

访问

http://localhost:9101/config-client/product/get

响应
{"id":null,"productName":"product-pro3","status":null,"price":null,"productDesc":null,"caption":null,"inventory":null}

响应的数据也是product-pro3,说明使用消息总线方式刷新配置成功。 


 

完成!enjoy it!

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

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

相关文章

C++的explicit和隐式转换

隐式转换是指在某些情况下&#xff0c;编译器会自动进行类型转换&#xff0c;将一种类型的值转换为另一种类型&#xff0c;以满足表达式的要求。这种转换是隐式进行的&#xff0c;不需要显式地调用转换函数或构造函数。 int a 5; double b a; // int 到 double 的隐式转换上…

xxl-job 分布式任务调度框架

文章目录 分布式任务调度XXL-Job 简介XXL-Job 环境搭建XXL-Job (源码说明)配置部署调度中心docker安装 Bean模式任务(方法形式)-入门案例任务详解任务详解-执行器任务详解-基础配置任务详解-调度配置任务详解-基础配置任务详解-阻塞处理策略任务详解-路由策略 路由策略路由策略…

系统地自学 Python

文章目录 如何系统地自学 Python1. 选择合适的 Python 版本2. 安装 Python 和必要的工具3. 学习 Python 的基础知识4. 学习 Python 的高级特性5. Python 的应用领域6. 保持良好的学习习惯 如何系统地自学 Python Python 是一种广泛使用的编程语言&#xff0c;它具有简洁、易读、…

公众号文章采集器,免费的公众号文章采集

优质的公众号文章如同一座宝库&#xff0c;蕴含着丰富的知识和实用的信息。众多公众号纷繁复杂&#xff0c;如何高效地收集到优质文章成为许多人的难题。我们将专心分享如何收集优质公众号文章的方法&#xff0c;为您揭示收集优质文章的独门技巧。 如何高效收集公众号优质文章 …

【java智慧工地源码】智慧工地物联网云平台,实现现场各类工况数据采集、存储、分析与应用

“智慧工地整体方案”以智慧工地物联网云平台为核心&#xff0c;基于智慧工地物联网云平台与现场多个子系统的互联&#xff0c;实现现场各类工况数据采集、存储、分析与应用。通过接入智慧工地物联网云平台的多个子系统板块&#xff0c;根据现场管理实际需求灵活组合&#xff0…

【斗罗二】暗杀霍雨浩行动,马小桃霸气回击,江楠楠首秀武魂兔兔

Hello,小伙伴们&#xff0c;我是拾荒君。 《斗罗大陆Ⅱ绝世唐门》第25集更新了&#xff01;和小伙伴们一样&#xff0c;一更新&#xff0c;拾荒君就急不可待地观看这一集。故事情节高潮迭起&#xff0c;尤其是霍雨浩与王冬面对六名杀手的惊险场景&#xff0c;真是让人心跳加速…

clip-path,css裁剪函数

https://www.cnblogs.com/dzyany/p/13985939.html clip-path - CSS&#xff1a;层叠样式表 | MDN 我们看下这个例子 polygon里有四个值分别代表这四个点相对于原图左上方的偏移量。 裁剪个五角星

《算法通关村——原来滑动窗口如此简单》

《算法通关村——原来滑动窗口如此简单》 基本思想 滑动窗口的思想非常简单&#xff0c;如下图所示&#xff0c;假如窗口的大小是3&#xff0c;当不断有新数据来时&#xff0c;我们会维护一个大小为3的一个区间&#xff0c;超过3的就将新的放入老的移走。 这个过程有点像火车…

基于STC12C5A60S2系列1T 8051单片机的液晶显示器LCD1602显示功能菜单应用

基于STC12C5A60S2系列1T 8051单片机的液晶显示器LCD1602显示功能菜单应用 STC12C5A60S2系列1T 8051单片机管脚图STC12C5A60S2系列1T 8051单片机I/O口各种不同工作模式及配置STC12C5A60S2系列1T 8051单片机I/O口各种不同工作模式介绍液晶显示器LCD1602简单介绍IIC通信简单介绍掉…

将不同时间点的登录状态记录转化为不同时间段的相同登录状态SQL求解

题目 有不同时间点的登录状态记录表state_log如下 请使用sql将其转化为如下表的不同时间段的相同登录状态记录 思路分析&#xff1a; 此类问题需要用到lag或lead函数取上下行对应的数据&#xff0c;然后对前后结果做比较打标签&#xff08;0或1&#xff09;&#xff0c;再…

一文带你了解智能汽车车载网络通信安全架构2023-01-05

本文从汽车车载网络信息安全的角度出发&#xff0c;提出一种汽车车载网络通信安全架构方案&#xff0c;该方案通过构建多域分层入侵检测模型&#xff0c;实现预防—检测—预警的完整安全防护体系。 目前&#xff0c;智能化、网联化、电动化是汽车发展的大趋势&#xff0c;各大…

嵌入式 C 语言中的全局变量问题

大家好&#xff0c;今天分享一篇关于嵌入式C编程中全局变量问题的文章。希望对大家有所启发。 嵌入式特别是单片机os-less的程序&#xff0c;最易范的错误是全局变量满天飞。 这个现象在早期汇编转型过来的程序员以及初学者中常见&#xff0c;这帮家伙几乎把全局变量当作函数形…

vue 前端实现login页登陆 验证码

实现效果 // template <el-form :model"loginForm" :rules"fieldRules" ref"loginForm" label-position"left" label-width"0px" class"login-container"><span class"tool-bar"></sp…

02.PostgreSQL 查询处理期间发生了什么?

PostgreSQL 查询处理期间发生了什么&#xff1f; 文中主要内容引用自PostgreSQL指南&#xff1a;内幕探索 查询处理是PostgreSQL中最为复杂的子系统。如PostgreSQL官方文档所述&#xff0c;PostgreSQL支持SQL2011标准中的大多数特性&#xff0c;查询处理子系统能够高效地处理这…

uniapp-从后台返回的一串地址信息上,提取省市区进行赋值

1.这是接口返回的地址信息 2.要实现的效果 3.实现代码&#xff1a; <view class"address">{{item.address}}</view>listFun() {let url this.$url.url.positionInfoCompany;let param {page: this.page,limit: this.limit,keyword: this.keyword,};thi…

【概率统计】如何理解概率密度函数及核密度估计

文章目录 概念回顾浅析概率密度函数概率值为0&#xff1f;PDF值大于1&#xff1f;一个栗子 核密度估计如何理解核密度估计核密度估计的应用 总结 概念回顾 直方图&#xff08;Histogram&#xff09;&#xff1a;直方图是最直观的一种方法&#xff0c;它通过把数据划分为若干个区…

LINUX 嵌入式C编程--信号编程

基本概念 信号是事件发生时对进程的通知机制&#xff0c;也可以把它称为软件中断。信号与硬件中断的相似之处在于能够打断程序当前执行的正常流程&#xff0c;其实是在软件层次上对中断机制的一种模拟。信号提供了一种处理异步事件的方法。 信号目的 **信号的目的是用来通信…

基于深度学习的肺炎CT图像检测诊断系统

欢迎大家点赞、收藏、关注、评论啦 &#xff0c;由于篇幅有限&#xff0c;只展示了部分核心代码。 文章目录 一项目简介 二、功能三、系统四. 总结 一项目简介 深度学习在肺炎CT图像检测诊断方面具有广泛的应用前景。以下是关于肺炎CT图像检测诊断系统的介绍&#xff1a; 任务…

正确理解MySQL的MVCC及实现原理

&#xff01;首先声明&#xff0c;MySQL 的测试环境是 5.7 MVCC是MySQL实现RC(读已提交)、RR(可重复读)隔离级别的原理之一。 前提概要 什么是 MVCC 什么是当前读和快照读&#xff1f; 当前读&#xff0c;快照读和 MVCC 的关系 MVCC 实现原理 隐式字段 undo日志 Read Vie…

【linux】信号——信号保存+信号处理

信号保存信号处理 1.信号保存1.1信号其他相关概念1.2信号在内核中的表示 2.信号处理2.1信号的捕捉流程2.2sigset_t2.3信号集操作函数2.4实操2.5捕捉信号的方法 3.可重入函数4.volatile5.SIGCHLD信号 自我名言&#xff1a;只有努力&#xff0c;才能追逐梦想&#xff0c;只有努力…