微服务之Eureka服务注册中⼼

关于务注册中⼼服

服务注册中⼼本质上是为了解耦服务提供者和服务消费者,尽可能量使两者联系可控在一定的范围外
1.在父项目下下引入 Spring Cloud 依赖
<dependencyManagement>
<dependencies>
<!-- SCN -->
<dependency>
<groupId> org.springframework.cloud </groupId>
<artifactId> spring-cloud-dependencies </artifactId>
<version> Greenwich.RELEASE </version>
<type> pom </type>
<scope> import </scope>
</dependency>
</dependencies>
</dependencyManagement>
2. 在⽗⼯程【 yx-parent 】的 pom.xml ⽂件中⼿动引⼊ jaxb 的依赖。因为 JDK9 之后默认没有加载该模块,⽽ EurekaServer依赖 jaxb ,所以需要⼿动导⼊,否则 Eureka Server 服务⽆法启动。

<!-- 引⼊ Jaxb 开始 -->
<dependency>
<groupId> com.sun.xml.bind </groupId>
<artifactId> jaxb-core </artifactId>
<version> 2.2.11 </version>
</dependency>
<dependency>
<groupId> javax.xml.bind </groupId>
<artifactId> jaxb-api </artifactId>
</dependency>
<dependency>
<groupId> com.sun.xml.bind </groupId>
<artifactId> jaxb-impl </artifactId>
<version> 2.2.11 </version>
</dependency>
<dependency>
<groupId> org.glassfish.jaxb </groupId>
<artifactId> jaxb-runtime </artifactId>
<version> 2.2.10-b140310.1920 </version>
</dependency>
<dependency>
<groupId> javax.activation </groupId>
<artifactId> activation </artifactId>
<version> 1.1.1 </version>
</dependency>
<!-- 引⼊ Jaxb 结束 -->

3.在父工程创建一个yx-cloud-eureka-9200工程,并引入依赖

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

4.在创建yx-cloud-eureka-9200的工程下的的resources⽬录下创建application.yml配置⽂件,配置Eureka Server服务端⼝, 服务名等信息。

server:
  port: 9200  # Eureka Server服务端口
spring:
  application:
    name: yx-service-eureka #应用名称,在Eureka中服务的唯一标识id
eureka:
  client: #Eureka Server本身也是Eureka的一个客户端,因为在集群下需要与其他Eureka Server进行数据的同步
    service-url:  # 客户端与Eureka Server交互的地址,如果是集群情况下defaultZone设置为集群下其他的Eureka Server地址,多个地址使用","隔开
      defaultZone: http://YXCloudEurekaServerC:9200/eureka,http://YXCloudEurekaServerD:9201/eureka
    register-with-eureka: true  # 表示是否向Eureka中心注册自己的信息,因为自己就是Eureka Server所以不进行注册,默认为true
    fetch-registry: true # 是否查询/拉取Eureka Server服务注册列表,默认为true
  instance:
    #hostname: localhost # 当前Eureka实例的主机名
    # 使用ip注册,否则会使用主机名注册(此处考虑到对老版本的兼容,新版本经过实验都是ip)
    prefer-ip-address: true
    # 自定义实例显示格式,加上版本号,便于多版本管理,注意是ip-address早期版本是ipAddress
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}:@project.version@
6. com.yx.eureka 包下,创建 EurekaApplication9200 启动类

 @EnableEurekaServer 此注解是申明项目是一个Eureka Server

 微服务注册到Eureka\

1.向服务提供者的项目中添加Eureka Client依赖。

<!-- Eureka Client -->
<dependency>
<groupId> org.springframework.cloud </groupId>
<artifactId> spring-cloud-starter-netflix-eureka-client </artifactId>
</dependency>

2.向消费者的项目的application.yml⽂件中配置Eureka服务端信息

eureka:
  client: #Eureka Server本身也是Eureka的一个客户端,因为在集群下需要与其他Eureka Server进行数据的同步
    service-url:  # 客户端与Eureka Server交互的地址,如果是集群情况下defaultZone设置为集群下其他的Eureka Server地址,多个地址使用","隔开
      defaultZone: http://localhost:9200/eureka
    register-with-eureka: true  # 表示是否向Eureka中心注册自己的信息,因为自己就是Eureka Server所以不进行注册,默认为true
    fetch-registry: true # 是否查询/拉取Eureka Server服务注册列表,默认为true
  instance:
    #hostname: localhost # 当前Eureka实例的主机名
    # 使用ip注册,否则会使用主机名注册(此处考虑到对老版本的兼容,新版本经过实验都是ip)
    prefer-ip-address: true
    # 自定义实例显示格式,加上版本号,便于多版本管理,注意是ip-address早期版本是ipAddress
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}:@project.version@
3. 修改 yx-service-page(消费者) 项⽬的启动类 ProductApplication ,添加 @EnableDiscoveryClient 注解
package com . yx . page ;
import org . springframework . boot . SpringApplication ;
import org . springframework . boot . autoconfigure . SpringBootApplication ;
import org . springframework . cloud . client . discovery . EnableDiscoveryClient ;
import org . springframework . context . annotation . Bean ;
import org . springframework . web . client . RestTemplate ;
@EnableDiscoveryClient
// @EnableEurekaClient
@SpringBootApplication
public class PageApplication {
public static void main ( String [] args ) {
SpringApplication . run ( PageApplication . class , args );
}
@Bean
public RestTemplate restTemplate () {
return new RestTemplate ();
}
}

 搭建Eureka Server⾼可⽤集群

Win11 操作系统
1. 打开 C 盘下的 C:\Windows\System32\drivers\etc\hosts ⽂件
2. hosts ⽂件中添加 Eureka Server 集群地址的配置
127.0.0.1 YXCloudEurekaServerC 
127.0.0.1 YXCloudEurekaServerD
搭建 Eureka Server 服务【 yx-cloud-eureka-9201 】,把之前搭建好的单个赋值出一份并修改信息

1.导入坐标

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

2.两份eureka的项目的配置的不同点,及相同点

 声明当前服务为Eureka注册中⼼

 6.修改连接集群的提供者的项目的配置文件

也改为这个 

 Ribbon负载均衡

Ribbon 开发代码 实现
多创建两个提供者,在所有提供者项目下 创建ServerConfigController 类定,定义 ⽅法返回当前微服务端⼝号。
package com . yx . product . controller ;
import org . springframework . beans . factory . annotation . Value ;
import org . springframework . web . bind . annotation . RequestMapping ;
import org . springframework . web . bind . annotation . RestController ;
@RestController
@RequestMapping ( "server" )
public class ServerConfigController {
@Value ( "${server.port}" )
private String serverPort ;
@RequestMapping ( "query_port" )
public String findServerPort () {
return serverPort ;
}
}

在所有提供者的主启动类上,加上注解

 注意提供者的端口号不一样但是名称要一样

 在消费者(page)的项目中的restTemplate()⽅法上添加启动Ribbon负载均衡的注解

4. yx-service-page ⻚⾯静态化微服务中定义调⽤ yx-server-product 服务获取端⼝信息的
queryProductServerPort() ⽅法,同时重构 queryProductById() ⽅法。

 以上负载均衡就配置完了,以下是各种配置信息

 消费者的配置一览

server:
  port: 9100
spring:
  application:
    name: yx-service-page
  datasource:
    url: jdbc:mysql://localhost:3306/yx_sc?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
    username: root
    password: 123
eureka:
  client: #Eureka Server本身也是Eureka的一个客户端,因为在集群下需要与其他Eureka Server进行数据的同步
    service-url:  # 客户端与Eureka Server交互的地址,如果是集群情况下defaultZone设置为集群下其他的Eureka Server地址,多个地址使用","隔开
      defaultZone: http://YXCloudEurekaServerC:9200/eureka,http://YXCloudEurekaServerD:9201/eureka
  instance:
    #hostname: localhost # 当前Eureka实例的主机名
    # 使用ip注册,否则会使用主机名注册(此处考虑到对老版本的兼容,新版本经过实验都是ip)
    prefer-ip-address: true
    # 自定义实例显示格式,加上版本号,便于多版本管理,注意是ip-address早期版本是ipAddress
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}:@project.version@
## 针对的被调⽤⽅微服务名称,不加就是全局⽣效
#yx-service-product:
#  ribbon:
##    NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule  # 随机策略
#    NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RoundRobinRule # 轮询策略
#    NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RetryRule # 重试策略

提供者的配置一览

server:
  port: 9001
spring:
  application:
    name: yx-service-product
  datasource:
    url: jdbc:mysql://localhost:3306/yx_sc?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
    username: root
    password: 123
eureka:
  client: #Eureka Server本身也是Eureka的一个客户端,因为在集群下需要与其他Eureka Server进行数据的同步
    service-url:  # 客户端与Eureka Server交互的地址,如果是集群情况下defaultZone设置为集群下其他的Eureka Server地址,多个地址使用","隔开
      defaultZone: http://YXCloudEurekaServerC:9200/eureka,http://YXCloudEurekaServerD:9201/eureka
    registry-fetch-interval-seconds: 30 #表示客户端每隔多少秒拉去一次最新数据
  instance:
    #hostname: localhost # 当前Eureka实例的主机名
    # 使用ip注册,否则会使用主机名注册(此处考虑到对老版本的兼容,新版本经过实验都是ip)
    prefer-ip-address: true
    # 自定义实例显示格式,加上版本号,便于多版本管理,注意是ip-address早期版本是ipAddress
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}:@project.version@
    metadata-map:
      username: admin
      password: 123456
      telphone: 1301112222
      #每隔30秒向注册中心汇报心跳
    lease-renewal-interval-in-seconds: 30
    #超过90秒还没汇报心跳Eureka Server会将该服务信息移除
    lease-expiration-duration-in-seconds: 90

Hystrix熔断器

1.1.在服务消费者⼯程(静态化微服务)中引⼊Hystrix依赖坐标

<!-- 熔断器 Hystrix -->
<dependency>
<groupId> org.springframework.cloud </groupId>
<artifactId> spring-cloud-starter-netflix-hystrix </artifactId>
</dependency>
2. 开启熔断,服务消费者⼯程(静态化微服务)的启动类上添加熔断器开启注解 @EnableCircuitBreaker

PageController 类中添加 findProductServerPort() 业务⽅法,并使⽤ @HystrixCommand进⾏熔断控制
/** 服务提供者模拟请求处理超时,服务消费者通过Hystrix控制 */
// 使⽤@HystrixCommand注解进⾏熔断控制
@HystrixCommand(
 // 线程池标识,默认情况下所有的请求共同维护⼀个线程池,实际开发中每个⽅法维护⼀个唯⼀的线程池
 threadPoolKey = "findProductServerPort",
 // 线程池细节属性配置
 threadPoolProperties = {
 @HystrixProperty(name="coreSize", value="2"), // 线程数
 @HystrixProperty(name="maxQueueSize", value="20") // 等待队列⻓度
 },
// commandProperties熔断的⼀些细节属性配置
 commandProperties = {
 // 每⼀个属性都是⼀个HystrixProperty
 // 设置请求的超时时间,⼀旦请求超过设定的时间就会按照超时进⾏处理
 @HystrixProperty(name="execution.isolation.thread.timeoutInMilliseconds",
value="2000")
 }
)
@RequestMapping("find_port")
public String findProductServerPort() {
 String url = "http://yx-service-product/server/query_port";
 return restTemplate.getForObject(url, String.class);
}

降级处理

添加 getProductServerPort() 业务⽅法,配置 @HystrixCommand 注解,定义降级处理⽅法。
    //如果服务提供者等待时间过长,服务消费方通过Hytrix来控制服务的调用(自动响应默认值给客户端)
    @HystrixCommand(
            //线程池标识配置默认情况下请求共同维护一个线程池
            threadPoolKey = "findProductServerPort",
            threadPoolProperties = {
                //核心线程为2
                    @HystrixProperty(name="coreSize",value = "2"),
                //等待队列的最大长度
                    @HystrixProperty(name="maxQueueSize",value = "20")
            },
            commandProperties = {
                    //设置请求的超时时间,一旦超过时间,会触发Hystrix的处理机制
          @HystrixProperty(name="execution.isolation.thread.timeoutInMilliseconds",
                           value="2000")
            },
            //表示回退方法,如果服务提供者出现问题,会调用属性所指向的方法
            fallbackMethod = "getProductServerPortFallbackMethod" // 回退⽅法
    )
    @RequestMapping("find_port")
    public String findProductServerPort() {
        String url = "http://yx-service-product/server/query_port";
        return restTemplate.getForObject(url, String.class);
    }
    /**
     * 定义回退⽅法,返回预设默认值。注意,该⽅法的参数列表和返回值类型必须与原始⽅法保持⼀致。
     * @return 预设默认值
     */
    public String getProductServerPortFallbackMethod() {
        return "-1";
    }

Hystrix⾼级应⽤

1.注解配置

    //如果服务提供者等待时间过长,服务消费方通过Hytrix来控制服务的调用(自动响应默认值给客户端)
    @HystrixCommand(
            //线程池标识配置默认情况下请求共同维护一个线程池
            threadPoolKey = "findProductServerPort",
            threadPoolProperties = {
                    //核心线程为2
                    @HystrixProperty(name = "coreSize", value = "2"),
                    //等待队列的最大长度
                    @HystrixProperty(name = "maxQueueSize", value = "20")
            },
            commandProperties = {
                    //设置请求的超时时间,一旦超过时间,会触发Hystrix的处理机制
                    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds",
                            value = "2000"),
                    // Hystrix⾼级配置,定制⼯作过程细节
                    // 统计时间窗⼝定义
                    @HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "8000"),
                    // 统计时间窗⼝内的最⼩请求数
                    @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "2"),
                    // 统计时间窗⼝内的错误数量百分⽐阈值
                    @HystrixProperty(name = "circuitBreaker.errorThresholdPercentage", value = "50"),
                    // ⾃我修复时的活动窗⼝⻓度
                    @HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "3000")
            },
            //表示回退方法,如果服务提供者出现问题,会调用属性所指向的方法
            fallbackMethod = "getProductServerPortFallbackMethod" // 回退⽅法
    )
    @RequestMapping("find_port")
    public String findProductServerPort() {
        String url = "http://yx-service-product/server/query_port";
        return restTemplate.getForObject(url, String.class);
    }

    /**
     * 定义回退⽅法,返回预设默认值。注意,该⽅法的参数列表和返回值类型必须与原始⽅法保持⼀致。
     *
     * @return 预设默认值
     */
    public String getProductServerPortFallbackMethod() {
        return "-1";
    }

 2.yml配置就不必再配置以上图片的的内容

#配置HySTRIX的同短期参数
hystrix:
  command:
    default:   #就算不给也不报错有默认
      circuitBreaker:
        # 强制打开熔断器,如果该属性设置为true,强制断路器进入打开状态,将会拒绝所有的请求,默认false关闭的
        forceOpen: false
        # 触发熔断错误比例阈值,默认值50%
        errorThresholdPercentage: 50
        # 熔断后休眠时长,默认值5秒
        sleepWindowInMilliseconds: 3000
        # 熔断触发最小请求次数,默认值是20
        requestVolumeThreshold: 2
      execution:
        isolation:
          thread:
            # 熔断超时设置,默认为1秒
            timeoutInMilliseconds: 2000
  threadpool: #hytix线程池配置
    default:
      coreSize: 10 # 并发执⾏的最⼤线程数,默认10
      maxQueueSize: 1000 # BlockingQueue的最⼤队列数,默认值-1
      # 即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝,默认值5
      queueSizeRejectionThreshold: 800
基于 Spring Boot 的健康检查观察跳闸状态(⾃动投递微服务暴露 健康检查 细节),在 yx-service-page 项⽬的 application.yml⽂件中配置。
# Spring Boot中暴露健康检查等断点接口
management:
  endpoints:
    web:
      exposure:
        include: "*"
  # 暴露健康接口的细节
  endpoint:
    health:
      show-details: always

配置完以上,注解这就简单了

Feign(终于来到这个了,其实以上的内容都是可以用feign来解决的)

1.在服务消费者⼯程(⻚⾯静态化微服务)中引⼊Feign依赖(或者⽗类⼯程)

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

服务消费者⼯程(或者⽗类⼯程)启动类上使⽤注解@EnableFeignClients添加Feign⽀持

 3.在消费者微服务(⻚⾯静态化微服务)的com.yx.page.feign包下创建ProductFeign接⼝。

package com.yx.erureka.feign;

import com.qf.common.pojo.Products;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

// 注解表示Feign的远程调用
//-name:表示feign远程调用对应的服务提供者的名称
@FeignClient(name = "yx-service-product")
public interface ProductFeign {
    //载该接口中定义抽象方法,每一个抽象方法映射一个对应远程请求处理方法,注意要与远程处理方法的结构保持一致
@RequestMapping("/product/DD/{id}")
Products findById(@PathVariable Integer id);
@RequestMapping("/server/query_port")
 String findProductServerPort();
}

 自动装配

5.3 Feign对负载均衡的⽀持

yx-service-product:
  ribbon:
  # 请求连接超时时间
    ConnectTimeout: 2000
  # 请求处理超时时间
    ReadTimeout: 10000
  # 对所有操作都进⾏重试
    OkToRetryOnAllOperations: true
  # 根据如上配置,当访问到故障请求的时候,它会再尝试访问⼀次当前实例(次数由MaxAutoRetries配置),如果不⾏,
  # 就换⼀个实例进⾏访问;如果还不⾏,再换⼀次实例访问(更换次数由MaxAutoRetriesNextServer配置);如果依然不⾏,返回失败信息。
    MaxAutoRetries: 0 # 对当前选中实例重试次数,不包括第⼀次调⽤
    MaxAutoRetriesNextServer: 0 # 切换实例的重试次数
    NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule # 负载策略调整

 5.4 Feign对熔断器的⽀持

配置⽂件 application.yml 中开启 Feign 对熔断器的⽀持
# 开启Feign的熔断功能
feign:
  hystrix:
    enabled: true  # 开启Feign的熔断功能
​​​​​​​
com.yx.page.feign 包下⾃定义 ProductFeignFallback 处理类,需要实现 ProductFeign 接⼝。

 4.ProductFeign接⼝的@FeignClient注解上添加fallback属性来指定回退类

​​​​​​​​​​​​​​

5.5 Feign对请求压缩和响应压缩的⽀持 

application.yml⽂件中,通过下⾯的参数配置即可开启请求与响应的压缩功能

# 开启Feign的熔断功能
feign:
  hystrix:
    enabled: true  # 开启Feign的熔断功能
  compression:
    request:
      enabled: true # 默认不开启
      mime-types: text/html,application/xml,application/json # 设置压缩的数据类型,设置为默认值
      min-request-size: 2048 # 设置触发压缩的大小下限,2048为默认值
    response:
      enabled: true # 默认不开启

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

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

相关文章

基于OpenCV的人脸对齐步骤详解及源码实现

目录 1. 前言2. 人脸对齐基本原理与步骤3. 人脸对齐代码实现 1. 前言 在做人脸识别的时候&#xff0c;前期的数据处理过程通常会遇到一个问题&#xff0c;需要将各种人脸从不同尺寸的图像中截取出来&#xff0c;再进行人脸对齐操作&#xff1a;即将人脸截取出来并将倾斜的人脸…

计算机视觉的图像标注与视觉任务

1 ​计算机视觉应用 计算机视觉是一种利用计算机和数学算法来模拟人类视觉的技术&#xff0c;可以应用于许多领域。以下是计算机视觉的八大应用&#xff1a; 图像识别&#xff1a;利用计算机视觉技术&#xff0c;可以对图像进行分类、识别和分割&#xff0c;从而实现自动化的…

【物理】模拟粒子在电场和磁场中的轨迹研究(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

Spring 核心与设计思想

文章目录 1.Spring 是什么&#xff1f;2.什么是容器3.什么是IoC3.1 传统程序开发3.2 IoC程序开发3.3 IoC再理解 4.认识DI 1.Spring 是什么&#xff1f; Spring框架是一个轻量级的企业开发的一站式解决方案&#xff0c;可以基于Spring解决Java EE 开发中的所有问题。 ⽤⼀句大白…

CSS 弹性布局

提示&#xff1a;这篇比较重要&#xff0c;做复杂页面时经常会用到&#xff01;会不断更新❗ 文章目录 前言主轴和侧轴flex-direction 主轴方向flex-wrap 折行justify-content 主轴排列方式flex-start&#xff1a;默认左对齐flex-end&#xff1a;右对齐center&#xff1a;居中s…

Java- IO 及其相关面试题

目录 一、前言二、Java IO 概述输入和输出流2.1.1 定义2.1.2 代码示例 2.2 字节流和字符流2.2.1 定义2.2.2 代码示例 2.3 标准IO和NIO 三、字节流和字符流3.1. 字节流&#xff1a;InputStream和OutputStream3.1.1. FileInputStream和FileOutputStream3.1.2. ByteArrayInputStre…

剑指oferr68-II.二叉树的最近公共祖先

为什么这道题的难度是easy&#xff0c;我感觉挺难的啊&#xff0c;我想了挺久没有一点思路就直接看题解了。题解有两种解法&#xff0c;先看第一种存储父节点 class Solution {Map<Integer,TreeNode> parent new HashMap<Integer,TreeNode>();Set<Integer>…

【网络安全】Burpsuite v2021.12.1安装激活配置快捷启动

Burpsuite v2021.12.1安装&激活&配置&快捷启动 一、下载激活包二、配置JDK11三、启动激活 一、下载激活包 需要下载的内容&#xff1a; Burp Suite jar包JDK11激活jar包汉化jar包 下面是已经下载好的&#xff0c;可以直接使用 BurpSuite网盘下载链接 提取码&#…

【运维】第03讲(上):Nginx 负载均衡常见架构及问题解析

实际上 Nginx 除了承担代理网关角色外还会应用于 7 层应用上的负载均衡&#xff0c;本课时重点讲解 Nginx 的负载均衡应用架构&#xff0c;及最常见的问题。 学前提示 Nginx 作为负载均衡是基于代理模式的基础之上&#xff0c;所以在学习本课时前&#xff0c;你需要对 Nginx …

本地appserv外挂网址如何让外网访问?快解析端口映射

一、appserv是什么&#xff1f; AppServ 是 PHP 网页架站工具组合包&#xff0c;作者将一些网络上免费的架站资源重新包装成单一的安装程序&#xff0c;以方便初学者快速完成架站&#xff0c;AppServ 所包含的软件有&#xff1a;Apache[、Apache Monitor、PHP、MySQL、phpMyAdm…

JavaFX中MVC例子理解

JavaFX可以让你使用GUI组件创建桌面应用程序。一个GUI应用程序执行三个任务&#xff1a;接受用户的输入&#xff0c;处理输入&#xff0c;并显示输出。而一个GUI应用程序包含两个 类型的代码&#xff1a; 领域代码。处理特定领域的数据和遵循业务规范。交互代码。处理用户输入…

Elasticsearch:使用 Elasticsearch 矢量搜索和 FastAPI 构建文本搜索应用程序

在我的文章 “Elastic&#xff1a;开发者上手指南” 的 “NLP - 自然语言处理及矢量搜索”&#xff0c;我对 Elastic Stack 所提供的矢量搜索有大量的描述。其中很多的方法需要使用到 huggingface.co 及 Elastic 的机器学习。这个对于许多的开发者来说&#xff0c;意味着付费使…

【Linux】进程优先级

Linux 进程优先级 为什么要有优先级的划分&#xff1f;Linux 环境设置优先级的具体做法并发运行环境变量如何通过代码获取环境变量 环境变量的来源 为什么要有优先级的划分&#xff1f; 优先级的规定就是为了确定某种资源获取的先后顺序。 本质原因是因为CPU资源是有限的。进程…

KMP算法

KMP KMP 算法是一个快速查找匹配串的算法&#xff0c;它的作用其实就是本题问题&#xff1a;如何快速在「原字符串」中找到「匹配字符串」。 而 KMP 算法的复杂度为 O(mn)实际上是O(N),因为O(M)不可能大于O(N) KMP 之所以能够在 O(mn)复杂度内完成查找&#xff0c;是因为其能…

CentOS环境下的MYSQL8安装

MySQL 安装 参考连接&#xff1a;https://www.cnblogs.com/jasonx1an/p/16690866.html 下载 下载网址&#xff1a;https://dev.mysql.com/downloads/mysql/ 卸载 mariadb 查看 mariadb rpm -qa|grep mariadb卸载 mariadb rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps再…

概率栅格

欢迎访问我的博客首页。 概率栅格 1. miss 表与 hit 表 1. miss 表与 hit 表 miss 表和 his 表是一维数组&#xff0c;它们存放的都是空闲值。其下标 i i i 代表旧空闲值&#xff0c;元素 t a b l e [ i ] table[i] table[i] 代表旧空闲值 i i i 的新空闲值。表的更新可以用…

Maven —— 项目管理工具

前言 在这篇文章中&#xff0c;荔枝会介绍如何在项目工程中借助Maven的力量来开发&#xff0c;主要涉及Maven的下载安装、环境变量的配置、IDEA中的Maven的路径配置和信息修改以及通过Maven来快速构建项目。希望能对需要配置的小伙伴们有帮助哈哈哈哈~~~ 文章目录 前言 一、初…

安全防御 --- SSL VPN

附&#xff1a;无线项目介绍 SSL VPN 有浏览器的设备就可以使用SSL&#xff0c;进而使用SSL VPN。无需担心客户端问题&#xff0c;所以SSL VPN也称为无客户端VPN。SSL VPN在client to lan场景下特别有优势。 实际实现过程&#xff08;基于TCP实现&#xff09; &#xff08;1&…

MYSQL执行一条SELECT语句的具体流程

昨天CSDN突然抽风 我一个ctrlz把整篇文章给撤掉了还不能复原 直接心态崩了不想写了 不过这部分果然还是很重要,还是写出来吧 流程图 这里面总共有两层结构Server层 储存引擎 Server 层负责建立连接、分析和执行 SQL。MySQL 大多数的核心功能模块都在这实现&#xff0c;主要包…

Java-API简析_java.lang.ProcessBuilder类(基于 Latest JDK)(浅析源码)

【版权声明】未经博主同意&#xff0c;谢绝转载&#xff01;&#xff08;请尊重原创&#xff0c;博主保留追究权&#xff09; https://blog.csdn.net/m0_69908381/article/details/131729933 出自【进步*于辰的博客】 因为我发现目前&#xff0c;我对Java-API的学习意识比较薄弱…
最新文章