001 SpringCloudAlibaba整合 - Nacos注册配置中心、Sentinel流控、Zipkin链路追踪、Admin监控

SpringCloudAlibaba

文章目录

  • SpringCloudAlibaba
    • 1.版本依赖关系
        • 2022.x 分支
        • 2021.x 分支
        • 2.2.x 分支
      • 组件版本关系
    • 2.基础项目构建
      • 1.引入全局pom文件
      • 2.创建对应的模块
    • 3.SpringBootAdmin监控服务整合
      • 1.cloud-admin服务搭建
        • 1.导入服务端依赖
        • 2.主启动类添加`@EnableAdminServer`注解启用监控
      • 2.客户端配置
        • 1.引入客户端和端点监控依赖
        • 2.配置yml
      • 3.启动测试
    • 4.Nacos注册中心、配置中心整合
      • 1.下载、安装
        • 修改启动模式
        • 创建命名空间
      • 2.注册中心整合
        • 1.引入pom服务注册发现依赖
        • 2.yml配置
        • 3.主启动类添加`@EnableDiscoveryClient`注解
        • 4.启动测试
      • 3.配置中心整合
        • 1.引入pom依赖
        • 2.yml配置
        • 3.配置nacos数据库连接
        • 4.配置中心创建yml文件
    • 5.Gateway网关整合
      • 1.添加pom依赖
      • 2.配置跨域
      • 3.yml路由配置
    • 6.Sentinel流控整合
      • 1.下载、安装
      • 2.整合
        • 1.引入pom依赖
        • 2.yml配置
        • 3.启动测试
    • 7.Sleuth、Zipkin 链路追踪整合
      • 1.下载、安装
      • 2.整合
        • 1.引入pom依赖
        • 2.配置yml
        • 3.启动测试

1.版本依赖关系

官方地址:https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E

由于 Spring Boot 3.0,Spring Boot 2.7~2.4 和 2.4 以下版本之间变化较大,目前企业级客户老项目相关 Spring Boot 版本仍停留在 Spring Boot 2.4 以下,为了同时满足存量用户和新用户不同需求,社区以 Spring Boot 3.0 和 2.4 分别为分界线,同时维护 2022.x、2021.x、2.2.x 三个分支迭代。如果不想跨分支升级,如需使用新特性,请升级为对应分支的新版本。

2022.x 分支

适配 Spring Boot 3.0,Spring Cloud 2022.x 版本及以上的 Spring Cloud Alibaba 版本按从新到旧排列如下表(最新版本用*标记): (注意,该分支 Spring Cloud Alibaba 版本命名方式进行了调整,未来将对应 Spring Cloud 版本,前三位为 Spring Cloud 版本,最后一位为扩展版本,比如适配 Spring Cloud 2022.0.0 版本对应的 Spring Cloud Alibaba 第一个版本为:2022.0.0.0,第个二版本为:2022.0.0.1,依此类推)

Spring Cloud Alibaba VersionSpring Cloud VersionSpring Boot Version
2022.0.0.0*Spring Cloud 2022.0.03.0.2
2022.0.0.0-RC2Spring Cloud 2022.0.03.0.2
2022.0.0.0-RC1Spring Cloud 2022.0.03.0.0
2021.x 分支

适配 Spring Boot 2.4,Spring Cloud 2021.x 版本及以上的 Spring Cloud Alibaba 版本按从新到旧排列如下表(最新版本用*标记):

Spring Cloud Alibaba VersionSpring Cloud VersionSpring Boot Version
2021.0.5.0*Spring Cloud 2021.0.52.6.13
2021.0.4.0Spring Cloud 2021.0.42.6.11
2021.0.1.0Spring Cloud 2021.0.12.6.3
2021.1Spring Cloud 2020.0.12.4.2
2.2.x 分支

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

Spring Cloud Alibaba VersionSpring Cloud VersionSpring Boot Version
2.2.10-RC1*Spring Cloud Hoxton.SR122.3.12.RELEASE
2.2.9.RELEASESpring Cloud Hoxton.SR122.3.12.RELEASE
2.2.8.RELEASESpring Cloud Hoxton.SR122.3.12.RELEASE
2.2.7.RELEASESpring Cloud Hoxton.SR122.3.12.RELEASE
2.2.6.RELEASESpring Cloud Hoxton.SR92.3.2.RELEASE
2.2.1.RELEASESpring Cloud Hoxton.SR32.2.5.RELEASE
2.2.0.RELEASESpring Cloud Hoxton.RELEASE2.2.X.RELEASE
2.1.4.RELEASESpring Cloud Greenwich.SR62.1.13.RELEASE
2.1.2.RELEASESpring Cloud Greenwich2.1.X.RELEASE
2.0.4.RELEASE(停止维护,建议升级)Spring Cloud Finchley2.0.X.RELEASE
1.5.1.RELEASE(停止维护,建议升级)Spring Cloud Edgware1.5.X.RELEASE

组件版本关系

每个 Spring Cloud Alibaba 版本及其自身所适配的各组件对应版本如下表所示(注意,Spring Cloud Dubbo 从 2021.0.1.0 起已被移除出主干,不再随主干演进):

Spring Cloud Alibaba VersionSentinel VersionNacos VersionRocketMQ VersionDubbo VersionSeata Version
2022.0.0.01.8.62.2.14.9.4~1.7.0
2022.0.0.0-RC21.8.62.2.14.9.4~1.7.0-native-rc2
2021.0.5.01.8.62.2.04.9.4~1.6.1
2.2.10-RC11.8.62.2.04.9.4~1.6.1
2022.0.0.0-RC11.8.62.2.1-RC4.9.4~1.6.1
2.2.9.RELEASE1.8.52.1.04.9.4~1.5.2
2021.0.4.01.8.52.0.44.9.4~1.5.2
2.2.8.RELEASE1.8.42.1.04.9.3~1.5.1
2021.0.1.01.8.31.4.24.9.2~1.4.2
2.2.7.RELEASE1.8.12.0.34.6.12.7.131.3.0
2.2.6.RELEASE1.8.11.4.24.4.02.7.81.3.0
2021.1 or 2.2.5.RELEASE or 2.1.4.RELEASE or 2.0.4.RELEASE1.8.01.4.14.4.02.7.81.3.0
2.2.3.RELEASE or 2.1.3.RELEASE or 2.0.3.RELEASE1.8.01.3.34.4.02.7.81.3.0
2.2.1.RELEASE or 2.1.2.RELEASE or 2.0.2.RELEASE1.7.11.2.14.4.02.7.61.2.0
2.2.0.RELEASE1.7.11.1.44.4.02.7.4.11.0.0
2.1.1.RELEASE or 2.0.1.RELEASE or 1.5.1.RELEASE1.7.01.1.44.4.02.7.30.9.0
2.1.0.RELEASE or 2.0.0.RELEASE or 1.5.0.RELEASE1.6.31.1.14.4.02.7.30.7.1

2.基础项目构建

1.引入全局pom文件


   <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.11</version>
        <relativePath/>
    </parent>
    <groupId>com.li</groupId>
    <artifactId>spring-cloud-alibaba-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>cloud-common</module>
        <module>cloud-picture</module>
        <module>cloud-login</module>
        <module>cloud-gateway</module>
        <module>cloud-data-clean</module>
        <module>cloud-data-production</module>
        <module>cloud-admin</module>
        <module>cloud-auth</module>
    </modules>

    <dependencies>
        <!--由于2021版本去除了-bootstrap.yml支持、所以我们要加上去-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>
    </dependencies>
  
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.6.11</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2021.0.4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2021.0.4.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <!--maven插件-->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!-- 取消查找本项目下的Main方法:为了解决Unable to find main class的问题 -->
                    <mainClass>none</mainClass>
                     <!-- 为了解决依赖模块找不到此模块中的类或属性 -->
                    <classifier>execute</classifier> 
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

2.创建对应的模块

目前创建了这些,测试用

        <module>cloud-common</module> <!--公共模块-->
        <module>cloud-picture</module><!--图片模块-->
        <module>cloud-login</module><!--登录模块-->
        <module>cloud-gateway</module><!--网关模块-->
        <module>cloud-data-clean</module>
        <module>cloud-data-production</module>
        <module>cloud-admin</module> <!--监控模块-->
        <module>cloud-auth</module><!--认证模块-->

创建启动类和yml配置文件,微服务项目yml文件名建议使用bootstrap.yml,加载优先级大于application

配置各个模块yml

server:
  port: 10000
spring:
  profiles:
    active: dev
  application:
    name: cloud-admin
    
#信息断点
info:
  tags:
    environment: cloud-admin
#日志收集
logging:
  file:
    name: ./log/admin-application.log
  pattern:
    file: '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID}){magenta} 
      %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} 
      %m%n%wEx'
    

引入各模块基础公共依赖

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${org.projectlombok.version}</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>${fastjson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>

        <!--开启自定义 配置 需要提示功能-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

3.SpringBootAdmin监控服务整合

1.cloud-admin服务搭建

1.导入服务端依赖
       <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
        </dependency>

2.主启动类添加@EnableAdminServer注解启用监控

2.客户端配置

1.引入客户端和端点监控依赖
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
        </dependency>
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

2.配置yml
spring:
  boot:
    admin:
      client:
        # Admin Server的URL,若是要注册到多个admin服务端上,用逗号分隔就可以
        # url: http://localhost:8080,http://localhost:8081
        url: http://127.0.0.1:10000
        instance:
          # 使用IP的方式
          prefer-ip: true
          #按实例显示标签
          metadata:
            tags:
              environment: cloud-auth
          
management:
  endpoint:
    health:
      show-details: always  # 显示health指标的详细信息,否则只会显示 status
      
  #暴露所有端点,生产环境不建议
  endpoints:
    web:
      exposure:
        include: ["*"]                 

3.启动测试

访问服务端:http://localhost:10000/applications/cloud-admin

4.Nacos注册中心、配置中心整合

1.下载、安装

官方文档及下载地址:https://nacos.io/download/nacos-server/?spm=5238cd80.2ef5001f.0.0.3f613b7ctaHA8j

下载完后解压

修改启动模式

如果直接启动则默认是集群方式启动会报错,需进入binstartup.cmd配置文件修改modestandalone,单结点启动

保存后双击启动即可

访问 http://localhost:8848/nacos/ ,用户名密码默认nacos,默认端口号8848

创建命名空间

点击创建即可

2.注册中心整合

1.引入pom服务注册发现依赖

对需要注册的服务模块引入

       <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>

2.yml配置
spring:
  cloud:
    nacos:
      discovery:
        # 服务注册地址
        server-addr: 127.0.0.1:8848
        #命名空间id,不配置默认为public
        # namespace: 5bd397d3-505f-44f5-95fa-a62e631b9b41
3.主启动类添加@EnableDiscoveryClient注解
4.启动测试

如果配置了命名空间则需要切换对应的空间

3.配置中心整合

1.引入pom依赖
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>

2.yml配置
spring:
  cloud:
    nacos:
      config:
        # 配置中心地址
        server-addr: 127.0.0.1:8848
        # 配置文件格式
        file-extension: yml
        # 共享配置
        shared-configs:
          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
        #命名空间配置
        namespace: 5bd397d3-505f-44f5-95fa-a62e631b9b41
        #组配置
        #group: dev
3.配置nacos数据库连接

进入nacos目录下conf下的application.properties文件进行编辑

#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
spring.datasource.platform=mysql

### Count of DB:
db.num=1

### Connect URL of DB:
 db.url.0=jdbc:mysql://xxx:3306/xxx?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
 db.user.0=root
 db.password.0=xxx

### Connection pool configuration: hikariCP
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2

数据库执行该sql文件,重启

4.配置中心创建yml文件

注意:

1.文件名必须带.yml

2.组配置可以不给,默认default_group,如果给了则需要配置group

3.后缀名根据spring的profiles的active切换

例如:有配置中心有四个文件配置,本地dev和prod配置相同

cloud-admin-dev.yml 组配置dev 配置 test:1

cloud-admin-prod.yml 组配置dev 配置 test:2

cloud-admin-prod.yml 组配置prod 配置 test:3

cloud-admin-dev.yml 组配置prod 配置 test:4

测试结果:

本地yml组配置本地spring.profiles.active配置获取test结果
devdev1
devprod2
prodprod3
proddev4

5.Gateway网关整合

1.添加pom依赖

       <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>

注意:由于网关已经包含了spring-boot-starter-web依赖,如果重复引入需排除掉

2.配置跨域

@Configuration
public class ApiCorsConfiguration {

    @Bean
    public CorsWebFilter corsWebFilter() {
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();

        CorsConfiguration corsConfiguration = new CorsConfiguration();

        //1、配置跨域
        corsConfiguration.addAllowedHeader("*");
        corsConfiguration.addAllowedMethod("*");
        corsConfiguration.addAllowedOrigin("*");
        corsConfiguration.setAllowCredentials(true);

        source.registerCorsConfiguration("/**", corsConfiguration);
        return new CorsWebFilter(source);
    }
}

3.yml路由配置

spring:
  cloud:
    gateway:
      #路由配置:转发规则
      routes:
        # id:唯一标识。默认是一个UUID
        # uri:转发路径
        # predicates:条件,用于请求网关路径的匹配规则
        - id: test_route
          uri: https://www.baidu.com
          predicates:
            - Query=url,baidu

        - id: picture_route
          uri: lb://cloud-picture
          predicates:
            - Path=/api/picture/**,/hello
          filters:
            - RewritePath=/api/(?<segment>.*),/$\{segment}

        - id: login_route
          uri: lb://cloud-login
          predicates:
            - Path=/api/login/**
          filters:
            - RewritePath=/api/(?<segment>.*),/$\{segment}

        - id: gateway-route
          uri: lb://cloud-gateway
          predicates:
            - Path=/api/gateway/**
          filters:
            - RewritePath=/api/(?<segment>.*),/$\{segment}

        - id: admin-route
          uri: lb://cloud-admin
          predicates:
            - Path=/api/admin/**
          filters:
            - RewritePath=/api/(?<segment>.*),/$\{segment}

        - id: production-route
          uri: lb://cloud-production
          predicates:
            - Path=/api/production/**
          filters:
            - RewritePath=/api/(?<segment>.*),/$\{segment}

详细配置可参考另一篇文章: SpringCloudNetflix - Feign 调用、Hystix 熔断和 Gateway 网关

https://blog.csdn.net/weixin_54158370/article/details/125165136

6.Sentinel流控整合

1.下载、安装

下载地址:https://github.com/alibaba/Sentinel/tags

本地使用版本1.8.5

下载后通过java -jar启动,输入http://localhost:8080/访问,默认账号密码sentinel

2.整合

1.引入pom依赖
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        </dependency>

2.yml配置
spring: 
  cloud:
    #监控限流
    sentinel:
      # 是否初始化时就全部加载 默认关闭,如果关闭启动时候可能会看不到服务
      eager: true
      transport:
        #通信端口 假如被占用了会自动从8719开始依次+1扫描。直至找到未被占用的端口,默认8719
        port: 8719 
        #客户端地址,默认8080
        dashboard: 127.0.0.1:8080 
3.启动测试

7.Sleuth、Zipkin 链路追踪整合

1.下载、安装

下载地址:https://repo1.maven.org/maven2/io/zipkin/zipkin-server/

1.安装启动zipkin java -jar zipkin.jar

2.访问zipkin web界面。http://localhost:9411/

2.整合

1.引入pom依赖
  <!--sleuth-zipkin-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
        </dependency>

(zipkin中已经依赖了sleuth,所以可以不导)

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>

2.配置yml
spring:
  sleuth:
    web:
      client:
        # 开启采集链路
        enabled: true
    sampler:
      # 默认采集是 0.1(百分之十),生产环境采用默认,测试环境可以修改为1.0
      probability: 1.0

  # zipkin服务所在地址
  zipkin:
    base-url: http://127.0.0.1:9411/
    discovery-client-enabled: false #让nacos把它当成一个URL,而不要当做服务名
3.启动测试

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

电动汽车电池监测平台系统设计(论文+源码+图纸)

1总体设计 本次基于单片机的电池监测平台系统设计&#xff0c;其整个系统架构如图2.1所示&#xff0c;其采用STC89C52单片机作为控制器&#xff0c;结合ACS712电流传感器、TLC1543模数转换器、LCD液晶、DS18B20温度传感器构成整个系统&#xff0c;在功能上可以实现电压、电流、…

DeepSeek从入门到精通:提示词设计的系统化指南

目录 引言&#xff1a;AIGC时代的核心竞争力 第一部分 基础篇&#xff1a;提示词的本质与核心结构 1.1 什么是提示词&#xff1f; 1.2 提示词的黄金三角结构 第二部分 类型篇&#xff1a;提示词的六大范式 2.1 提示语的本质特征 2.2 提示语的类型 2.2.1 指令型提示词 …

【VB语言】EXCEL中VB宏的应用

【VB语言】EXCEL中VB宏的应用 文章目录 [TOC](文章目录) 前言一、EXCEL-VB1.实验过程2.代码 二、EXCEL-VB 生成.c.h文件1.实验过程2.代码 四、参考资料总结 前言 1.WPS-VB扩展包 提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考 一、EXCEL-VB 1.实验过…

Redis7.0八种数据结构底层原理

导读 本文介绍redis应用数据结构与物理存储结构,共八种应用数据结构和 一. 内部数据结构 1. sds sds是redis自己设计的字符串结构有以下特点: jemalloc内存管理预分配冗余空间二进制安全(c原生使用\0作为结尾标识,所以无法直接存储\0)动态计数类型(根据字符串长度动态选择…

NixHomepage - 简单的个人网站

&#x1f4bb; NixHomepage - 简单的个人网站 推荐下个人的开源项目&#xff0c;演示网站&#xff0c;项目链接 https://github.com/nixgnauhcuy/NixHomepage&#xff0c;喜欢的话可以为我的项目点个 Star~ &#x1f4f7; 预览 ⚙️ 功能特性 多平台适配 明亮/暗黑模式切换 W…

给压缩文件加密码的5种方法(win/mac/手机/网页端)

把文件加密压缩&#xff0c;一方面能有效保护个人隐私与敏感信息&#xff0c;防止数据在传输或存储过程中被窃取、篡改。另一方面&#xff0c;压缩文件可减少存储空间占用&#xff0c;提升传输速度&#xff0c;方便数据的存储与分享。以下为你介绍5种常见的加密压缩方法。 一、…

如何通过AI轻松制作PPT?让PPT一键生成变得简单又高效

如何通过AI轻松制作PPT&#xff1f;让PPT一键生成变得简单又高效&#xff01;在这个信息化飞速发展的时代&#xff0c;PPT已经成为我们日常工作、学习和生活中不可或缺的一部分。无论是公司会议、学术报告&#xff0c;还是个人展示&#xff0c;PPT的作用都不容忽视。很多人对于…

Linux之【网络I/O】前世今生(二)

前文回顾 通过学习 Linux之【网络I/O】前世今生&#xff08;一&#xff09;&#xff0c;我们知道了I/O 请求可以分为两个阶段&#xff0c;分别为 I/O 调用和 I/O 执行&#xff1a; I/O 调用 即用户进程向内核发起系统调用(通过 0x80 中断)。 I/O 执行 内核等待 I/O 请求处理完…

Redis未授权访问漏洞导致getshell

一、漏洞信息 redis默认情况下会绑定在本地6379端口&#xff0c;如果没有进行采用相关的策略&#xff0c;就会将redis服务暴露到公网上&#xff0c;如果再没有设置密码认证(一般为空)的情况下&#xff0c;会导致任意用户可以访问到目标服务器的情况下未授权访问redis以及读取r…

伯克利 CS61A 课堂笔记 08 —— Strings and Dictionaries

本系列为加州伯克利大学著名 Python 基础课程 CS61A 的课堂笔记整理&#xff0c;全英文内容&#xff0c;文末附词汇解释。 目录 01 Strings 字符串 Ⅰ Strings are An Abstraction. Ⅱ Strings Literals have Three Forms Ⅲ String are Sequences 02 Dictionaries 字典 …

【Stable Diffusion模型测试】测试ControlNet,没有线稿图?

相信很多小伙伴跟我一样&#xff0c;在测试Stable Diffusion的Lora模型时&#xff0c;ControlNet没有可输入的线稿图&#xff0c;大家的第一反应就是百度搜&#xff0c;但是能从互联网上搜到的高质量线稿图&#xff0c;要么收费&#xff0c;要么质量很差。 现在都什么年代了&a…

智能手表表带圆孔同心度检测

在智能手表的制造工艺中&#xff0c;表带圆孔同心度检测是确保产品品质的关键环节。精准的同心度不仅关乎表带与表体的完美适配&#xff0c;更直接影响用户的佩戴舒适度和产品的整体美观度。稍有偏差&#xff0c;就可能导致表带安装困难、佩戴时出现晃动&#xff0c;甚至影响智…

基于SSM+uniapp的数学辅导小程序+LW示例参考

1.项目介绍 系统角色&#xff1a;管理员、普通用户功能模块&#xff1a;用户管理、学习中心、知识分类管理、学习周报管理、口算练习管理、试题管理、考试管理、错题本等技术选型&#xff1a;SSM&#xff0c;Vue&#xff08;后端管理web&#xff09;&#xff0c;uniapp等测试环…

基于 openEuler 构建 LVS-DR 群集

一、 对比 LVS 负载均衡群集的 NAT 模式和 DR 模式&#xff0c;比较其各自的优势 。 二、 基于 openEuler 构建 LVS-DR 群集。 一 NAT 模式 部署简单&#xff1a;NAT 模式下&#xff0c;所有的服务器节点只需要连接到同一个局域网内&#xff0c;通过负载均衡器进行网络地址转…

JS设计模式之单例原型

那么单例模式都有哪些应用场景呢&#xff1f;如何通过构造函数创建单例如何使用模块化的方式创建总结 各位老铁们&#xff0c;今天我们介绍一下JS中单例设计模式&#xff0c;它的特点是确保一个类只有一个实例&#xff0c;并提供一个全局访问点来获取该实例&#xff08;无论被创…

vue+springboot+webtrc+websocket实现双人音视频通话会议

前言 最近一些时间我有研究&#xff0c;如何实现一个视频会议功能&#xff0c;但是找了好多资料都不太理想&#xff0c;最终参考了一个文章 WebRTC实现双端音视频聊天&#xff08;Vue3 SpringBoot&#xff09; 只不过&#xff0c;它的实现效果里面只会播放本地的mp4视频文件&…

Linux 基础IO——重定向和缓冲区

目录 一、重定向 1、重定向的本质 2、使用 dup2 系统调用 &#xff08;1&#xff09;输出重定向 &#xff08;2&#xff09;追加重定向 (3) 输入重定向 ​ 二、缓冲区 1.理解缓冲区 2.缓冲区刷新问题 3.为什么要有缓冲区&#xff1f; 4.这个缓冲区在哪里&#xff…

14、deepseek视觉大模型Janus Pro本地部署及实战

1、简介 2025.01.27&#xff1a; Janus-Pro发布&#xff0c;Janus的高级版本&#xff0c;显著提高了多模态理解和视觉生成。 Janus-Pro 是 Janus 的高级版本。具体来说&#xff0c; Janus-Pro 包括以下改进&#xff1a;优化的训练策略、 扩展的训练数据以及更大规模的模型。通…

【第3章:卷积神经网络(CNN)——3.1 CNN的基本结构与工作原理】

嘿,小伙伴们,今天咱们来聊聊深度学习里的一大明星——卷积神经网络(CNN)。这东西在图像识别、视频处理等领域简直不要太火,甚至人脸识别、物体检测这些高大上的应用,都离不开它的身影。废话不多说,咱们这就开聊! 一、CNN是什么东东? 在人工智能领域,卷积神经网络(…

VMware Workstate 的 Ubuntu18 安装 vmware tools(不安装没法共享)

在共享主机路径后&#xff0c;可以在&#xff1a; /mnt/hgfs/下方找到共享的文件。但没有安装vmware tool时是没法共享的。 如何安装vmware tool&#xff0c;网上版本很多。这里记录一下&#xff1a; VMware Workstation 17 Pro&#xff0c;版本&#xff1a;17.6.0 虚拟机系统…