5. Spring Cloud OpenFeign 声明式 WebService 客户端的超详细使用

@

前言

1. OpenFeign 介绍

OpenFeign 是什么 ?

  1. OpenFeign 是个声明式 WebService 客户端,使用 OpenFeign 让编写 Web Service客户端更简单。

  2. 它的使用方法是定义一个服务接口,然后在上面添加注解。

  3. OpenFeign 也支持可插拔式的编码器解码器

  4. Spring Cloud 对 OpenFeign 进行了封装使其支持了 Spring MVC 标注注解 和 HttpMessageConverters

  5. OpenFeign 可以与 Eureka 和 Ribbon 组合使用以支持负载均衡。

  6. OpenFeign 官网地址: https://github.com/spring-cloud/spring-cloud-openfeign

简单的说:就是一个 Web Service 客户端访问的,转发的一个组件,可以实现 Server 集群的通信,简化 Web Service 客户端

1.1 Feign 和 OpenFeign 区别

Feign:

  • Feign 是Spring Cloud 组件中的一个轻量级 RESTful的HTTP服务客户端
  • Feign 内置了Ribbon ,用来做客户端负载均衡,去调用服务注册中心的服务
  • Feign 的使用方式是: 使用Feign的注解定义接口,调用服务注册中心的服务。
  • Feign 支持的注解和用法参考官方文档: https://github.com/OpenFeign/feign
  • Feign 本身不支持Spring MVC的注解 ,它有一套自己的注解,所以大部分市场开发已经不使用 Feign 了。
  • 引入依赖:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

OpenFeign:

  • OpenFeign 是 Spring Cloud 在 Feign的基础上支持了Spring MVC 的注解,如 @RequestMapping等等
  • OpenFeign 的 @FeignClient 可以解析 Spring MVC 的 @RequestMapping 注解下的接口
  • OpenFeign 通过动态代理的方式产生实现类,实现类中做负载均衡并调用其他服务。

    引入依赖:
   <!--  引入 openfeign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
  • 精简一句话: OpenFeign 就是在 Feign基础上做了加强,有些程序员为了方便,说 Feign 就是OpenFeign

2. OpenFeign 应用实例

需求分析&图解

示意图:

  1. 创建服务消费模块 - 通过 OpenFeigen 实现远程调用

参考 member-service-consumer-80 创建 member-service-consumer-openfeign-80(具体步 骤参考以前)

  1. pom.xml 文件当中,导入相关的 jar 依赖。特别是这里:我们的主角openFeign

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

完整的 pom.xml 文件信息:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>e-commerce-center</artifactId>
<groupId>com.rainbowsea</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion> <artifactId>member-service-consumer-openfeign-80</artifactId> <!-- 引入相关的依赖:我们引入了当前所需要的依赖,后面如果有其它的需要,再灵活添加-->
<dependencies> <!-- 引入 openfeign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> <!-- 引入 web-starter 说明:我们使用版本仲裁(从父项目继承了版本)-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <!--1. starter-actuator 是spring boot 程序的监控系统,可以实现健康检查,info 信息等
2. 访问http://localhost:80/actuator 可以看到相关链接,还可以做相关配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency> <!-- lombok 引入-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency> <!-- 引入 test-starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <!-- 引入我们自己对 bean 封装成 api 的模块内容-->
<dependency>
<groupId>com.rainbowsea</groupId>
<artifactId>e_commerce_center-common-api</artifactId>
<version>${project.version}</version>
</dependency> <!-- 引入 eureka-client 依赖 -->
<!-- 注意:存在一个 starter 不要选错了-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependencies> </project>
  1. 在 resourse 目录下,创建 application.yml 进行一些相关的配置信息, 内容如下:

server:
port: 80
spring:
application:
name: member-service-consumer-openfeign-80 # 配置 eureka client 注意,因为这里该模块是作为 client 客户端的角色的,所有要将自己client的信息发送给 Server 当中去的
eureka:
client:
register-with-eureka: true # 表示将自己注册到 Eureka-Server 当中
fetch-registry: true # 表示将信息发送到 Eureka-Server 当中
service-url:
# 表示将自己注册到那个 eureka-server
# defaultZone: http://localhost:9001/eureka
# 将本微服务注册到多个 eureka - server 当中,使用逗号间隔即可
defaultZone: http://eureka9001.com:9001/eureka/,http://eureka9002.com:9002/eureka/
  1. 创建该模块 member-service-consumer-openfeign-80 的主启动类,也就是场景启动器。

在:创建包com.rainbowsea.springcloud ,创建名为 MemberConsumerOpenfeignApplication80的主启动类,如下图所示:

package com.rainbowsea.springcloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication
@EnableEurekaClient // 表示作为 Eureka Client 角色
@EnableFeignClients // 启动 OpenFeignClient
public class MemberConsumerOpenfeignApplication80 { public static void main(String[] args) { SpringApplication.run(MemberConsumerOpenfeignApplication80.class, args);
}
}

添加主启动类之后,我们可以测试一下,是否成功将该模块member-service-consumer-openfeign-80 注册到了 Eureka Server 当中去了。

注意:下面的操作就是:是 OpenFeign 的核心内容了。

  1. 在该member-service-consumer-openfeign-80 模块当中创建一个com.rainbowsea.springcloud.service 包,在该包当中创建一个 MemberFeignService 接口,注意注意是接口interface 不是类。如下图所示:

package com.rainbowsea.springcloud.service;

import com.rainbowsea.springcloud.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; @Component
public interface MemberFeignService { }

然后我们需要将其中,我们 member-service-consumer-openfeign-80 模块是作为 Eureka Client 客户端存在的,这里使用 OpenFeign 简化客户端,我们还需将 ,我们 OpenFeigin(也就是客户端,也就是 Eureka Client ) 想要调用的哪个 provider service(服务器/服务集群) 处理我们的业务,这里我们是服务集群 ,这里我们有两个 privoid service 可以处理我们所需的业务,如下图所受:分别为:

member-service-provider-10000,member-service-provider-10002 这两个服务(这两个服务,是已经相互注册好了,配置为了服务集群了 )

这里我们在MemberFeignService 接口类上使用 @FeignClient注解标注,我们这个 OpenFeigin(也就是客户端,也就是 Eureka Client ) 想要调用的哪个 provider service(服务器/服务集群) 处理我们的业务。如下图所示:

package com.rainbowsea.springcloud.service;

import com.rainbowsea.springcloud.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; @Component
//这里 MEMBER-SERVICE-PROVIDER 就是 Eureka Server 服务提供方注册的名称
@FeignClient(value = "MEMBER-SERVICE-PROVIDER") // 这个 value 值就是,对应我们想要访问的 provider(提供服务/服务集群)的 name 名称
public interface MemberFeignService { }

同时我们还需要在 MemberFeignService 接口当中定义一个方法。

注意这个方法,必须必须和你 OpenFeigin(也就是客户端,也就是 Eureka Client ) 想要调用的哪个 provider service(服务器/服务集群) 中的处理对应业务的哪个方法,保持一致(权限修饰符一致,Http请求方式(包括了所对应的请求映射路径)一致,参数类型,参数个数一致,返回值类型也是一致的,方法名可以不一致(但强烈建议也保持一致)),所以强烈建议,直接从对应的 provider service 当中复制过来即可。如下图:我们使用的是 getMemberById 根据 id 查询的业务处理。我们只需将其方法名复制过来即可。

package com.rainbowsea.springcloud.service;

import com.rainbowsea.springcloud.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; @Component
//这里 MEMBER-SERVICE-PROVIDER 就是 Eureka Server 服务提供方注册的名称
@FeignClient(value = "MEMBER-SERVICE-PROVIDER") // 这个 value 值就是,对应我们想要访问的 provider(提供服务/服务集群)的 name 名称
public interface MemberFeignService { // 注意:这里定义方法-就是远程调用的接口,建议复制过来 /*
1.远程调用的方式是get
2.远程调用的 url http://MEMBER-SERVICE-PROVIDER(注册到服务当中的别名)/member/get/{id}
3.MEMBER-SERVICE-PROVIDER 就是服务提供方法 Eureka Server 注册的服务
4. openfeign 会根据负载均衡决定调用 10000/10002 -默认是轮询
5.因为openfeign 好处是支持了 spring mvc 注解 + 接口解构
6. 想要使用 OPFeign 需要在对应场景启动器的位置配置上: @EnableFeignClients // 启动 OpenFeignClient */
@GetMapping("/member/get/{id}")
Result getMemberById(@PathVariable("id") Long id); }

最后,我们在当前 member-service-consumer-openfeign-80 模块也就是我们的 OpenFeigin(也就是客户端,也就是 Eureka Client ) 编写控制器,在 com.rainbowsea.springcloud.controller 包下,编写对应的控制器。如下图所示:

package com.rainbowsea.springcloud.controller;

import com.rainbowsea.springcloud.entity.Result;
import com.rainbowsea.springcloud.service.MemberFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController
public class MemberConsumerFeignController { // 装配MemberFeignService
@Resource
private MemberFeignService memberFeignService; @GetMapping("/member/consumer/openfeign/get/{id}")
public Result getMemberById(@PathVariable("id") Long id) {
// 调用接口中的方法
return memberFeignService.getMemberById(id); }
}
  • 特别说明,因为我们的 OpenFeign 就是一个通过接口+注解的方式作为Eureka Client 客户端,调用其中 Service 服务器
  • Openfeign 的使用的特点:微服务接口+@FeignClient ,使用接口进行解耦(简单的说:就是使用接口调用对应 provider 提供服务的集群)

测试,启动服务器

浏览器输入 : http://localhost/member/consumer/openfeign/get/1

观察访问的 10000/10002 端口的服务是轮询的

2.2 注意事项和细节

  • @FeignClient(value = "MEMBER-SERVICE-PROVIDER") // 这个 value 值就是,对应我们想要访问的 provider(提供服务/服务集群)的 name 名称 所以:注意不要将提供注册的名称,写错了

3. OpenFeign 内置的“日志配置” 操作

说明 OpenFeign 提供了日志打印功能,可以通过配置来调整日志级别,从面对 OpenFeign 接口的调用情况进行监控和输出。

日志级别:

  1. NONE: 默认的,不显示任何日志
  2. BASIC: 仅记录请求方式,URL,响应状态码及执行时间
  3. HEADERS:除了 BASIC 中定义的信息之外,还有请求和响应的头信息
  4. FULL: 除了HEADERS 中定义的信息之外,还有请求和响应的正文及元数据

常见的日志级别有 5 种,分别是 error、warn、info、debug、trace

  1. error:错误日志,指比较严重的错误,对正常业务有影响,需要运维配置监控的;
  2. warn:警告日志,一般的错误,对业务影响不大,但是需要开发关注;
  3. info:信息日志,记录排查问题的关键信息,如调用时间、出参入参等等;
  4. debug:用于开发 DEBUG 的,关键逻辑里面的运行时数据;
  5. trace:最详细的信息,一般这些信息只记录到日志文件中。

3.1 OpenFeign 配置日志-应用实例

在member-service-consumer-openfeign-80 创建 com.Rainbowsea.springcloud.config.OpenFeignConfig.java 类

package com.rainbowsea.springcloud.config;

import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; @Configuration
public class OpenFeignConfig { @Bean
public Logger.Level loggerLever() {
// /日志级别指定为 FULL
return Logger.Level.FULL;
}
}

member-service-consumer-openfeign-80 模块当中修改 application.yml 进行配置我们是对哪个类进行日志打印信息,以及打印配置的日志信息的级别


logging:
level:
# 对 MemberFeignService 接口调用过程打印信息-Debug
com.rainbowsea.springcloud.service.MemberFeignService: debug
server:
port: 80
spring:
application:
name: member-service-consumer-openfeign-80 # 配置 eureka client 注意,因为这里该模块是作为 client 客户端的角色的,所有要将自己client的信息发送给 Server 当中去的
eureka:
client:
register-with-eureka: true # 表示将自己注册到 Eureka-Server 当中
fetch-registry: true # 表示将信息发送到 Eureka-Server 当中
service-url:
# 表示将自己注册到那个 eureka-server
# defaultZone: http://localhost:9001/eureka
# 将本微服务注册到多个 eureka - server 当中,使用逗号间隔即可
defaultZone: http://eureka9001.com:9001/eureka/,http://eureka9002.com:9002/eureka/ logging:
level:
# 对 MemberFeignService 接口调用过程打印信息-Debug
com.rainbowsea.springcloud.service.MemberFeignService: debug

测试

浏览器: http://localhost/member/consumer/openfeign/get/1

IDEA 后端查看打印的显示的日志信息:

4. OpenFeign 超时时间设置操作

OpenFeign 超时: 我们先来看如下一个问题:

我们模拟网络异常,在 member-service-provider-10000member-service-provider-10002 两个 service 服务提供方当中的 getMemberById 方法,模拟超时 ,这里暂停 5秒。

   // 模拟超时 ,这里暂停 5秒
try {
TimeUnit.SECONDS.sleep(5);
} catch (Exception e) {
e.printStackTrace();
}

浏览器访问 http://localhost/member/consumer/openfeign/get/1

测试效果:

浏览器显示: Read timed out executing GET http://MEMBER-SERVICE-PROVIDER/member/get/1

IDEA后端显示: java.net.SocketTimeoutException: Read timed out

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.RetryableException: Read timed out executing GET http://MEMBER-SERVICE-PROVIDER/member/get/1] with root cause

原因分析: OpenFeign 默认超时时间 1 秒钟 ,即等待返回结果 1 秒,超过了 1 秒,则会报错。

设置超时时间

说明: 在某些情况下,一个服务调用时间可能要超过 1 秒,就需要重新设置超时时间。

这里我们设置超时时间设置为:8秒,而我们模拟的是 5秒,5 秒小于 8 秒,可以还在超时时间的范围内,可以被访问。

对于 OpenFeign 超时时间,我们需要在 application.yaml 文件当中进行配置。 如下图所示:

# OpenFeign 超时
ribbon:
# #设置 feign 客户端超时时间(openFeign 默认支持 ribbon) #指的是建立连接后从服务器读取到可用资源所用的时间,
# #时间单位是毫秒
ReadTimeout: 8000
# #指的是建立连接所用的时间,适用于网络状况正常的情况下,
# #两端连接所用的时间
ConnectTimeout: 8000

server:
port: 80
spring:
application:
name: member-service-consumer-openfeign-80 # 配置 eureka client 注意,因为这里该模块是作为 client 客户端的角色的,所有要将自己client的信息发送给 Server 当中去的
eureka:
client:
register-with-eureka: true # 表示将自己注册到 Eureka-Server 当中
fetch-registry: true # 表示将信息发送到 Eureka-Server 当中
service-url:
# 表示将自己注册到那个 eureka-server
# defaultZone: http://localhost:9001/eureka
# 将本微服务注册到多个 eureka - server 当中,使用逗号间隔即可
defaultZone: http://eureka9001.com:9001/eureka/,http://eureka9002.com:9002/eureka/ logging:
level:
# 对 MemberFeignService 接口调用过程打印信息-Debug
com.rainbowsea.springcloud.service.MemberFeignService: debug # OpenFeign 超时
ribbon:
# #设置 feign 客户端超时时间(openFeign 默认支持 ribbon) #指的是建立连接后从服务器读取到可用资源所用的时间,
# #时间单位是毫秒
ReadTimeout: 8000
# #指的是建立连接所用的时间,适用于网络状况正常的情况下,
# #两端连接所用的时间
ConnectTimeout: 8000

浏览器输出: http://localhost/member/consumer/openfeign/get/1, 不会出现超时,会轮询访问 10000/10002

5. 补充:spring-boot-starter-actuator 是 spring boot 程序的监控系统,可以实现健康检查

当我们在 pom.xml 当中添加了 spring-boot-starter-actuator 的依赖 jar ,就就可以使用该 监控系统了。不需要其他的配置

spring-boot-starter-actuator 是spring boot 程序的监控系统,可以实现健康检查,info 信息等

访问http://localhost:80/actuator 可以看到相关链接,还可以做相关配置。

spring-boot-starter-actuator 访问的语法链接:url地址+自身模块对应的端口号/actuator

6. 总结:

  1. OpenFeign 是个声明式 WebService 客户端,使用 OpenFeign 让编写 Web Service客户端更简单。
  2. Feign 和 OpenFeign 区别
  3. Openfeign 的使用的特点:微服务接口+@FeignClient ,使用接口进行解耦(简单的说:就是使用接口调用对应 provider 提供服务的集群)
  4. OpenFeign 操作配置的注意事项和细节:
    1. Openfeign 的使用的特点:微服务接口+@FeignClient ,使用接口进行解耦(简单的说:就是使用接口调用对应 provider 提供服务的集群)
    2. 接口方法上的: value 是不能乱写的,远程调用的url为 : 对应你想要调用哪个 provider 名称的别名/名称 http://MEMBER-SERVICE-PROVIDER/member/get/{id};接口上的方法,也必须与调用的 provider 当中的方法保持一致:
  5. OpenFeign 内置的“日志配置”:OpenFeign 提供了日志打印功能,可以通过配置来调整日志级别,从面对 OpenFeign 接口的调用情况进行监控和输出。
  6. OpenFeign 超时时间设置操作
  7. spring-boot-starter-actuator 是 spring boot 程序的监控系统,可以实现健康检查,spring-boot-starter-actuator 是spring boot 程序的监控系统,可以实现健康检查,info 信息等

spring-boot-starter-actuator 访问的语法链接:url地址+自身模块对应的端口号/actuator

7. 最后:

“在这个最后的篇章中,我要表达我对每一位读者的感激之情。你们的关注和回复是我创作的动力源泉,我从你们身上吸取了无尽的灵感与勇气。我会将你们的鼓励留在心底,继续在其他的领域奋斗。感谢你们,我们总会在某个时刻再次相遇。”

5. Spring Cloud OpenFeign 声明式 WebService 客户端的超详细使用的更多相关文章

  1. Spring Cloud Feign 声明式服务调用

    目录 一.Feign是什么? 二.Feign的快速搭建 三.Feign的几种姿态 参数绑定 继承特性 四.其他配置 Ribbon 配置 Hystrix 配置 一.Feign是什么? ​ 通过对前面Sp ...

  2. Spring Cloud 2-Feign 声明式服务调用(三)

    Spring Cloud Feign  1. pom.xml 2. application.yml 3. Application.java 4. Client.java 简化RestTemplate调 ...

  3. Spring Cloud Feign声明式服务调用(转载)+遇到的问题

    转载:原文 总结: 1.pom添加依赖 2.application中填写正确的eureka配置 3.启动项中增加注解 @EnableFeignClients 4.填写正确的调用接口 通过原文使用Fei ...

  4. SpringCloud微服务实战二:Spring Cloud Ribbon 负载均衡 + Spring Cloud Feign 声明式调用

    1.Spring Cloud Ribbon的作用 Ribbon是Netflix开发的一个负载均衡组件,它在服务体系中起着重要作用,Pivotal将其整合成为Spring Cloud Ribbon,与其 ...

  5. 笔记:Spring Cloud Feign 声明式服务调用

    在实际开发中,对于服务依赖的调用可能不止一处,往往一个接口会被多处调用,所以我们通常会针对各个微服务自行封装一些客户端类来包装这些依赖服务的调用,Spring Cloud Feign 在此基础上做了进 ...

  6. 3.【Spring Cloud Alibaba】声明式HTTP客户端-Feign

    使用Feign实现远程HTTP调用 什么是Feign Feign是Netflix开源的声明式HTTP客户端 GitHub地址:https://github.com/openfeign/feign 实现 ...

  7. Spring Cloud 入门教程(六): 用声明式REST客户端Feign调用远端HTTP服务

    首先简单解释一下什么是声明式实现? 要做一件事, 需要知道三个要素,where, what, how.即在哪里( where)用什么办法(how)做什么(what).什么时候做(when)我们纳入ho ...

  8. spring cloud 声明式rest客户端feign调用远程http服务

    在Spring Cloud Netflix栈中,各个微服务都是以HTTP接口的形式暴露自身服务的,因此在调用远程服务时就必须使用HTTP客户端.Feign就是Spring Cloud提供的一种声明式R ...

  9. Spring Cloud官方文档中文版-声明式Rest客户端:Feign

    官方文档地址为:http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#spring-cloud-feign 文中例子我做了一些测试在:http ...

  10. Feign 系列(05)Spring Cloud OpenFeign 源码解析

    Feign 系列(05)Spring Cloud OpenFeign 源码解析 [TOC] Spring Cloud 系列目录(https://www.cnblogs.com/binarylei/p/ ...

随机推荐

  1. Ubuntu 安装基于 DEB 的 Firefox

    自从 Canonical 推出了 Snap 之后,在所有新推出的 Ubuntu 发行版中都预装了 Snap 版的 Firefox,并将 APT 中的 Firefox 包指向了 Snap 的 Firef ...

  2. LaTeX 生成黑底白字的 PDF

    最近需要深夜看论文,然而白底的 PDF 看久了眼睛很难受,想转换成黑底的.正好我有论文的 LaTeX 源码,因此可以直接编译黑底的 PDF 出来. 使用 darkmode 宏包 CTAN 上有一个 L ...

  3. 工程化Vue使用

    目录 环境准备 Vue项目-创建 Vue项目开发流程 API风格 案例 推荐阅读: VUE-局部使用 环境准备 介绍:create-vue是Vue官方提供的最新的脚手架工具,用于快速生成一个工程化的V ...

  4. 利用分布式锁在ASP.NET Core中实现防抖

    前言 在 Web 应用开发过程中,防抖(Debounce) 是确保同一操作在短时间内不会被重复触发的一种有效手段.常见的场景包括防止用户在短时间内重复提交表单,或者避免多次点击按钮导致后台服务执行多次 ...

  5. 内网渗透-Windows常用提权方法

    一.前言 将介绍常见的提权方法.从为什么该方法能够提权(原理)到使用方法. 二.系统内核漏洞提权 1.为什么能提权? 内核漏洞通常是指内核溢出漏洞,什么溢出呢?缓冲区溢出. 那什么是缓冲区溢出呢?当应 ...

  6. vue3项目部署到Github

    此教程适应于以webpack,vue-cli,vite等脚手架构建的vue项目.当然,vue2和vue3都是可以滴. 1. 前提:你的代码库已经提交到Github上 如果没有的话,请到GitHub上新 ...

  7. [namespace hdk] modint

    template<long long mod=INT_MAX,typename T0=long long> class modint{ private: T0 x; long long p ...

  8. Hadoop完全分布式搭建,基于乌班图系统

    因为现在集成的工具很多,建议在接触这一块的过程中还是自己找几个主机,亲手搭一遍集群,更好的熟悉底层!本文只是搭建的过程没有理论!手搭集群时先将各节点网络.ssh配置好!然后在一台机子上操作配置文件,直 ...

  9. USB协议详解第7讲(补充-USB帧和微帧剖析)

    1.概念 (1)USB2.0帧和微帧属于物理层时间基准的概念,低速和全速下每个帧时长为1ms,高速下每个帧又分为8个微帧,即每个微帧时长为125us. (2)USB主机和设备控制器同步后,每个微帧起始 ...

  10. 墨天轮访谈 | SelectDB 衣国垒:Apache Doris(incubating)1.0版本特性解析与未来规划

    分享嘉宾:衣国垒 Apache Doris Committer.SelectDB 联合创始人&CTO 整理:墨天轮社区 导读 大家好,我是来自Apache Doris社区的衣国垒,也是Sele ...