SpringCloud之服务治理Eureka

news2024/10/6 20:33:08

1.服务注册和发现是什么意思?Spring Cloud 如何实现?

服务注册和发现的意思是服务进程在注册中心注册自己的位置,客户端应用进程向注册中心发起查询,来获取服务的位置,服务发现的一个重要作用就是提供一个可用的服务列表。

简单来说,当服务A需要依赖服务B时,我们就需要告诉服务A,哪里可以调用到服务B,这就是服务注册发现要解决的问题。

SpringCloud通过eureka实现服务注册和发现。由于所有服务都在 Eureka 服务器上注册并通过调用 Eureka 服务器完成查找,因此无需处理服务地点的任何更改 和处理。

2.什么是Eureka

Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现。也是springcloud体系中最重要最核心的组件之一。管理的服务包含了Spring Cloud的其他服务组件如:熔断、负载、降级等。

以往服务间资源的获取都是通过相互调用,比如A获取B相关资源,A调用B提供的API获取相关资源 。加入Eureka之后,则B提供服务资源需要在Eureka服务中心注册一遍,A获取服务资源也需要在Eureka服务中心注册一遍,从而获取B服务的资源。监控Eureka服务中心可以监控AB服务调用的使用情况。

  • Eureka 是 Netflix 公司开源的一个服务注册与发现的组件 。
  • Eureka 和其他 Netflix 公司的服务组件(例如负载均衡、熔断器、网关等) 一起,被 Spring Cloud 社区整合为Spring-Cloud-Netflix 模块。
  • Eureka 包含两个组件:Eureka Server (注册中心) 和 Eureka Client (服务提供者、服务消费者)。

3.Eureka快速入门

Eureka学习步骤

  1. 搭建 Provider 和 Consumer 服务。
  2. 使用 RestTemplate 完成远程调用。
  3. 搭建 Eureka Server 服务。
  4. 改造 Provider 和 Consumer 称为 Eureka Client。
  5. Consumer 服务 通过从 Eureka Server 中抓取 Provider地址完成远程调用

3.1环境搭建

在这里插入图片描述

3.1.1创建父工程

创建module -父工程 Spring-cloud-parent,创建后的目录结构(删除src)
在这里插入图片描述
Spring-cloud-parent pom.xml

	<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/>
    </parent>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

3.1.2创建服务提供者

创建服务提供者eureka-provider
在这里插入图片描述目录结构:
在这里插入图片描述
GoodsController

import com.cn.provider.domain.Goods;
import com.cn.provider.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//服务的提供方
@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @GetMapping("/findOne/{id}")
    public Goods findOne(@PathVariable("id") int id){
        Goods goods = goodsService.findOne(id);
        return goods;
    }
}

GoodsDao

/**
 * 商品Dao
 */

@Repository
public class GoodsDao {

    public Goods findOne(int id){
        return new Goods(1,"华为手机",3999,10000);
    }
}

Goods

/**
 * 商品实体类
 */
public class Goods {
    private int id;
    private String title;//商品标题
    private double price;//商品价格
    private int count;//商品库存

    public Goods() {
    }

    public Goods(int id, String title, double price, int count) {
        this.id = id;
        this.title = title;
        this.price = price;
        this.count = count;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "Goods{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", price=" + price +
                ", count=" + count +
                '}';
    }
}

GoodsService

import com.cn.provider.dao.GoodsDao;
import com.cn.provider.domain.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GoodsService {

    @Autowired
    private GoodsDao goodsDao;

    /**
     * 根据id查询
     * @param id
     * @return
     */
    public Goods findOne(int id){
        return goodsDao.findOne(id);
    }

}

ProviderApp

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

@SpringBootApplication
public class ProviderApp {
    public static void main(String[] args) {
        SpringApplication.run(ProviderApp.class,args);
    }
}

eureka-provider pom.xml

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

    </dependencies>

3.1.3创建服务消费者

创建服务消费者eureka-consumer
在这里插入图片描述目录结构
在这里插入图片描述OrderController

import com.cn.consumer.domain.Goods;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//服务调用方
@RestController
@RequestMapping("/order")
public class OrderController {

    @GetMapping("/goods/{id}")
    public Goods findGoodsById(@PathVariable("id") int id){
        System.out.println("findGoodsByid.."+id);

        return null;
    }
}

Goods

/**
 * 商品实体类
 */
public class Goods {
    private int id;
    private String title;//商品标题
    private double price;//商品价格
    private int count;//商品库存

    public Goods() {
    }

    public Goods(int id, String title, double price, int count) {
        this.id = id;
        this.title = title;
        this.price = price;
        this.count = count;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "Goods{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", price=" + price +
                ", count=" + count +
                '}';
    }
}

ConsumerApp

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

@SpringBootApplication
public class ConsumerApp {
    public static void main(String[] args) {
        SpringApplication.run(ConsumerApp.class,args);
    }
}

eureka-consumer pom.xml

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

3.2 RestTemplate远程调用

  • Spring提供的一种简单便捷的模板类,用于在 java 代码里访问 restful 服务。
  • 其功能与 HttpClient 类似,但是 RestTemplate 实现更优雅,使用更方便。
    修改消费方代码

RestTemplateConfig

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {


    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}

OrderController

import com.itheima.consumer.domain.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * 服务的调用方
 */

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/goods/{id}")
    public Goods findGoodsById(@PathVariable("id") int id){
        System.out.println("findGoodsById..."+id);
        /*
            //远程调用Goods服务中的findOne接口
            使用RestTemplate
            1. 定义Bean  restTemplate
            2. 注入Bean
            3. 调用方法
         */

        String url = "http://localhost:8000/goods/findOne/"+id;
        // 3. 调用方法
        Goods goods = restTemplate.getForObject(url, Goods.class);
        return goods;
    }
}

在这里插入图片描述

3.3 Eureka Server搭建

创建 eureka-server 模块
在这里插入图片描述Spring-cloud-parent pom.xml

	<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
		<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
    </properties>
	
	 <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

eureka-server pom.xml

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

		<!-- eureka-server -->
		<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
    </dependencies>

EurekaApp

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
//启动EurekaServer
@EnableEurekaServer
public class EurekaApp {
    public static void main(String[] args) {
        SpringApplication.run(EurekaApp.class,args);
    }
}

完成 Eureka Server 相关配置 application.yml

server:
  port: 8761

# eureka 配置
# eureka 一共有4部分 配置
# 1. dashboard:eureka的web控制台配置
# 2. server:eureka的服务端配置
# 3. client:eureka的客户端配置
# 4. instance:eureka的实例配置


eureka:
  instance:
    hostname: localhost # 主机名
  client:
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka # eureka服务端地址,将来客户端使用该地址和eureka进行通信

    register-with-eureka: false # 是否将自己的路径 注册到eureka上。eureka server 不需要的,eureka provider client 需要
    fetch-registry: false # 是否需要从eureka中抓取路径。eureka server 不需要的,eureka consumer client 需要

3.4 Eureka控制台介绍

启动Eureka Server模块
在这里插入图片描述-------
在这里插入图片描述

  • System status:系统状态信息
  • DS Replicas:集群信息
  • tance currently registered with Eureka: 实例注册信息
  • General Info :通用信息
  • Instance Info :实例信息

3.5 Eureka Client

① 引 eureka-client 相关依赖

eureka-provider pom.xml

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

ProviderApp

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient//该注解 在新版本中可以省略
public class ProviderApp {
    public static void main(String[] args) {
        SpringApplication.run(ProviderApp.class,args);
    }
}

完成 eureka client 相关配置 application.yml

server:
  port: 8001


eureka:
  instance:
    hostname: localhost # 主机名
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka # eureka服务端地址,将来客户端使用该地址和eureka进行通信
spring:
  application:
    name: eureka-provider # 设置当前应用的名称。将来会在eureka中Application显示。将来需要使用该名称来获取路径

启动测试:
在这里插入图片描述服务消费者eureka-consumer通过修改,也可以展示在控制台

eureka-consumer在这里仅仅是我们人为定义为消费者,作为一个服务,其实既可以作为服务提供方,同时也可以作为服务消费方

ConsumerApp添加@EnableEurekaClient

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;


@EnableEurekaClient
@SpringBootApplication
public class ConsumerApp {


    public static void main(String[] args) {
        SpringApplication.run(ConsumerApp.class,args);
    }
}

application.yml

server:
  port: 9000


eureka:
  instance:
    hostname: localhost # 主机名
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka # eureka服务端地址,将来客户端使用该地址和eureka进行通信
spring:
  application:
    name: eureka-consumer # 设置当前应用的名称。将来会在eureka中Application显示。将来需要使用该名称来获取路径

eureka-consumer pom.xml

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

测试:
在这里插入图片描述

3.6 动态获取路径

ConsumerApp添加@EnableDiscoveryClient

@EnableDiscoveryClient // 激活DiscoveryClient
@EnableEurekaClient
@SpringBootApplication
public class ConsumerApp {
    public static void main(String[] args) {
        SpringApplication.run(ConsumerApp.class,args);
    }
}

OrderController修改代码动态获取路径

/**
 * 服务的调用方
 */

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private DiscoveryClient discoveryClient;

    @GetMapping("/goods/{id}")
    public Goods findGoodsById(@PathVariable("id") int id){
        System.out.println("findGoodsById..."+id);


        /*
            //远程调用Goods服务中的findOne接口
            使用RestTemplate
            1. 定义Bean  restTemplate
            2. 注入Bean
            3. 调用方法
         */

        /*
            动态从Eureka Server 中获取 provider 的 ip 和端口
             1. 注入 DiscoveryClient 对象.激活
             2. 调用方法
         */

        //演示discoveryClient 使用
       List<ServiceInstance> instances = discoveryClient.getInstances("EUREKA-PROVIDER");

        //判断集合是否有数据
        if(instances == null || instances.size() == 0){
            //集合没有数据
            return null;
        }

        ServiceInstance instance = instances.get(0);
        String host = instance.getHost();//获取ip
        int port = instance.getPort();//获取端口

        System.out.println(host);
        System.out.println(port);

        String url = "http://"+host+":"+port+"/goods/findOne/"+id;
        // 3. 调用方法
        Goods goods = restTemplate.getForObject(url, Goods.class);


        return goods;
    }
}

测试:
在这里插入图片描述

4.Eureka属性

4.1 instance相关属性

在这里插入图片描述Eureka Instance的配置信息全部保存在org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean配置类里,实际上它是com.netflix.appinfo.EurekaInstanceConfig的实现类,替代了netflix的com.netflix.appinfo.CloudInstanceConfig的默认实现。

Eureka Instance的配置信息全部以eureka.instance.xxx的格式配置。

配置列表

  • appname = unknown

应用名,首先获取spring.application.name的值,如果取值为空,则取默认unknown。

  • appGroupName = null

应用组名

  • instanceEnabledOnit = false

实例注册到Eureka上是,是否立刻开启通讯。有时候应用在准备好服务之前需要一些预处理。

  • nonSecurePort = 80

非安全的端口

  • securePort = 443

安全端口

  • nonSecurePortEnabled = true

是否开启非安全端口通讯

  • securePortEnabled = false

是否开启安全端口通讯

  • leaseRenewalIntervalInSeconds = 30

实例续约间隔时间

  • leaseExpirationDurationInSeconds = 90

实例超时时间,表示最大leaseExpirationDurationInSeconds秒后没有续约,Server就认为他不可用了,随之就会将其剔除。

  • virtualHostName = unknown

虚拟主机名,首先获取spring.application.name的值,如果取值为空,则取默认unknown。

  • instanceId

注册到eureka上的唯一实例ID,不能与相同appname的其他实例重复。

  • secureVirtualHostName = unknown

安全虚拟主机名,首先获取spring.application.name的值,如果取值为空,则取默认unknown。

  • metadataMap = new HashMap();

实例元数据,可以供其他实例使用。比如spring-boot-admin在监控时,获取实例的上下文和端口。

  • dataCenterInfo = new MyDataCenterInfo(DataCenterInfo.Name.MyOwn);

实例部署的数据中心。如AWS、MyOwn。

  • ipAddress=null

实例的IP地址

  • statusPageUrlPath = “/actuator/info”

实例状态页相对url

  • statusPageUrl = null

实例状态页绝对URL

  • homePageUrlPath = “/”

实例主页相对URL

  • homePageUrl = null

实例主页绝对URL

  • healthCheckUrlUrlPath = “/actuator/health”

实例健康检查相对URL

  • healthCheckUrl = null

实例健康检查绝对URL

  • secureHealthCheckUrl = null

实例安全的健康检查绝对URL

  • namespace = “eureka”

配置属性的命名空间(Spring Cloud中被忽略)

  • hostname = null

主机名,不配置的时候讲根据操作系统的主机名来获取

  • preferIpAddress = false

是否优先使用IP地址作为主机名的标识

4.2 server相关属性

在这里插入图片描述
Eureka Server注册中心端的配置是对注册中心的特性配置。Eureka Server的配置全部在org.springframework.cloud.netflix.eureka.server.EurekaServerConfigBean里,实际上它是com.netflix.eureka.EurekaServerConfig的实现类,替代了netflix的默认实现。

Eureka Server的配置全部以eureka.server.xxx的格式进行配置。

配置列表

  • enableSelfPreservation=true

是否开启自我保护

  • renewalPercentThreshold = 0.85

自我保护续约百分比阀值因子。如果实际续约数小于续约数阀值,则开启自我保护

  • renewalThresholdUpdateIntervalMs = 15 * 60 * 1000

续约数阀值更新频率。

  • peerEurekaNodesUpdateIntervalMs = 10 * 60 * 1000

Eureka Server节点更新频率。

  • enableReplicatedRequestCompression = false

是否启用复制请求压缩。

  • waitTimeInMsWhenSyncEmpty=5 * 60 * 1000

当从其他节点同步实例信息为空时等待的时间。

  • peerNodeConnectTimeoutMs=200

节点间连接的超时时间。

  • peerNodeReadTimeoutMs=200

节点间读取信息的超时时间。

  • peerNodeTotalConnections=1000

节点间连接总数。

  • peerNodeTotalConnectionsPerHost = 500;

单个节点间连接总数。

  • peerNodeConnectionIdleTimeoutSeconds = 30;

节点间连接空闲超时时间。

  • retentionTimeInMSInDeltaQueue = 3 * MINUTES;

增量队列的缓存时间。

  • deltaRetentionTimerIntervalInMs = 30 * 1000;

清理增量队列中过期的频率。

  • evictionIntervalTimerInMs = 60 * 1000;

剔除任务频率。

  • responseCacheAutoExpirationInSeconds = 180;

注册列表缓存超时时间(当注册列表没有变化时)

  • responseCacheUpdateIntervalMs = 30 * 1000;

注册列表缓存更新频率。

  • useReadOnlyResponseCache = true;

是否开启注册列表的二级缓存。

  • disableDelta=false。

是否为client提供增量信息。

  • maxThreadsForStatusReplication = 1;

状态同步的最大线程数。

  • maxElementsInStatusReplicationPool = 10000;

状态同步队列的最大容量。

  • syncWhenTimestampDiffers = true;

当时间差异时是否同步。

  • registrySyncRetries = 0;

注册信息同步重试次数。

  • registrySyncRetryWaitMs = 30 * 1000;

注册信息同步重试期间的时间间隔。

  • maxElementsInPeerReplicationPool = 10000;

节点间同步事件的最大容量。

  • minThreadsForPeerReplication = 5;

节点间同步的最小线程数。

  • maxThreadsForPeerReplication = 20;

节点间同步的最大线程数。

  • maxTimeForReplication = 30000;

节点间同步的最大时间,单位为毫秒。

  • disableDeltaForRemoteRegions = false;

是否启用远程区域增量。

  • remoteRegionConnectTimeoutMs = 1000;

远程区域连接超时时间。

  • remoteRegionReadTimeoutMs = 1000;

远程区域读取超时时间。

  • remoteRegionTotalConnections = 1000;

远程区域最大连接数

  • remoteRegionTotalConnectionsPerHost = 500;

远程区域单机连接数

  • remoteRegionConnectionIdleTimeoutSeconds = 30;

远程区域连接空闲超时时间。

  • remoteRegionRegistryFetchInterval = 30;

远程区域注册信息拉取频率。

  • remoteRegionFetchThreadPoolSize = 20;

远程区域注册信息线程数。

4.3 Eureka的自我保护模式

默认配置下,如果Eureka Server每分钟收到心跳续约的数量低于一个阈值(instance的数量(60/每个instance的心跳间隔秒数)自我保护系数),并且持续15分钟,就会触发自我保护。在自我保护模式中,Eureka Server会保护服务注册表中的信息,不再注销任何服务实例。当它收到的心跳数重新恢复到阈值以上时,该Eureka Server节点就会自动退出自我保护模式。它的设计理念就是宁可保留错误的服务注册信息,也不盲目注销任何可能健康的服务实例。该模式可以通过eureka.server.enable-self-preservation = false来禁用,同时eureka.instance.lease-renewal-interval-in-seconds可以用来更改心跳间隔,eureka.server.renewal-percent-threshold可以用来修改自我保护系数(默认0.85)。

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

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

相关文章

【Linux】Linux调试器--gdb的使用

有时候&#xff0c;我们并不需要被教导&#xff0c;而是应该被不断的提醒。 文章目录一、gdb的介绍二、debug和realease版本的区别三、gdb的使用1.显示代码&#xff1a; l行号&#xff08;list&#xff09;指令2.设置断点&#xff1a; b行号&#xff08;breakpoint&#xff09…

HTML5 定位

文章目录HTML5 定位geolocation简介getCurrentPosition()watchPosition() 和 clearWatch()百度地图HTML5 定位 geolocation 简介 在HTML5中&#xff0c;可以使用geolocation对象来获取用户的地理位置信息。 语法 window.navigator.geolocation //简写为 navigator.geoloca…

uni-app HBuilderX项目转为cli项目及踩坑记录

uni-app有两种创建创建项目的方式&#xff0c;通过HBuilderX可视化界面进行创建和通过vue-cli命令行&#xff0c;两者的区别可以参考uni-app官网-可视化方式的区别 其中cli项目是可以直接运行在hx中的&#xff0c;相比hx项目&#xff0c;cli的好处还有可以自定义环境变量和自定…

借助“云上”SPSS降低未来数据分析的不确定性

生活工作中我们常常会遇到这样或那样的困难&#xff0c;比如不得不临时居家办工&#xff0c;却发现家中电脑没有安装工作中的必备软件&#xff0c;比如毕业论文写到一半&#xff0c;同学告诉你&#xff0c;新版的软件升级加强了某个模型&#xff0c;能让你更好的完成论文。软件…

浅析从DWARF到BTF @龙蜥社区eBPF SIG

一、背景 一个程序会经历编码、编译、运行的过程&#xff0c;但所有的开发几乎都不可能是一帆风顺的&#xff0c;总会有些意想不到的错误&#xff0c;这时便需要调试。那么调试器使用的调试信息是从哪里来的呢&#xff1f;答案就是从编译后的文件中来的(依赖编译的时候使用特定…

Kubernetes使用Ingress Nginx流量代理

理论了解 1、ingress简介 kubernetes官方文档 Ingress 是 kubernetes API 中的标准资源类型之一&#xff0c;ingress 实现的功能是在应用层对客户端请求的 host 名称或请求的 URL 路径把请求转发到指定的 service 资源的规则&#xff0c;即用于将 kubernetes 集群外部的请求…

数字孪生水电站:发电流程三维可视化优化

从大禹治水到三峡大坝的建造&#xff0c;人类为控制和调配自然界的地表水和地下水&#xff0c;修建了许多的水利工程。对水资源进行了广泛的开发利用&#xff0c;诸如农业灌溉、工业和生活用水、水力发电、航运、港口运输、淡水养殖、旅游等。 将图扑软件与 GIS、粒子仿真、虚拟…

动作捕捉系统用于微创手术

微创手术是医生通过病人体表的微小切口&#xff0c;将细长的手术工具探入病人体内进行手术操作。与传统的开口手术相比&#xff0c;这种方式可减少手术对病人造成的创伤&#xff0c;缩短恢复时间。但是&#xff0c;微创手术也给医生的操作带来了一系列困难&#xff1a;比如受小…

Autoform R10中文版安装说明教程

1、安装R8的服务RLM_v12.0BL2 2、拷贝文件到相关目录&#xff08;1、许可证&#xff0c;C:\Program Files安装许可的位置。。。直接停止服务后替换R10 BIN文件 然后改环境变量&#xff08;这里可以直接改&#xff0c;也可以删掉然后重新输入&#xff0c;建议删掉后输入&#x…

上海亚商投顾:创业板缩量跌近1% 血氧仪概念逆市大涨

上海亚商投顾前言&#xff1a;无惧大盘大跌&#xff0c;解密龙虎榜资金&#xff0c;跟踪一线游资和机构资金动向&#xff0c;识别短期热点和强势个股。 市场情绪沪指早间低开高走&#xff0c;盘中一度拉升翻红&#xff0c;午后又再度下挫&#xff0c;深成指、创业板指均跌近1%。…

5G网络的关键技术及特点,面临的挑战!

01 5G关键技术 超密集组网&#xff1a;5G需要满足热点高容量场景&#xff08;高流量密度、高速率&#xff09; 超密集组网&#xff1a;大量增加小基站&#xff0c;以空间换性能 基站一般包括&#xff1a;宏基站和小基站 宏基站:即“铁塔站”&#xff0c;一般覆盖范围数千米…

Linux课程笔记

Linux基础命令 Linux的目录结构 /&#xff0c;根目录是最顶级的目录了Linux只有一个顶级目录&#xff1a;/路径描述的层次关系同样适用/来表示/home/itheima/a.txt&#xff0c;表示根目录下的home文件夹内有itheima文件夹&#xff0c;内有a.txt ls命令 功能&#xff1a;列出…

【北邮】计算机组成原理实验:实验一 运算器组成实验

实验一 运算器组成实验 实验目的 ⑴熟悉逻辑测试笔的使用方法。 ⑵熟悉 TEC-8 模型计算机的节拍脉冲 T1、T2、T3&#xff1b; ⑶熟悉双端口通用寄存器组的读写操作&#xff1b; ⑷熟悉运算器的数据传送通路&#xff1b; ⑸验证 74LS181 的加、减、与、或功能&#xff1…

Python数据容器(五)

python学习之旅&#xff08;五&#xff09; &#x1f44d;基础语法部分笔记(一) &#x1f44d;条件判断部分笔记(二) &#x1f44d;循环语句部分笔记(三) &#x1f44d;函数使用部分笔记(四) &#x1f44d;数据容器部分笔记(五) 一.数据容器 一种可以容纳多份数据的数据类型&am…

kail - 扫描与爆破

数据来源 扫描技术 背景 在渗透测试过程中&#xff0c;为了节省人力和时间&#xff0c;通常采用手工和工具相结合的方式。使用工具&#xff0c;就是将一些机械性的操作自动化实现&#xff0c;用来提高渗透测试的效率。例如&#xff0c;寻找内网网段[10.10.10,20/24]所有在线主…

MySQL窗口函数 和 阿里云日志15日留存率仪表盘统计脚本实现

窗口函数的官方描述&#xff1a;窗口函数对一组查询行执行类似聚合的操作。但是&#xff0c;虽然聚合操作将查询行分组为单个结果行&#xff0c;但窗口函数会为每个查询行生成一个结果&#xff0c;发生函数评估的行称为当前行&#xff0c;与发生函数评估的当前行相关的查询行构…

Kubernetes证书热更新期限至100年【HA高可用集群】

一、问题与环境 1.为什么更新证书&#xff1f;局域网如何保障服务稳定性&#xff1f;   众所周知k8s&#xff08;Kubernetes&#xff09;有一个默认证书期限为一年不成文的规定&#xff0c;官方的解释是“最佳的做法是经常升级集群以确保安全。&#xff08;升级后集群证书自…

MySQL表的增删查改

目录 1、表的插入 <1> 全列插入 <2> 指定列插入 <3> 插入否则更新 <4> 替换 2、表的查找 <1>全列查询 <2>指定列查询 <3> where条件 <4> 筛选分页结果 3、表的修改 4、表的数据删除 5、查看表结构 6、插入查询结…

SpringCloud微服务项目实战 - 2.App登录及网关

如果你追求一个局部的更好甚至完美,你有可能花费巨大的资源和时间&#xff1b; 从总体上看&#xff0c;这往往意味着总体的浪费和失败&#xff0c;这是传说中的“打赢了战役打输了战争”。 系列文章目录 项目搭建App登录及网关 文章目录系列文章目录一、App登录1. 需求分析2. …

2020-2021 ICPC, NERC, Southern and Volga Russian Regional Contest K. The Robot

翻译&#xff1a; 有一个机器人在一个没有尽头的方格场上。最初&#xff0c;机器人位于坐标为(0,0)的单元中。他将执行由一串大写拉丁字母“L”、“R”、“D”、“U”所描述的命令。当一个命令被执行时&#xff0c;机器人只是朝着相应的方向移动: “L”:向左一个单元格(当前单…