首页
归档
留言
友链
广告合作
壁纸
更多
美女主播
Search
1
博瑞GE车机升级/降级
5,605 阅读
2
Mac打印机设置黑白打印
4,933 阅读
3
修改elementUI中el-table树形结构图标
4,894 阅读
4
Mac客户端添加腾讯企业邮箱方法
4,671 阅读
5
intelliJ Idea 2022.2.X破解
4,353 阅读
后端开发
HarmonyOS Next
Web前端
微信开发
开发辅助
App开发
数据库
随笔日记
登录
/
注册
Search
标签搜索
Spring Boot
Java
Vue
Spring Cloud
Mac
MyBatis
WordPress
MacOS
asp.net
Element UI
Nacos
.Net
Spring Cloud Alibaba
MySQL
Mybatis-Plus
Typecho
jQuery
Java Script
微信小程序
Oracle
Laughing
累计撰写
626
篇文章
累计收到
1,421
条评论
首页
栏目
后端开发
HarmonyOS Next
Web前端
微信开发
开发辅助
App开发
数据库
随笔日记
页面
归档
留言
友链
广告合作
壁纸
美女主播
搜索到
626
篇与
的结果
2021-07-28
Spring Cloud集成Sentinel之持久化规则
在使用Sentinel我们发现,只要重新启动Sentinel的Java 客户端服务,Sentinel控制台配置的限流规则,就清空不存在了,下面介绍怎么持久化Sentinel规则。我们继续修改前面的代码。增加依赖 <!-- sentinel-datasource-nacos --> <dependency> <groupId>com.alibaba.csp</groupId> <artifactId>sentinel-datasource-nacos</artifactId> </dependency>修改配置增加增加Nacos数据源server: port: 8401 spring: application: name: cloudalibaba-sentinel-service cloud: nacos: discovery: server-addr: 192.168.120.180:1111 sentinel: transport: dashboard: 192.168.120.180:9000 # 默认8719端口,假如端口被占用,依次+1,直到找到未被占用端口 port: 8719 datasource: ds1: nacos: server-addr: 192.168.120.180:1111 dataId: nacos-consumer-order groupId: DEFAULT_GROUP data-type: json rule-type: flow management: endpoints: web: exposure: include: "*"在Nacos配置中心,增加配置[{ "resource": "/testQPSA", "limitApp": "default", "grade": 1, "count": 1, "strategy": 0, "controlBehavior": 0, "clusterMode": false }]需要注意:dataId、groupId、data-type属性,Nacos配置中心需要与配置文件的保持一致。此时,我们再次1s内多次刷新http://localhost:8401/testQPSA,看到会被限流
2021年07月28日
1,021 阅读
0 评论
1 点赞
2021-07-28
Spring Cloud集成Sentinel之@SentinelResource注解使用
通过Spring Cloud集成Sentinel之流量控制及Spring Cloud集成Sentinel之服务熔断降级两篇文章,我们可以发现一个问题,当系统触发限流或者熔断时,系统排除的异常很不友好。现在前后端分离项目,我们后端一般会封装一个公共的实体返回给前端,比如下面代码中的CommonResult,了解到这,我们分别介绍以下@SentinelResource注解中常用的几个参数:value、blockHandler、fallback。测试代码@SentinelResource注解代码@RestController public class RateLimitController { @GetMapping("/byResource") @SentinelResource(value = "byResource", blockHandler = "handleException",fallback = "handleFallback") public CommonResult byResource() { return new CommonResult(200, "按资源名称限量ok", new Payment(2020L, "SERIAL001")); } public CommonResult handleException(BlockException exception) { return new CommonResult(444, exception.getClass().getCanonicalName() + "\t 服务不可用"); } public CommonResult handleFallback(Throwable exception) { return new CommonResult(444, exception.getClass().getCanonicalName() + "\t 服务不可用"); } @GetMapping("/rateLimit/customerBlockHandler") @SentinelResource(value = "customerBlockHandler",blockHandlerClass = MyHandler.class,blockHandler = "handlerException2") public CommonResult customerBlockHandler() { return new CommonResult(200, "按资源名称限量ok", new Payment(2020L, "SERIAL001")); } }异常代码public class MyHandler { public static CommonResult handlerException1(BlockException exception) { return new CommonResult(4444, "按客户自定义的global handlerException---1"); } public static CommonResult handlerException2(BlockException exception) { return new CommonResult(4444, "按客户自定义的global handlerException---2"); } }valuevalue用于指定资源名称。在Sentinel配置中,我们前面使用的api地址作为的资源名称,其实也可以通过这个value指定资源名称。在Sentinel中,如果以/开头,那么便意味着通过api地址作为资源名,否则系统认为value作为资源名。比如这个方法@GetMapping("/rateLimit/customerBlockHandler") @SentinelResource(value = "customerBlockHandler",blockHandlerClass = MyHandler.class,blockHandler = "handlerException2") public CommonResult customerBlockHandler() { return new CommonResult(200, "按资源名称限量ok", new Payment(2020L, "SERIAL001")); }在sentinel配置中,指定资源名称/rateLimit/customerBlockHandler或customerBlockHandler是等价的。{message type="warning" content="value必须是唯一的"/}只指定fallbackfallback负责业务异常和限流时处理。测试代码 @GetMapping("/fallbackOnly") @SentinelResource(value = "fallbackOnly", fallback = "handlefallbackOnlyException") public CommonResult fallbackOnly() { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } return new CommonResult(200, "按资源名称限量ok", new Payment(2020L, "SERIAL001")); }我们触发限流规则,可以看到如下输出,已经是我们自定义的异常类,而不是系统自带的。还有一个fallbackClass注解,如此类似,不再赘诉。只指定blockHandlerblockHandler只负责sentinel控制台配置违规测试代码 @GetMapping("/blockHandlerOnly") @SentinelResource(value = "blockHandlerOnly", blockHandler = "handleblockHandlerException") public CommonResult blockHandlerOnly() { int age = 10/0; return new CommonResult(200, "按资源名称限量ok", new Payment(2020L, "SERIAL001")); } public CommonResult handleblockHandlerException(BlockException exception) { return new CommonResult(444, exception.getClass().getCanonicalName() + "\t 服务不可用"); }我们触发一个熔断规则,可以看到如下输出fallback和blockHandler同时存在fallback负责处理异常,blockHandler负责sentinel控制台配置违规。@GetMapping("/byResource") @SentinelResource(value = "byResource", blockHandler = "handleException", fallback = "handleFallback") public CommonResult byResource() { return new CommonResult(200, "按资源名称限量ok", new Payment(2020L, "SERIAL001")); } public CommonResult handleException(BlockException exception) { return new CommonResult(444, "handleException\t 服务不可用"); } public CommonResult handleFallback(Throwable exception) { return new CommonResult(444, "handleFallback\t 服务不可用"); }
2021年07月28日
1,175 阅读
0 评论
0 点赞
2021-07-28
Spring Cloud集成Sentinel之热点参数
热点参数何为热点?热点即经常访问的数据。很多时候我们希望统计某个热点数据中访问频次最高的 Top K 数据,并对其访问进行限制。比如:商品 ID 为参数,统计一段时间内最常购买的商品 ID 并进行限制用户 ID 为参数,针对一段时间内频繁访问的用户 ID 进行限制热点参数限流会统计传入参数中的热点参数,并根据配置的限流阈值与模式,对包含热点参数的资源调用进行限流。热点参数限流可以看做是一种特殊的流量控制,仅对包含热点参数的资源调用生效。Sentinel 利用LRU策略统计最近最常访问的热点参数,结合令牌桶算法来进行参数级别的流控。热点参数限流支持集群模式。 @GetMapping("/testHotkey") // @SentinelResource(value = "testHotkey", blockHandler = "deal_testHotkey") @SentinelResource(value = "testHotkey") public String testHotkey(@RequestParam(value = "productId", required = false) String productId, @RequestParam(value = "userId", required = false) String userId) { return "--------------testHotkey"; }如果参数0,1s请求次数超过依次,触发熔断,但是如果参数0的值是p2,那么可以请求2次。自适应限流Sentinel 系统自适应限流从整体维度对应用入口流量进行控制,结合应用的 Load、CPU 使用率、总体平均 RT、入口 QPS 和并发线程数等几个维度的监控指标,通过自适应的流控策略,让系统的入口流量和系统的负载达到一个平衡,让系统尽可能跑在最大吞吐量的同时保证系统整体的稳定性。系统规则系统保护规则是从应用级别的入口流量进行控制,从单台机器的 load、CPU 使用率、平均 RT、入口 QPS 和并发线程数等几个维度监控应用指标,让系统尽可能跑在最大吞吐量的同时保证系统整体的稳定性。系统保护规则是应用整体维度的,而不是资源维度的,并且仅对入口流量生效。入口流量指的是进入应用的流量(EntryType.IN),比如 Web 服务或 Dubbo 服务端接收的请求,都属于入口流量。系统规则支持以下的模式:Load 自适应(仅对 Linux/Unix-like 机器生效):系统的 load1 作为启发指标,进行自适应系统保护。当系统 load1 超过设定的启发值,且系统当前的并发线程数超过估算的系统容量时才会触发系统保护(BBR 阶段)。系统容量由系统的 maxQps minRt 估算得出。设定参考值一般是 CPU cores 2.5。CPU usage(1.5.0+ 版本):当系统 CPU 使用率超过阈值即触发系统保护(取值范围 0.0-1.0),比较灵敏。平均 RT:当单台机器上所有入口流量的平均 RT 达到阈值即触发系统保护,单位是毫秒。并发线程数:当单台机器上所有入口流量的并发线程数达到阈值即触发系统保护。入口 QPS:当单台机器上所有入口流量的 QPS 达到阈值即触发系统保护。
2021年07月28日
1,059 阅读
0 评论
0 点赞
2021-07-28
Spring Cloud集成Sentinel之服务熔断降级
Sentinel除了流量控制以外,对调用链路中不稳定的资源进行熔断降级也是保障高可用的重要措施之一。由于调用关系的复杂性,如果调用链路中的某个资源不稳定,最终会导致请求发生堆积。Sentinel 熔断降级会在调用链路中某个资源出现不稳定状态时(例如调用超时或异常比例升高),对这个资源的调用进行限制,让请求快速失败,避免影响到其它的资源而导致级联错误。当资源被降级后,在接下来的降级时间窗口之内,对该资源的调用都自动熔断(默认行为是抛出DegradeException)。降级策略通常用以下几种方式来衡量资源是否处于稳定的状态:慢调用比例 (DEGRADE_GRADE_RT):当统计时常内持续进入N个请求同时请求数到达最小请求数,对应时刻的平均响应时间(秒级)均超过比例阈值,那么在接下的时间窗口(DegradeRule中的timeWindow,以s为单位)之内,对这个方法的调用都会自动地熔断(抛出DegradeException)。注意 Sentinel 默认统计的RT上限是4900ms,超出此阈值的都会算作4900ms。若需要变更此上限可以通过启动配置项 -Dcsp.sentinel.statistic.max.rt=xxx来配置。异常比例 (DEGRADE_GRADE_EXCEPTION_RATIO):当资源的在统计时常内请求量 >= N(可配置),并且每秒异常总数占通过量的比值超过阈值(DegradeRule中的count)之后,资源进入降级状态,即在接下的时间窗口(DegradeRule中的timeWindow,以s为单位)之内,对这个方法的调用都会自动地返回。异常比率的阈值范围是 [0.0, 1.0],代表0% - 100%。异常数 (DEGRADE_GRADE_EXCEPTION_COUNT):当资源近1分钟的异常数目超过阈值之后会进行熔断。注意由于统计时间窗口是分钟级别的,若timeWindow小于60s,则结束熔断状态后仍可能再进入熔断状态。代码测试慢调用比例测试代码@GetMapping("/testRT") public String testRT() { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } return "-----------testRT"; }在1s内,请求数如果超过5个,平均请求时常超过800ms的比例达到20%,那么在接下来的1min内进行服务熔断。一开始正常访问,但是访问第6次时,达到条件,出发熔断降级。异常比例测试代码@GetMapping("/testExceptionPer") public String testExceptionPer() { int age = 1 / 0; return "-----------testExceptionPer"; }在1s内,请求数如果超过5个,异常的比例达到10%,那么在接下来的1min内进行服务熔断。一开始访问,报以下异常,多次访问后,触发熔断降级异常数可以参考异常比例,不再赘述。
2021年07月28日
1,177 阅读
0 评论
0 点赞
2021-07-28
Spring Cloud集成Sentinel之流量控制
在Spring Cloud Alibaba sentinel的安装与配置中,我们介绍了Sentinel的功能以及安装部署方式。在Spring Cloud集成Sentinel之基础功能介绍中,我们介绍了如何在Spring Cloud中集成Sentinel。本文我们在上面的基础上继续深入,介绍一下Sentinel的流量控制功能。Sentinel流量控制介绍流量控制(flow control),其原理是监控应用流量的 QPS 或并发线程数等指标,当达到指定的阈值时对流量进行控制,以避免被瞬时的流量高峰冲垮,从而保障应用的高可用性。FlowSlot会根据预设的规则,结合前面NodeSelectorSlot、ClusterNodeBuilderSlot、StatisticSlot 统计出来的实时信息进行流量控制。限流的直接表现是在执行 Entry nodeA = SphU.entry(resourceName) 的时候抛出 FlowException 异常。FlowException 是 BlockException 的子类,您可以捕捉BlockException来自定义被限流之后的处理逻辑。同一个资源可以创建多条限流规则。FlowSlot会对该资源的所有限流规则依次遍历,直到有规则触发限流或者所有规则遍历完毕。一条限流规则主要由下面几个因素组成,我们可以组合这些元素来实现不同的限流效果:resource:资源名,即限流规则的作用对象count: 限流阈值grade: 限流阈值类型(QPS 或并发线程数)limitApp: 流控针对的调用来源,若为 default 则不区分调用来源strategy: 调用关系限流策略controlBehavior: 流量控制效果(直接拒绝、Warm Up、匀速排队)名词解释资源名:唯一名称、默认请求路径,也可以通过@SentinelResource的value属性指定,不可重复。针对来源:Sentinel可以针对调用者进行限流,填写微服务名,默认default(不区分来源)阀值类型/单机阀值:QPS(每秒钟的请求数量):当调用该api的QPS达到阀值的时候,进行限流线程数:当调用该api的线程数达到阀值的时候,进行限流是否集群:不需要集群流控模式:直接:api达到限流条件时,直接限流关联:当关联的资源达到阀值时,就限流自己链路:只记录指定链路上的流量(指定资源从入口资源进来的流量,如果达到阀值,就限流)【api级别的针对来源】流控效果:快速失败:直接失败,抛异常Warm Up:根据codeFactor(冷加载因子,默认3)的值,从阀值/codeFactor,经过预热时长,才达到设置的QPS阀值排队等待:匀速排队,让请求以均匀的速度通过,阀值类型必须设置为QPS,否则无效代码展示基于QPS的流量控制当QPS超过某个阈值的时候,则采取措施进行流量控制。流量控制的效果包括以下几种:直接拒绝、Warm Up、匀速排队。对应FlowRule中的 controlBehavior字段。在代码中增加以下服务接口 @GetMapping("/testQPSA") public String testA() { return "-----------testQPSA"; }如何此时我们不配置Sentinel,无论如何访问,都不会报错,流量会直接打到服务器,直到服务器崩溃。此时,我们打开Sentinel,设置流控如下配置的信息代表每秒最多允许一个请求,超过依次的请求直接报错。此时我们快速刷新接口,可以看到以下信息基于并发数的流量控制基于并发数的控制,也就是控制同一时刻能够访问接口的数量。 @GetMapping("/testThreadA") public String testThreadA() { try { TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } return "-----------testThreadA"; }为了测试方便,我让程序暂停10S。上图代表我们统一时刻只能有一个线程访问。然后启动用浏览器及curl命令同时访问。可以看到第一个浏览器能正常打开,但是curl命令的无法访问。流控模式:直接以上两个例子都是直接控制,也就是关联自己的资源。流控模式:关联当两个资源之间具有资源争抢或者依赖关系的时候,这两个资源便具有了关联。像对数据库同一个字段的读操作和写操作存在争抢,读的速度过高会影响写得速度,写的速度过高会影响读的速度。如果放任读写操作争抢资源,则争抢本身带来的开销会降低整体的吞吐量。这次我们新增以下两个服务。 @GetMapping("/testRelationA") public String testRelationA() { log.info(Thread.currentThread().getName() + "\t testRelationA"); return "-----------testRelationA"; } @GetMapping("/testRelationB") public String testRelationB() { log.info(Thread.currentThread().getName() + "\t testRelationB"); return "-----------testRelationB"; }我们模拟:当testRelationB达到阈值时,停止testRelationA服务。这次我们用JMeter进行测试,使用JMeter循环访问testRelationB可以看到testRelationB访问一直正常,但是testRelationA此时已经不能访问了。流控模式:链路只记录指定链路上的流量(指定资源从入口资源进来的流量,如果达到阈值,就可以限流)这次我们删除所有的流控规则,查看sentinel我们可以看到/testRelationB的资源入口是sentinel_web_servlet_context这次我们设置流控规则如下多次点击http://localhost:8401/testRelationB,可以看到浏览器显示流控效果:快速失败以上代码都是直接快速失败的例子,当QPS超过任意规则的阈值后,新的请求就会被立即拒绝,拒绝方式为抛出FlowException。这种方式适用于对系统处理能力确切已知的情况下,比如通过压测确定了系统的准确水位时。流控效果:Warm Up(预热)Warm Up(RuleConstant.CONTROL_BEHAVIOR_WARM_UP)方式,即预热/冷启动方式。当系统长期处于低水位的情况下,当流量突然增加时,直接把系统拉升到高水位可能瞬间把系统压垮。通过"冷启动",让通过的流量缓慢增加,在一定时间内逐渐增加到阈值上限,给冷系统一个预热的时间,避免冷系统被压垮。我们增加以下代码。测试预测@GetMapping("/testWarmup") public String testWarmup() { return "-----------testWarmup"; }以上表示,一开始系统QPS为1(3/3),10秒之后,系统QPS为3。启用JMeter测试,设置请求100个,系统处理时间为50s,也就说1s发送两个请求。可以看到,一开始,间隔成功一个、失败一个(因为我们JMeter设置的是1s处理两个请求,而Sentinel设置的是1s只能处理一个请求),10秒之后,就一直成功了(因为10s后,阈值为10,也就是说我们1s能处理10个请求,小于我们JMeter测试的一秒两个请求)流控效果:排队等待排队等待(RuleConstant.CONTROL_BEHAVIOR_RATE_LIMITER)方式会严格控制请求通过的间隔时间,也即是让请求以均匀的速度通过,对应的是漏桶算法。这种方式主要用于处理间隔性突发的流量,例如消息队列。想象一下这样的场景,在某一秒有大量的请求到来,而接下来的几秒则处于空闲状态,我们希望系统能够在接下来的空闲期间逐渐处理这些请求,而不是在第一秒直接拒绝多余的请求。 @GetMapping("/testQueue") public String testQueue() { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } return "-----------testQueue"; }一次处理一个请求,超时时间为20S使用JMeter默认10个请求可以看到每个线程大概耗时都是1s。
2021年07月28日
1,201 阅读
0 评论
0 点赞
2021-07-28
Spring Cloud集成Sentinel之基础功能介绍
Sentinel涉及的知识点比较多,我们这篇文章先看一下基础的,如何在Spring Cloud中引入Sentiel。父工程与前面章节介绍的父工程一样,这里之简单罗列一下依赖<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <junit.version>4.12</junit.version> <log4j.version>1.2.17</log4j.version> <lombok.version>1.16.18</lombok.version> <mysql.version>5.1.47</mysql.version> <druid.version>1.1.16</druid.version> <mybatis.spring.boot.version>1.3.0</mybatis.spring.boot.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.3.12.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Hoxton.SR12</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <!-- <version>2.1.0.RELEASE</version>--> <version>2.2.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${druid.version}</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>${mybatis.spring.boot.version}</version> </dependency> </dependencies> </dependencyManagement>添加服务提供者添加依赖<?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>Cloud2020</artifactId> <groupId>cc.lisen</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cloudalibaba-sentiel-service8401</artifactId> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.5</version> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency> <dependency> <groupId>cc.lisen</groupId> <artifactId>cloud-api-common</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> </project>修改配置文件主要是配置Nacos服务器及Sentinel Dashboard的地址。server: port: 8401 spring: application: name: cloudalibaba-sentinel-service cloud: nacos: discovery: server-addr: 192.168.120.180:1111 sentinel: transport: dashboard: 192.168.120.180:9000 # 默认8719端口,假如端口被占用,依次+1,直到找到未被占用端口 port: 8719 management: endpoints: web: exposure: include: "*"增加接口@RestController @Slf4j public class FlowLimitController { @GetMapping("/testA") public String testA() { return "-----------testA"; } @GetMapping("/testB") public String testB() { log.info(Thread.currentThread().getName() + "\ttestB"); return "-----------testB"; } @GetMapping("/testD") public String testD() { int age = 10 / 0; log.info(Thread.currentThread().getName() + "\ttestB"); return "-----------testD"; } @GetMapping("/testHotkey") @SentinelResource(value = "testHotkey", blockHandler = "deal_testHotkey") public String testHotkey(@RequestParam(value = "p1", required = false) String p1, @RequestParam(value = "p2", required = false) String p2) { return "--------------testHotkey"; } public String deal_testHotkey(String p1, String p2, BlockException blockException) { return "--------------deal_testHotkey"; } }测试访问http://localhost:8401/testA,然后打开Sentinel Dashboard,可以看到我们当前定义的服务接口。一定要访问依次我们的服务接口,否则在sentinel dashboard中无法看到
2021年07月28日
1,117 阅读
0 评论
1 点赞
2021-07-28
Spring Cloud Alibaba sentinel的安装与配置
sentinel简介Sentinel 是面向分布式服务架构的高可用流量防护组件,主要以流量为切入点,从限流、流量整形、熔断降级、系统负载保护、热点防护等多个维度来帮助开发者保障微服务的稳定性。Sentinel 具有以下特性:丰富的应用场景:Sentinel承接了阿里巴巴近 10 年的双十一大促流量的核心场景,例如秒杀(即突发流量控制在系统容量可以承受的范围)、消息削峰填谷、集群流量控制、实时熔断下游不可用应用等。完备的实时监控:Sentinel 同时提供实时的监控功能。您可以在控制台中看到接入应用的单台机器秒级数据,甚至 500 台以下规模的集群的汇总运行情况。广泛的开源生态:Sentinel 提供开箱即用的与其它开源框架/库的整合模块,例如与 Spring Cloud、Dubbo、gRPC 的整合。您只需要引入相应的依赖并进行简单的配置即可快速地接入 Sentinel。完善的 SPI 扩展点:Sentinel 提供简单易用、完善的 SPI 扩展接口。您可以通过实现扩展接口来快速地定制逻辑。例如定制规则管理、适配动态数据源等。sentinel与hystrix区别提到服务的限流、熔断,就不得不提大名鼎鼎的豪猪哥(hystrix)。只是这货目前停更了。随着Spring Cloud 2020发布,hystix组件也被移除了。Sentinel 基本概念资源资源是 Sentinel 的关键概念。它可以是 Java 应用程序中的任何内容,例如,由应用程序提供的服务,或由应用程序调用的其它应用提供的服务,甚至可以是一段代码。在接下来的文档中,我们都会用资源来描述代码块。只要通过 Sentinel API 定义的代码,就是资源,能够被 Sentinel 保护起来。大部分情况下,可以使用方法签名,URL,甚至服务名称作为资源名来标示资源。规则围绕资源的实时状态设定的规则,可以包括流量控制规则、熔断降级规则以及系统保护规则。所有规则可以动态实时调整。Sentinel 是如何工作的Sentinel 的主要工作机制如下:对主流框架提供适配或者显示的 API,来定义需要保护的资源,并提供设施对资源进行实时统计和调用链路分析。根据预设的规则,结合对资源的实时统计信息,对流量进行控制。同时,Sentinel 提供开放的接口,方便您定义及改变规则。Sentinel 提供实时的监控系统,方便您快速了解目前系统的状态。sentinel安装下载按钮官方下载地址运行官方下载下来的是一个jar包,默认端口是8080执行以下命令运行即可java -jar -Dserver.port=9000 /root/sentinel/sentinel-dashboard-1.8.2.jar如果想后台运行,可以执行以下命令wsl -u root nohup java -jar -Dserver.port=9000 /root/sentinel/sentinel-dashboard-1.8.2.jar >log.out 2>1 &默认用户名、密码都是sentinel
2021年07月28日
1,077 阅读
0 评论
1 点赞
2021-07-27
Spring Cloud使用OpenFeign调用Nacos服务提供者
什么是OpenFeignOpenFeign为微服务架构下服务之间的调用提供了解决方案,OpenFeign是一种声明式、模板化的HTTP客户端。在Spring Cloud中使用OpenFeign,可以做到使用HTTP请求访问远程服务,就像调用本地方法一样的,开发者完全感知不到这是在调用远程方法,更感知不到在访问HTTP请求。Spring Cloud 2020版本已经彻底移除了Netflix相关组件,OpenFeign便是Feign的替换者。本文我们是在Spring Cloud使用Nacos作为服务中心编写服务提供者的基础上进行的,通过OpenFeign调用前面编写的nacos-provider-payment服务。编写服务消费者创建cloudalibaba-consumer-order8888工程,调用我们编写的nacos-provider-payment服务。添加依赖<?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>Cloud2020</artifactId> <groupId>cc.lisen</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cloudalibaba-consumer-order9003</artifactId> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.5</version> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency> <dependency> <groupId>com.alibaba.csp</groupId> <artifactId>sentinel-datasource-nacos</artifactId> </dependency> </dependencies> </project>修改配置文件修改application.yml增加Nacos相关配置。server: port: 8888 spring: application: name: nacos-consumer-order cloud: nacos: discovery: server-addr: 192.168.120.180:1111 management: endpoints: web: exposure: include: "*" 修改启动类添加@EnableFeignClients注解,支持使用OpenFeign@SpringBootApplication //@EnableDiscoveryClient @EnableFeignClients public class NacosConsumerOrderMain8888 { public static void main(String[] args) { SpringApplication.run(NacosConsumerOrderMain8888.class, args); } }编写Feign客户端添加@FeignClient注解,value便是我们服务提供者的名称。@FeignClient(value = "nacos-provider-payment") public interface NacosPaymentService { @GetMapping(value = "/echo/{string}") String echo(@PathVariable("string") String string); }测试编写controller进行测试@RestController @Slf4j @RequestMapping("/nacos/consumer") public class NacosConsumerController { @Resource private NacosPaymentService nacosPaymentService; @GetMapping("/echo/{id}") public String echo(@PathVariable("id") String id) throws IllegalAccessException { log.info("******************输出:" + id); return nacosPaymentService.echo(id); } }OpenFeign超时控制OpenFeign调用接口,默认超时时间为1S。我们修改一下nacos-provider-payment服务,让放服务暂停2s,然后查看一下接口调用。 @GetMapping(value = "/echo/{string}") public String echo(@PathVariable("string") String string) { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } return "Hello Nacos Discovery " + string+"\t当前服务端口:"+serverPort; }但是有时候我们业务接口可能需要处理的时间较长,那么我们可以配置接口调用的超时时间。我们可以在配置文件中增加以下内容#设置feign客户端超时时间(OpenFeign默认支持ribbon) ribbon: #指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间 ReadTimeout: 5000 #指的是建立连接后从服务器读取到可用资源所用的时间 ConnectTimeout: 5000我们再次测试接口,可以发现接口可以正常调用。OpenFeign日志打印功能增加日志bean@Configuration public class FeignConfig { @Bean Logger.Level feignLoggerLevel() { return Logger.Level.FULL; } }修改配置文件YML文件里配置需要开启日志的Feign客户端logging: level: cc.lisen.springcloud.alibaba.service.NacosPaymentService: debug测试再次调用接口,可以看到输出的日志负载均衡如果我们同时启动了9001、9002端口,也就是说我们针对服务提供者做了集群,那么我们多次调用服务提供者时,会发现系统会依次输出9001、9002端口。也就是说,OpenFeign自带了负债均衡功能,默认采用的时轮询算法。我们修改一下默认的负债均衡算法,设置的简单一点,如果我们的请求包含name=zhangsan参数,就调用到9001端口,否则就调用9002端口。实现IRule接口public class CustomerBalancerRule implements IRule { private ILoadBalancer balancer = new BaseLoadBalancer(); @Override public Server choose(Object object) { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String name = request.getParameter("name"); List<Server> servers = balancer.getAllServers(); if ("zhangsan".equals(name)) { if (servers.stream().anyMatch(e -> e.getPort() == 9001)) { return servers.stream().filter(e -> e.getPort() == 9001).collect(Collectors.toList()).get(0); } return servers.get(0); } return servers.get(1); } @Override public void setLoadBalancer(ILoadBalancer iLoadBalancer) { this.balancer = iLoadBalancer; } @Override public ILoadBalancer getLoadBalancer() { return this.balancer; } }配置服务提供者,调用负载均衡算法#设置feign客户端超时时间(OpenFeign默认支持ribbon) nacos-provider-payment: ribbon: #指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间 ReadTimeout: 5000 #指的是建立连接后从服务器读取到可用资源所用的时间 ConnectTimeout: 5000 NFLoadBalancerRuleClassName: cc.lisen.springcloud.alibaba.config.CustomerBalancerRule
2021年07月27日
1,148 阅读
0 评论
0 点赞
2021-07-27
Spring Cloud使用Nacos作为服务中心编写服务提供者
在Nacos集群配置中,我们介绍了Nacos的安装以及集群配置,本文我们介绍一下在Spring Cloud中如何使用Nacos作为服务注册中心。编写父工程父工程只提供基本的依赖关系,一定要注意版本,否则会出现很多乱七八糟的错误。父工程依赖如下<?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"> <modelVersion>4.0.0</modelVersion> <groupId>cc.lisen</groupId> <artifactId>Cloud2020</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>cloud-provider-payment8001</module> <module>cloud-consumer-order80</module> <module>cloud-api-common</module> <module>cloud-provider-payment8004</module> <module>cloud-consumerzk-order80</module> <module>cloud-consumer-feign-order80</module> <module>cloud-provider-hystrix-payment8001</module> <module>cloud-consumer-feign-hystrix-order80</module> <module>cloud-consumer-hystrix-dashboard9001</module> <module>cloud-gateway-gateway9527</module> <module>cloud-config-center-3344</module> <module>cloud-config-client-3355</module> <module>cloud-config-client-3366</module> <module>cloud-stream-rabbitmq-provider8801</module> <module>cloud-stream-rabbitmq-consumer8802</module> <module>cloud-stream-rabbitmq-consumer8803</module> <module>cloud-stream-rabbitmq-consumer8802</module> <module>cloud-stream-rabbitmq-consumer8803</module> <module>cloud-stream-rabbitmq-consumer8803</module> <module>cloudalibaba-provider-payment9001</module> <module>cloudalibaba-provider-payment9002</module> <module>cloudalibaba-consumer-order8888</module> <module>cloudalibaba-config-nacos-client3377</module> <module>cloudalibaba-sentinel-service8401</module> <module>seata-order-service2001</module> <module>seata-storage-service2002</module> <module>seata-account-service2003</module> </modules> <!-- 统一管理jar包版本--> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <junit.version>4.12</junit.version> <log4j.version>1.2.17</log4j.version> <lombok.version>1.16.18</lombok.version> <mysql.version>5.1.47</mysql.version> <druid.version>1.1.16</druid.version> <mybatis.spring.boot.version>1.3.0</mybatis.spring.boot.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.3.12.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Hoxton.SR12</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <!-- <version>2.1.0.RELEASE</version>--> <version>2.2.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${druid.version}</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>${mybatis.spring.boot.version}</version> </dependency> </dependencies> </dependencyManagement> <build> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <plugin> <artifactId>maven-site-plugin</artifactId> <version>3.7.1</version> </plugin> <plugin> <artifactId>maven-project-info-reports-plugin</artifactId> <version>3.0.0</version> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <configuration> <locales>en,fr</locales> </configuration> </plugin> </plugins> </build> <reporting> <plugins> <plugin> <artifactId>maven-project-info-reports-plugin</artifactId> </plugin> </plugins> </reporting> </project> 请忽略其他的项目模块。编写服务提供者编写一个简单的服务提供者,输出一个字符串。添加依赖<?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>Cloud2020</artifactId> <groupId>cc.lisen</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>cloudalibaba-provider-payment9002</artifactId> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.5</version> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> </dependencies> </project>修改配置文件server: port: 9001 spring: application: name: nacos-provider-payment cloud: nacos: discovery: server-addr: 192.168.120.180:8848 management: endpoints: web: exposure: include: "*"修改启动类@SpringBootApplication public class PaymentProviderMain9001 { public static void main(String[] args){ SpringApplication.run(PaymentProviderMain9001.class,args); } }编写服务接口@RestController @Slf4j public class NacosController { @Value("${server.port}") private String serverPort; @GetMapping(value = "/echo/{string}") public String echo(@PathVariable String string) { return "Hello Nacos Discovery " + string+"\t当前服务端口:"+serverPort; } }启动服务,我们可以查看一下Nacos是否有对应的服务。集群一般情况下,为了系统的健壮性,我们都会进行集群。我这里为了方便调试,复制了一个cloudalibaba-provider-payment9001工程,只是将端口号改成9002,然后,我们启动9002端口项目,再次查看Nacos可以看到当前有两个实例了。集群的关键时服务名称需要一致,也就是我们配置文件中的spring.application.name必须保持一致。
2021年07月27日
1,029 阅读
0 评论
0 点赞
2021-07-27
win一键启动WSL并固定IP
在idea无法访问WSL中Nacos的解决办法一文中,我们介绍了通过nginx端口转发的方式访问WSL中安装的Nacos。但是,如果你又安装了Seata,你会发现用端口映射会报错,这个大家可以自己试一下。其实,我们在使用WSL(我安装的Ubuntu 20.04)时,系统会给我们分配一个IP地址。我们通过ifconfig命令可以查看IP地址。所以,更好的方式,肯定是我们通过这个分配的内网IP进行访问。但是,问题又来了,我们每次重启WSL之后,系统会重新分配以下IP地址,这肯定不是我们想要的结果,不然每个项目光改IP都能疯。同时,每次重启我们如果都执行一边服务启动命令(比如打开ssh、打开nginx、打开mysql等)也比较崩溃。基于此,我们可以设置一个批量命令,一方面启动WSL同时可以自动设置一个固定的IP并开启我们的一些服务。新建一个.bat的文件,粘贴以下内容@echo off setlocal enabledelayedexpansion ::不管三七二十一先停掉可能在跑的wsl实例 wsl --shutdown ubuntu ::重新拉起来,并且用root的身份,启动服务 wsl -u root service ssh start wsl -u root service nginx start wsl -u root service mysql start if !errorlevel! equ 0 ( :: 看看我要的IP在不在 wsl -u root ip addr | findstr "192.168.120.180" > nul if !errorlevel! equ 0 ( echo wsl ip has set ) else ( ::不在的话给安排上 wsl -u root ip addr add 192.168.120.180/24 broadcast 192.168.120.0 dev eth0 label eth0:1 echo set wsl ip success: 192.168.120.180 ) ::windows作为wsl的宿主,在wsl的固定IP的同一网段也给安排另外一个IP ipconfig | findstr "192.168.120.100" > nul if !errorlevel! equ 0 ( echo windows ip has set ) else ( netsh interface ip add address "vEthernet (WSL)" 192.168.120.100 255.255.255.0 echo set windows ip success: 192.168.120.100 ) ) wsl -u root nohup /root/nacos/bin/startup.sh -m standalone >log.out 2>1 & wsl -u root nohup /root/seata/seata-server-1.4.2/bin/seata-server.sh >log.out 2>1 & pause然后右键管理员身份运行,这样,每次我们打开WSL时,就固定了IP地址,并且帮我们运行了服务。
2021年07月27日
2,095 阅读
0 评论
0 点赞
2021-07-27
idea无法访问WSL中Nacos的解决办法
最近在搞微服务的东西,所以在我笔记本上安装了一个WSL(Ubuntu 20.0.4),其实体验还好,只是在网络访问上面遇到了一些问题。一般情况下,我们访问WSL系统的东西时,通过localhost:port的形式即可。比如nginx通过localhost便能正常打开。但是安装Nacos后,通过浏览器能够正常打开但是,在idea中调用时,一直访问不通。{mtitle title="解决办法"/}想着参考集群部署的思路,通过nginx,将1111端口转发到了8848端口,便能正常访问了。修改nginx配置文件,在server节点同级增加以下内容upstream cluster{ server localhost:8848 weight=1; } server { listen 1111; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://cluster; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }然后重启nginx修改项目nacos端口,发现能够成功调用了。
2021年07月27日
2,201 阅读
0 评论
0 点赞
2021-07-27
Ubuntu 20.04换国内源 清华源 阿里源 中科大源 163源
Ubuntu 20.04 是 Ubuntu 的第 8 个 LTS 版本,其重大更新和改进将在 2030 年前终止,计划于2020年 4 月 23 日发布。 国内有很多Ubuntu的镜像源,包括阿里的、网易的,还有很多教育网的源,比如:清华源、中科大源。 我们这里以清华源为例讲解如何修改Ubuntu 20.04里面默认的源。 编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份):清华源# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse然后执行sudo apt-get update sudo apt-get upgrade阿里源deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse中科大源deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse网易163源deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
2021年07月27日
1,135 阅读
0 评论
0 点赞
1
...
20
21
22
...
53