sentinel持久化方案

news2024/10/2 12:17:59

一.sentinel规则推送原理

1.原有内存规则存储原理

(1)dashborad中请求到服务器后,在controller中通过http把规则直接推送给client,client接收后把规则放入内存;

2.持久化推送规则原理

![在这里插入代码片](https://img-blog.csdnimg.cn/16a99e8e725a4eb6a7011f36ec7f70e0.png)

一.sentinel持久化改造

1.改造dashboard

(1)sentinel提供了持久化方案的数据源,将 test 这一行注释掉

<!-- for Nacos rule publisher sample -->
        <dependency>
            <groupId>com.alibaba.csp</groupId>
            <artifactId>sentinel-datasource-nacos</artifactId>
            <version>${sentinel.project.version}</version>
<!--            <scope>test</scope>-->
        </dependency>

(2)引入nacos配置中心和注册中心

 <!-- Nacos注册中心 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>
        <!-- Nacos配置中心 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>

(3)添加远程来取配置的bean

在这里插入图片描述

(3)添加从远程配置中心拉取规则

1./v1/flow/rules(GET)请求中把”从客户端内存获取规则配置“修改成”从远程配置中心获取规则配置“

![在这里插入图片描述](https://img-blog.csdnimg.cn/38054ed9356b4e40a355d45079590389.png在这里插入图片描述

2.从nacos中拉取配置,DynamicRuleProvider实现这个接口用来拉取配置的扩展接口,List泛型类list表示配置有多条FlowRuleEntity返回到控制台的实体信息,注入ConfigService配置中心的核心接口,这里从nacos拉到的数组对象是FlowRule,所以需要通过”FlowRuleEntity.fromFlowRule(appName,ip,port,rule))“转换成FlowRuleEntity;

![在这里插入图片描述](https://img-blog.csdnimg.cn/c1289d8c77364744a9cc509754fde0e1.png在这里插入图片描述

(4)将控制台添加的规则信息推送到nacos中

1./v1/flow/rule(POST)请求中把“发布规则到客户端内存中”修改成“发布规则到远程配置中心”

在这里插入图片描述
在这里插入图片描述

2.把dashboard服务内存中的配置推送到nacos中,DynamicRulePublisher实现这个接口用来推送配置的扩展接口,List泛型类list表示配置有多条FlowRuleEntity返回到控制台的实体信息,注入ConfigService配置中心的核心接口,这里推送打nacos中的对象是FlowRule,所以需要通过”NacosConfigUtil.convertToRule(rules)“转换成FlowRule;

在这里插入图片描述
在这里插入图片描述

(5)将控制台添加的规则信息推送到nacos中如果是Gateway网关则需要该如下两个类

![在这里插入图片描述](https://img-blog.csdnimg.cn/1ba449a40e5c4ae29b7c8a87a7714286.png
在这里插入图片描述

(5)注入nacos操作配置中心的核心bean ConfigService和FlowRuleEntity与FlowRule转换工具类

在这里插入图片描述

/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * 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.
 */
package com.alibaba.csp.sentinel.dashboard.rule.nacos;

import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.config.ConfigFactory;
import com.alibaba.nacos.api.config.ConfigService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * @author Fox
 */
@Configuration
public class NacosConfig {

    @Value("${spring.cloud.nacos.discovery.server-addr}")
    private String serverAddr;

    @Value("${spring.cloud.nacos.discovery.username}")
    private String username;

    @Value("${spring.cloud.nacos.discovery.password}")
    private String password;

    @Value("${spring.cloud.nacos.discovery.namespace:}")
    private String namespace;
    
    @Bean
    public ConfigService nacosConfigService() throws Exception {
//        return ConfigFactory.createConfigService(serverAddr);
        Properties properties = new Properties();
        properties.setProperty(PropertyKeyConst.SERVER_ADDR, serverAddr);
        properties.setProperty(PropertyKeyConst.USERNAME, username);
        properties.setProperty(PropertyKeyConst.PASSWORD, password);
        if (!StringUtils.isEmpty(namespace)) {
            properties.setProperty(PropertyKeyConst.NAMESPACE, namespace);
        }
        return ConfigFactory.createConfigService(properties);
    }

    
}

/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * 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.
 */
package com.alibaba.csp.sentinel.dashboard.rule.nacos;

import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.ApiDefinitionEntity;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.gateway.GatewayFlowRuleEntity;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Fox
 */
public final class NacosConfigUtil {

    public static final String GROUP_ID = "SENTINEL_GROUP";
    
    public static final String FLOW_DATA_ID_POSTFIX = "-flow-rules";
    public static final String PARAM_FLOW_DATA_ID_POSTFIX = "-param-flow-rules";
    public static final String DEGRADE_DATA_ID_POSTFIX = "-degrade-rules";
    public static final String SYSTEM_DATA_ID_POSTFIX = "-system-rules";
    public static final String AUTHORITY_DATA_ID_POSTFIX = "-authority-rules";
    public static final String GATEWAY_FLOW_DATA_ID_POSTFIX = "-gateway-flow-rules";
    public static final String GATEWAY_API_DATA_ID_POSTFIX = "-gateway-api-rules";

    public static final String CLUSTER_MAP_DATA_ID_POSTFIX = "-cluster-map";

    /**
     * cc for `cluster-client`
     */
    public static final String CLIENT_CONFIG_DATA_ID_POSTFIX = "-cc-config";
    /**
     * cs for `cluster-server`
     */
    public static final String SERVER_TRANSPORT_CONFIG_DATA_ID_POSTFIX = "-cs-transport-config";
    public static final String SERVER_FLOW_CONFIG_DATA_ID_POSTFIX = "-cs-flow-config";
    public static final String SERVER_NAMESPACE_SET_DATA_ID_POSTFIX = "-cs-namespace-set";
    
    //超时时间
    public static final int READ_TIMEOUT = 3000;

    private NacosConfigUtil() {}
    
    
    /**
     * RuleEntity----->Rule
     * @param entities
     * @return
     */
    public static String convertToRule(List<? extends RuleEntity> entities){
        return JSON.toJSONString(
                entities.stream().map(r -> r.toRule())
                        .collect(Collectors.toList()));
    }
    
    /**
     * ApiDefinitionEntity----->ApiDefinition
     * @param entities
     * @return
     */
    public static String convertToApiDefinition(List<? extends ApiDefinitionEntity> entities){
        return JSON.toJSONString(
                entities.stream().map(r -> r.toApiDefinition())
                        .collect(Collectors.toList()));
    }
    
    /**
     * GatewayFlowRuleEntity----->GatewayFlowRule
     * @param entities
     * @return
     */
    public static String convertToGatewayFlowRule(List<? extends GatewayFlowRuleEntity> entities){
        return JSON.toJSONString(
                entities.stream().map(r -> r.toGatewayFlowRule())
                        .collect(Collectors.toList()));
    }



}

(5)dashboard配置文件修改

1.添加bootstrap.yml配置文件

spring:
  cloud:
    nacos:
      discovery:
        server-addr: 127.0.0.1:8848
        username: nacos
        password: nacos
        namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
        # group: DEFAULT_GROUP
      config:
        server-addr: 127.0.0.1:8848
        username: nacos
        password: nacos
        namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
        # group: DEFAULT_GROUP
        file-extension: yml  # 必须修改成对应尾序
        refresh-enabled: true
  profiles:
    active: dev
  application:
    name: scm-sentinel-dashboard

2.nacos中添加scm-sentinel-dashboard-dev.yml配置文件,这里是将原来的application.properties配置放入到nacos配置中心中管理

server:
  port: 8099
  max-http-header-size: 10240
  tomcat:
    uri-encoding: UTF-8
    min-spare-threads: 50
    max-threads: 500
    max-connections: 3000
    accept-count: 10000
    connection-timeout: 12000
  servlet:
    encoding:
      force: true
      charset: UTF-8
      enabled: true
    session: 
      cookie: 
      name: sentinel_dashboard_cookie
logging: 
  level: 
    org: 
      springframework: 
        web: INFO
  file:
    # name: ${user.home}/logs/csp/sentinel-dashboard.log
    name: /mnt/server-log/scm-sentinel-dashboard/sentinel-dashboard.log
  pattern: 
    file: '%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n'
auth: 
  filter: 
    exclude-urls: /,/auth/login,/auth/logout,/registry/machine,/version
    exclude-url-suffixes: htm,html,js,css,map,ico,ttf,woff,png
  username: sentinel
  password: sentinel

sentinel: 
  dashboard: 
    version: '@project.version@'

2.改造client

1.gateway网关改造

(1)引入pom依赖

<!-- gateway接入sentinel  -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
            <version>${spring.cloud.alibaba.version}</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
            <version>${spring.cloud.alibaba.version}</version>
        </dependency>

        <!--sentinel持久化 -->
        <dependency>
            <groupId>com.alibaba.csp</groupId>
            <artifactId>sentinel-datasource-nacos</artifactId>
            <version>1.8.4</version>
        </dependency>

(2)配置文件bootstrap.yml

spring:
  cloud:
    nacos:
      discovery:
        server-addr: 127.0.0.1:8848
        username: nacos
        password: nacos
        namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
        # group: DEFAULT_GROUP
      config:
        server-addr: 127.0.0.1:8848
        username: nacos
        password: nacos
        namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
        # group: DEFAULT_GROUP
        file-extension: yml  # 必须修改成对应尾序
        refresh-enabled: true
        shared-configs[0]:
          data-id: scm-gateway-sentinel.yml
          refresh: true
  profiles:
    active: dev
  application:
    name: scm-open-gateway

(2)nacos中的配置文件scm-gateway-sentinel.yml,这里面的spring.application.name对象项目名称,注意rule-type表示流控类型

spring:
  cloud:
    nacos:
    sentinel:
      transport:
        dashboard: 127.0.0.1:8099
      # 该配置能够使dashboard主动发现该应用
        eager: true
      datasource:
        gateway-api:
          nacos:
            server-addr: ${spring.cloud.nacos.discovery.server-addr}
            dataId: ${spring.application.name}-gateway-api-rules
            groupId: SENTINEL_GROUP   # 注意groupId对应Sentinel Dashboard中的定义
            namespace: ${spring.cloud.nacos.discovery.namespace}
            data-type: json
            rule-type: gw-api-group
        flow-rules:
          nacos:
            server-addr: ${spring.cloud.nacos.discovery.server-addr}
            dataId: ${spring.application.name}-gateway-flow-rules
            groupId: SENTINEL_GROUP   # 注意groupId对应Sentinel Dashboard中的定义
            namespace: ${spring.cloud.nacos.discovery.namespace}
            data-type: json
            rule-type: flow
        degrade-rules:
          nacos:
            server-addr: ${spring.cloud.nacos.discovery.server-addr}
            dataId: ${spring.application.name}-gateway-degrade-rules
            groupId: SENTINEL_GROUP
            namespace: ${spring.cloud.nacos.discovery.namespace}
            data-type: json
            rule-type: degrade
        param-flow-rules:
          nacos:
            server-addr: ${spring.cloud.nacos.discovery.server-addr}
            dataId: ${spring.application.name}-gateway-param-flow-rules
            groupId: SENTINEL_GROUP
            namespace: ${spring.cloud.nacos.discovery.namespace}
            data-type: json
            rule-type: param-flow
        authority-rules:
          nacos:
            server-addr: ${spring.cloud.nacos.discovery.server-addr}
            dataId: ${spring.application.name}-gateway-authority-rules
            groupId: SENTINEL_GROUP
            namespace: ${spring.cloud.nacos.discovery.namespace}
            data-type: json
            rule-type: authority
        system-rules:
          nacos:
            server-addr: ${spring.cloud.nacos.discovery.server-addr}
            dataId: ${spring.application.name}-gateway-system-rules
            groupId: SENTINEL_GROUP
            namespace: ${spring.cloud.nacos.discovery.namespace}
            data-type: json
            rule-type: system

(3) rule-type: gw-api-group对应的是网关中的API管理,这里用来与流控规则中API分钟的API名称对应

在这里插入图片描述
在这里插入图片描述

2.普通服务改造

(1)添加pom依赖

 <!-- nacos服务注册与发现 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>


    
        <!-- openfeign 远程调用 -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
        </dependency>


        <!--sentinel -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        </dependency>

(1)添加bootstrap.yml流控规则nacoa配置和sentinel控制台连接配置

server:
  port: 8806

spring:
  application:
    name: mall-user-sentinel-rule-push-demo  #微服务名称
  #配置nacos注册中心地址
  cloud:
    nacos:
      discovery:
        server-addr: 127.0.0.1:8848
        username: nacos
        password: nacos
        namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c

    sentinel:
      transport:
        # 添加sentinel的控制台地址
        dashboard: 127.0.0.1:8099
        # 指定应用与Sentinel控制台交互的端口,应用本地会起一个该端口占用的HttpServer
        #port: 8719
      datasource:
#        ds1:   #名称自定义,唯一
#          nacos:
#            server-addr: 127.0.0.1:8848
#            dataId: ${spring.application.name}-flow
#            groupId: DEFAULT_GROUP
#            data-type: json
#            rule-type: flow
        flow-rules:
          nacos:
            server-addr: 127.0.0.1:8848
            dataId: ${spring.application.name}-flow-rules
            groupId: SENTINEL_GROUP   # 注意groupId对应Sentinel Dashboard中的定义
            namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
            data-type: json
            rule-type: flow
        degrade-rules:
          nacos:
            server-addr: 127.0.0.1:8848
            dataId: ${spring.application.name}-degrade-rules
            groupId: SENTINEL_GROUP
            namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
            data-type: json
            rule-type: degrade
        param-flow-rules:
          nacos:
            server-addr: 127.0.0.1:8848
            dataId: ${spring.application.name}-param-flow-rules
            groupId: SENTINEL_GROUP
            namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
            data-type: json
            rule-type: param-flow
        authority-rules:
          nacos:
            server-addr: 127.0.0.1:8848
            dataId: ${spring.application.name}-authority-rules
            groupId: SENTINEL_GROUP
            namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
            data-type: json
            rule-type: authority
        system-rules:
          nacos:
            server-addr: 127.0.0.1:8848
            dataId: ${spring.application.name}-system-rules
            groupId: SENTINEL_GROUP
            namespace: c5b4bd27-4a9c-487f-b3fb-c6a768ee224c
            data-type: json
            rule-type: system

  main:
    allow-bean-definition-overriding: true

#暴露actuator端点   http://localhost:8800/actuator/sentinel
management:
  endpoints:
    web:
      exposure:
        include: '*'


feign:
  sentinel:
    enabled: true   #开启sentinel对feign的支持 默认false

3.持久化源码

(1)NacosDataSource:

1.NacosDataSource:自定义的nacos数据源类,继承了AbstractDataSource抽象类是sentinel的持久化数据源的父类,用于持久化扩展;
2.NacosDataSource.readSource()->configService.getConfig()方法读取nacos中的配置;
3.NacosDataSource 构造器-> this.configListener = new Listener() -> receiveConfigInfo()方法,当dashboard中改变配置后,dashboard服务会降配置先推送到nacos配置中心,然后nacos中的规则数据感知到变化后nacos配置中心会发布这个监听事件,此监听器就会监听到最新配置的变化然后更新本地缓存的配置达到实时更新的目的;(注意配置没用变化是不会触发监听事件)

(2)FlowRuleManager:流控规则管理类,负责加载流控规则;

(3)ConfigService是用来拿到nacos配置中心bean对象,使用configService.publishConfig()推送sentinel持久化数据到nacos中心;试用ConfigFactory.createConfigService(properties)创建ConfigService;

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

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

相关文章

质量保障体系建设演进案例

在业务早期发展阶段&#xff0c;主要是产品驱动、研发和测试互相配合。不同的测试方法是验证和保障交付质量的手段&#xff0c;而不是构建质量体系的基石。测试的努力带来的更多是一些“安全感”&#xff0c;而非安全保障。因此&#xff0c;要做到高质量的交付&#xff0c;就需…

k8s简单搭建

前言 最近学习k8s&#xff0c;跟着网上各种教程搭建了简单的版本&#xff0c;一个master节点&#xff0c;两个node节点&#xff0c;这里记录下防止以后忘记。 具体步骤 准备环境 用Oracle VM VirtualBox虚拟机软件安装3台虚拟机&#xff0c;一台master节点&#xff0c;两台…

Wails简介

https://wails.io/zh-Hans/docs/introduction 简介 Wails 是一个可让您使用 Go 和 Web 技术编写桌面应用的项目。 将它看作为 Go 的快并且轻量的 Electron 替代品。 您可以使用 Go 的灵活性和强大功能&#xff0c;结合丰富的现代前端&#xff0c;轻松的构建应用程序。 功能…

mac上安装mysql

mac上安装mysql1. 关于Linux上安装mysql2. 下载安装2.1 下载2.2 安装3. 客户端连接mysql3.1 先查看mysql服务3.2 连接mysql客户端3.2.1 终端使用命令连接3.2.2 可视化工具连接3.3 其他简单操作&#xff08;启动服务等&#xff09;3.3.1 可视化界面操作4. 配置环境变量4.1 配置环…

视图、索引、存储过程、触发器

视图、索引、存储过程、触发器 group by补充&#xff1a; 规范来说&#xff0c;分组查询中&#xff0c;select后的字段只能是group by的字段或者是聚合函数。mysql在这有一个小优化&#xff0c;分组后如果某个字段的所有记录相同&#xff0c;同样可以select。 视图 视图是虚拟…

一文详解java.nio.ByteBuffer

java.nio.ByteBuffer是一个可以进行缓冲区分配、读取和写入的缓冲区&#xff0c;其持有一个字节数组&#xff0c;并通过4个属性&#xff1a;capacity、limit、position、mark来管理缓冲区&#xff0c;进行字节级别读取和数据写入。基于此&#xff0c;ByteBuffer常被用来处理网络…

MySql数据库约束

概述、目的 概念&#xff1a;约束是作用于表中字段上的规则&#xff0c;用于限制存储在表中的数据。 目的&#xff1a;保证数据库中数据的正确性、有效性和完整性。 分类&#xff1a; 约束描述关键字非空约束限制该字段的数据不能为nullNOT NULL唯一约束保证该字段的所有数据都…

【闲聊杂谈】高并发下基于LVS的负载均衡

1、使用http协议进行网络请求 在前几年公布的用户入网数据中&#xff0c;移动入网的数量已经达到六七亿的规模&#xff0c;固网用户数也达到三至五个亿。想要解决这么大并发访问的场景&#xff0c;有多种的解决方案&#xff0c;常规有基于4层的&#xff0c;也有基于7层的。这个…

ChatGPT提示语编写指南

ChatGPT AI 对话模型自 2022 年 11 月下旬开始可用&#xff0c;此后用户一直在探索聊天机器人的局限性和功能。 然而&#xff0c;OpenAI 也在不断地进行调整&#xff0c;因此 ChatGPT 处于不断变化的状态。 但是我们在这个小指南中描述的提示应该是永恒的。 要获得想要的结果&…

SqlSession 和 SqlSessionTemplate 简单使用及注意事项

1、SqlSession 简单使用 先简单说下 SqlSession 是什么&#xff1f;SqlSession 是对 Connection 的包装&#xff0c;简化对数据库操作。所以你获取到一个 SqlSession 就相当于获取到一个数据库连接&#xff0c;就可以对数据库进行操作。 SqlSession API 如下图示&#xff1a;…

基于 CentOS7 的 KVM 部署 + 虚拟机创建

目录一、实验环境二、部署 KVM三、创建虚拟机四、远程管理 KVM 虚拟机FAQ一、实验环境 实验环境&#xff1a;VMware Workstation 16 Pro 打开虚拟机之前&#xff0c;首先开启 VMware Workstation Pro 16 上的硬件辅助虚拟化功能&#xff0c;如下图所示&#xff1a; 二、部署 …

Spring Cloud Gateway集成Nacos实现负载均衡

&#x1f4a1;Nacas可以用于实现Spring Cloud Gateway中网关动态路由功能&#xff0c;也可以基于Nacos来实现对后端服务的负载均衡&#xff0c;前者利用Nacos配置中心功能&#xff0c;后者利用Nacos服务注册功能。接下来我们来看下Gateway集成Nacos实现负载均衡的架构图一. 环境…

为什么现代企业发展离不开CRM系统的助力

如今的CRM系统对于任何企业来说都重要&#xff0c;因为它能帮助企业收获新客户&#xff0c;保留现有客户&#xff0c;并且将不同部门的信息全部汇集&#xff0c;实时提供关于每位客户整体全面的看法。因此&#xff0c;销售、市场营销和客户支持等领域的客户直接服务员工能够做出…

VHDL-延迟模型-惯性延迟与传输延迟

目录 1&#xff0c;惯性延时 2&#xff0c;传输延时 信号通过元件都会有延迟&#xff0c;延迟时间的计算是逻辑仿真的重要功能。考虑延迟信息得到的仿真输出波形可以更精确地反映实际电路的情况。针对元件的延时&#xff0c;人们根据需要建立了一些用的延时模型&#xff0c;这…

集成电路相关书籍

注&#xff1a;从此开始&#xff0c;文中提到的书籍都会在公众号对应文章末尾给出链接&#xff0c;不需要在微信后台获取&#xff0c;当然还是可以通过在微信后台回复相关书名获取对应的电子书。 在后台看到很多人回复集成电路相关的一些书籍&#xff0c;所以本文就提供一些书籍…

GD库图片裁剪指定形状解决办法(PHP GD库 海报)

需求描述&#xff1a;需要把图片裁剪成一个指定的平行四边形&#xff0c;目的是使用GD库&#xff0c;把裁剪后的图片放在底图上面&#xff0c;使最终合成的图片看起来是一个底图平行四边形的样子提示&#xff1a;可以结合本作者的其他文章&#xff0c;来生成一个定制化的海报&a…

【项目精选】基于Javaee的影视创作论坛的设计与实现(视频+论文+源码)

点击下载源码 基于Javaee的影视创作论坛的设计与实现主要用功能包括&#xff1a; 首页推荐、用户管理、影片管理、评论管理、 预告片管理、海报管理、公告管理、数据检索、用户注册与登录等等功能、统结构如下 &#xff08;1&#xff09;后台管理: 管理模块&#xff1a;管理员…

vscode编程小插件之Doxygen和Better Align

一、插件Doxygen:配置相应文件、函数说明项。 1、扩展商店&#xff0c;搜索Doxygen&#xff0c;如下图1&#xff0c;安装。 图1 2、设置项中&#xff0c;选择扩展设置&#xff0c;如图2 图2 3、配置版本、作者邮箱、作者名称、日期格式等等&#xff0c;如图3 4、定义函数后&…

DM8:DMDSC共享存储集群搭建-实例初始化(待完成)

DM8:DMDSC共享存储集群搭建-实例初始化1 环境介绍2 使用 DMASMCMD 工具初始化磁盘3 各个节点先后分别启动 dmcss3.1 EP733.2 EP744 各个节点先后分别启动 dmasmsvr 程序4.1 EP734.2 EP745 使用 dmasmtool 工具创建 DMASM 磁盘组(在一个节点执行)6 使用 dminit 初始化 DB 实例环…

STM32定时器实现红外接收与解码

1.NEC协议 红外遥控是一种比较常用的通讯方式&#xff0c;目前红外遥控的编码方式中&#xff0c;应用比较广泛的是NEC协议。NEC协议的特点如下&#xff1a; 载波频率为 38KHz8位地址和 8位指令长度地址和命令2次传输&#xff08;确保可靠性&#xff09;PWM 脉冲位置调制&#…