springcloud(九):熔断器Hystrix和Feign的全套应用案例(二)
一、. 创建Eureka-Server 服务中心项目
1. 创建Eureka-Server 服务中心项目架构如下
2. pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
3.配置文件application.properties
#给当前服务起名
spring.application.name=eureka-server #给当前服务指定端口号
server.port=8761 #register-with-eureka :表示是将自己注册到Eureka Server,默认为true。
#因为当前应用就是Eureka Server,所以将其设置位false
#★当前服务时eureka的服务端还是客户端,当前是服务端因此false
eureka.client.register-with-eureka=false #fetch-registry :表示是否从Eureka Server获取注册信息,默认为true。不需要同步数据就将其设为false
#★是否从eureka服务中心获取信息,因为当前是服务端因此不需要在服务端获取信息
eureka.client.fetch-registry=false #defaultZone :设置与Eureka Server交互的地址,
#查询服务和注册服务都需要依赖这个地址。默认是http://localhost:8761/eureka ;
#多个地址可使用 , 分隔。
#将本eureka服务的地址公开暴露给所有的客户端,因为只有所有的客户端知道eureka服务的地址,才能将信息
#注册到eureka服务中心
eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
属性文件
4.启动类
package cn.kgc; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; //开启eureka的服务端
@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication { public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
} }
启动类
二、创建一方提供者eureka-client-provider-findcla
1. 项目结构如下:
2.pom.xml文件内容
<dependencies>
<!--引用公共组件-->
<dependency>
<groupId>cn.kgc</groupId>
<artifactId>eureka-common-clastu</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> <!--修改版本号-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
pom.xml
3.application.properties属性文件
#给当前服务起名字
spring.application.name=eureka-client-provider-findcla #给当前服务设置端口号
server.port=8762 #指定eureka-server的服务地址
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/ #数据源的配置
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.117.145:3306/kh66
spring.datasource.username=root
spring.datasource.password=ok #别名配置
mybatis.type-aliases-package=cn.kgc.vo
application.properties
4.ClassesMapper.java
package cn.kgc.mapper; import cn.kgc.vo.Classes;
import org.apache.ibatis.annotations.Select; import java.util.List; /**
* Created by Administrator on 2019/8/19.
*/
public interface ClassesMapper {
@Select("select * from classes")
List<Classes> optionData();
}
ClassesMapper.java
5.ClassesService.java
package cn.kgc.service; import cn.kgc.vo.Classes;
import org.apache.ibatis.annotations.Select; import java.util.List; /**
* Created by Administrator on 2019/8/19.
*/
public interface ClassesService { List<Classes> optionData();
}
ClassesService.java
6.ClassesServiceImpl.java
package cn.kgc.service; import cn.kgc.mapper.ClassesMapper;
import cn.kgc.vo.Classes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import java.util.List; @Service
public class ClassesServiceImpl implements ClassesService{
@Autowired
private ClassesMapper classesMapper; public List<Classes> optionData() {
return classesMapper.optionData();
}
}
ClassesServiceImpl.java
7.CenterController.java
package cn.kgc.controller; import cn.kgc.service.ClassesService;
import cn.kgc.vo.Classes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController
public class CenterController {
@Autowired
private ClassesService classesService; @RequestMapping(value = "/option.do")
public List<Classes> optionData() {
return classesService.optionData();
}
}
CenterController.java
8.启动类
package cn.kgc; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @MapperScan("cn.kgc.mapper")
@EnableEurekaClient
@SpringBootApplication
public class EurekaClientProviderFindclaApplication { public static void main(String[] args) {
SpringApplication.run(EurekaClientProviderFindclaApplication.class, args);
} }
启动类
三、创建多方提供者eureka-client-provider-findstu
1.项目结构如下:
2.pom.xml文件如下
<dependencies>
<!--引入公共组件-->
<dependency>
<groupId>cn.kgc</groupId>
<artifactId>eureka-common-clastu</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!--添加版本号-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <!--<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>8.16.2</version>
</dependency>-->
</dependencies>
pom.xml
3..StudentMapper.java
package cn.kgc.mapper; import cn.kgc.vo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update; import java.util.List;
import java.util.Map; /**
* Created by Administrator on 2019/8/19.
*/
public interface StudentMapper {
List<Map<String,Object>> showData(Student student); @Insert("INSERT INTO kh66.student (sname, password, subject, result, cid) VALUES(#{sname},#{password},#{subject},#{result},#{cid}) ")
int addStu(Student student); @Update("UPDATE kh66.student SET sname =#{sname}, password =#{password}, subject = #{subject}, result =#{result}, cid =#{cid} WHERE sid =#{sid} ")
int editStu(Student student); @Delete("delete from student where sid=#{sid}")
int delStu(Integer sid);
}
StudentMapper.java
4.StudentMapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.kgc.mapper.StudentMapper">
<select id="showData" parameterType="Student" resultType="map">
select s.*,c.cname from student s,classes c where s.cid=c.cid
<if test="sid!=null">
and s.sid=#{sid}
</if>
<if test="cid!=null and cid!=-1">
and s.cid=#{cid}
</if>
<if test="sname!=null">
and sname like concat('%',#{sname},'%')
</if>
</select>
</mapper>
StudentMapper.xml
5..StudentService.java
package cn.kgc.service; import cn.kgc.vo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.RequestBody; import java.util.List;
import java.util.Map; /**
* Created by Administrator on 2019/8/19.
*/
public interface StudentService {
List<Map<String,Object>> showData(Student student); int addStu(Student student); int editStu( Student student); int delStu(Integer sid);
}
StudentService.java
6.StudentServiceImpl.java
package cn.kgc.service; import cn.kgc.mapper.StudentMapper;
import cn.kgc.vo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import java.util.List;
import java.util.Map; @Service
@Transactional
public class StudentServiceImpl implements StudentService {
@Autowired
private StudentMapper studentMapper; @Override
public List<Map<String, Object>> showData( Student student) {
return studentMapper.showData(student);
} @Override
public int addStu(Student student) {
return studentMapper.addStu(student);
} @Override
public int editStu(Student student) {
return studentMapper.editStu(student);
} @Override
public int delStu(Integer sid) {
return studentMapper.delStu(sid);
}
}
StudentServiceImpl.java
7.CenterController.java
package cn.kgc.controller; import cn.kgc.mapper.StudentMapper;
import cn.kgc.service.StudentService;
import cn.kgc.vo.Student;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.ribbon.proxy.annotation.Http;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import java.util.List;
import java.util.Map; @RestController
public class CenterController{
ObjectMapper om=new ObjectMapper(); @Autowired
private StudentService studentService; @RequestMapping(value = "/data.do")
public List<Map<String,Object>> showData(@RequestBody Student student){
System.out.println("stu=showData>>>>>>>>student:"+student.getSid());
return studentService.showData(student);
} @RequestMapping(value = "/add.do")
public int addStu(@RequestBody Student student){
return studentService.addStu(student);
} @RequestMapping(value = "/edit.do")
public int editStu(@RequestBody Student student){
return studentService.editStu(student);
} @RequestMapping(value = "/del.do")
public int delStu(@RequestParam("sid") Integer sid) {
return studentService.delStu(sid);
}
/*
@RequestMapping(value = "/data.do",consumes = "application/json")
public String showData(@RequestBody Student student) throws Exception{
System.out.println("stu=showData>>>>>>>>student:"+student.getSid());
String str=om.writeValueAsString(studentService.showData(student)); return str;
} @RequestMapping(value = "/add.do",consumes = "application/json")
public String addStu(@RequestBody Student student) throws Exception{
String str=om.writeValueAsString(studentService.addStu(student));
return str;
} @RequestMapping(value = "/edit.do")
public String editStu(@RequestBody Student student) throws Exception{
String str=om.writeValueAsString(studentService.editStu(student));
return str;
} @RequestMapping(value = "/del.do")
public String delStu(@RequestParam("sid") Integer sid) throws Exception{
String str=om.writeValueAsString(studentService.delStu(sid));
return str;
}*/
}
CenterController.java
8.启动类
package cn.kgc; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @MapperScan("cn.kgc.mapper")
@EnableEurekaClient
@SpringBootApplication
public class EurekaClientProviderFindstuApplication { public static void main(String[] args) {
SpringApplication.run(EurekaClientProviderFindstuApplication.class, args);
} }
启动类
四、创建调用者项目eureka-client-consumer-clastu-p
使用feign调用上述2个提供者项目里的controller拿值,并使用熔断器,进行错误请求处理
1.项目结构如下
2.pom.xml文件内容如下
<dependencies>
<dependency>
<groupId>cn.kgc</groupId>
<artifactId>eureka-common-clastu</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <!--<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>8.16.2</version>
</dependency>-->
</dependencies>
pom.xml
3.application.properties
spring.application.name=eureka-client-consumer-clastu-p server.port=8766 eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/ #将feign上集成的断路器设置位有效开启状态
feign.hystrix.enabled=true
application.properties
4.一方feign接口,ClassesProviderFeign.java
package cn.kgc.feign; import cn.kgc.vo.Classes;
import cn.kgc.vo.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.List;
import java.util.Map; @FeignClient(name = "eureka-client-provider-findcla",fallback =ClassesProviderFeignFallBack.class )
public interface ClassesProviderFeign { @RequestMapping("/option.do")
public String optionData(); }
ClassesProviderFeign.java
5.一方feign接口的容错类:ClassesProviderFeignFallBack.java
package cn.kgc.feign; import cn.kgc.vo.Classes;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; //classes容错处理类
@Component
public class ClassesProviderFeignFallBack implements ClassesProviderFeign{ @Override
public String optionData() {
return "提供者服务器请求异常,请稍后再试....";
}
}
ClassesProviderFeignFallBack.java
6.多方feign接口,StudentProviderFeign.java
package cn.kgc.feign; import cn.kgc.vo.Classes;
import cn.kgc.vo.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import java.util.ArrayList;
import java.util.List;
import java.util.Map; @FeignClient(name = "eureka-client-provider-findstu",fallback = StudentProviderFeignFallBack.class)
public interface StudentProviderFeign { @RequestMapping(value = "/data.do")
public String showData(@RequestBody Student student); @RequestMapping(value = "/add.do")
public String addStu(@RequestBody Student student); @RequestMapping(value = "/edit.do")
public String editStu(@RequestBody Student student); @RequestMapping(value = "/del.do")
public String delStu(@RequestParam("sid") Integer sid) ; }
StudentProviderFeign.java
7.多方feign接口的容错类:StudentProviderFeignFallBack.java
package cn.kgc.feign; import cn.kgc.vo.Student;
import org.springframework.stereotype.Component; import java.util.List;
import java.util.Map; @Component
public class StudentProviderFeignFallBack implements StudentProviderFeign{ public String showData(Student student) {
return "提供服务器数据没有查到!";
} public String addStu(Student student) {
return "提供服务器数据添加失败!";
} public String editStu(Student student) {
return "提供服务器修改数据失败!";
} public String delStu(Integer sid) {
return "删除数据失败!";
}
}
tudentProviderFeignFallBack.java
8.CenterController.java
package cn.kgc.controller; import cn.kgc.feign.ClassesProviderFeign;
import cn.kgc.feign.StudentProviderFeign;
import cn.kgc.vo.Classes;
import cn.kgc.vo.Student;
import feign.Headers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import java.util.HashMap;
import java.util.List;
import java.util.Map; @RestController
public class CenterController { @Autowired
private ClassesProviderFeign classesProviderFeign; @Autowired
private StudentProviderFeign studentProviderFeign; @RequestMapping(value = "/option.do",consumes = "application/json" )
public String optionData(){
return classesProviderFeign.optionData();
} @RequestMapping(value = "/data.do",consumes = "application/json")
public String showData(@RequestBody Student student){
System.out.println("clastu=showData>>>>>>>>student:"+student.getSid());
return studentProviderFeign.showData(student);
} @RequestMapping(value = "/info.do",consumes = "application/json")
public Map<String,Object> getInfo(@RequestBody Student student){
Map<String,Object> map=new HashMap<String,Object>();
System.out.println("clastu=getInfo>>>>>>>>student:"+student.getSid());
map.put("stu",studentProviderFeign.showData(student));
map.put("clalist",classesProviderFeign.optionData());
return map;
} @RequestMapping(value = "/add.do",consumes = "application/json")
public String addStu(Student student){
return studentProviderFeign.addStu(student);
} @RequestMapping(value = "/edit.do",consumes = "application/json")
public String editStu(Student student){
return studentProviderFeign.editStu(student);
} @RequestMapping(value = "/del.do",consumes = "application/json")
public String delStu(Integer sid){
return studentProviderFeign.delStu(sid);
}
}
CenterController.java
9.启动类
package cn.kgc; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients; @EnableFeignClients
@EnableEurekaClient
@SpringBootApplication
public class EurekaClientConsumerClastuPApplication { public static void main(String[] args) {
SpringApplication.run(EurekaClientConsumerClastuPApplication.class, args);
} }
启动类
10.测试正常流程,
按顺序启动一、二、三、四项目
11.容错的测试
停掉三的项目,因为三项目是多方的提供者,停掉则四访问不到会走容错
注:本帖为“"Holly老师"原创,转载请注明出处,谢谢!
出处:https://www.cnblogs.com/holly8/p/11415344.html
springcloud(九):熔断器Hystrix和Feign的全套应用案例(二)的更多相关文章
- springcloud(九):熔断器Hystrix和Feign的应用案例
因为 feign 中已经支持了 Hystrix ,所以在 Feign 中使用 Hystrix 时,不需要导包,也不需要在入口类上面增加额外的注解: Feign 虽然支持了 Hystrix ,但是默认 ...
- 二、springcloud之熔断器hystrix
一.背景 雪崩效应 在微服务架构中通常会有多个服务层调用,基础服务的故障可能会导致级联故障,进而造成整个系统不可用的情况,这种现象被称为服务雪崩效应.服务雪崩效应是一种因“服务提供者”的不可用导致“服 ...
- SpringCloud之熔断器Hystrix及服务监控Dashboard
目的: 服务雪崩效应 服务熔断服务降级 Hystrix默认超时时间设置 Hystrix服务监控Dashboard 服务雪崩效应 雪崩效应就是一种不稳定的平衡状态也是加密算法的一种特征,它指明文 ...
- springcloud(九)-Feign使用Hystrix
前言 上一篇我们使用注解@HystrixCommond的fallbackMethod属性实现回退.然而,Feign是以接口形式工作的,它没有方法体,上一篇讲解的方式显然不适用于Feign. 那么Fei ...
- 跟我学SpringCloud | 第四篇:熔断器Hystrix
跟我学SpringCloud | 第四篇:熔断器Hystrix 1. 熔断器 服务雪崩 在正常的微服务架构体系下,一个业务很少有只需要调用一个服务就可以返回数据的情况,这种比较常见的是出现在demo中 ...
- springcloud费话之断路器(hystrix in feign)
目录: springcloud费话之Eureka基础 springcloud费话之Eureka集群 springcloud费话之Eureka服务访问(restTemplate) springcloud ...
- SpringCloud系列十六:Feign使用Hystrix
1. 回顾 上文讲解了使用注解@HystrixCommand的fallbackMethod属性实现回退.然而,Feign是以接口形式工作的, 它没有方法体,前文讲解的方式显然不适用与Feign. 事实 ...
- SpringCloud学习笔记(14)----Spring Cloud Netflix之Hystrix对Feign的支持
1. Hystrix对Feign的支持 添加Feign中IUserBiz的实现类HystrixFallBack: package com.wangx.cloud.springcloud02consum ...
- 一起来学Spring Cloud | 第五章:熔断器 ( Hystrix)
在微服务项目中,一个系统可以分割成很多个不同的服务模块,不同模块之间我们通常需要进行相互调用.springcloud中可以使用RestTemplate+Ribbon和Feign来调用(工作中基本都是使 ...
随机推荐
- compute节点上开启服务openstack-nova-compute.service时,无法启动的解决方法
本文前一部分为本人解决问题的过程,但最终没有解决:无奈在网上找方法时,看到有网友评论说:修改controller上的guest账号密码,再重启openstack-nova-compute. ...
- jmeter环境变量
jmeter环境变量配置jmeter环境变量时,同时也需要配置Java变量(jdk最好使用1.7及1.7以上的版本)1.配置jdk环境变量安装jdk正常安装,一路默认就好,记住安装路径,配置环境变量时 ...
- jQuery中事件与动画
jQuery中的事件与动画 一. jQuery中的事件 jQuery事件是对javaScript事件的封装. 1.基础事件 在javaScript中,常用的基础事件有鼠标事件.键盘事件.windo ...
- jquery插件——仿新浪微博限制输入字数的textarea
内容链接地址:http://www.cnblogs.com/jone-chen/p/5213851.html: <!DOCTYPE html> <html> <head& ...
- Chrome 使用 Evernote 插件
Chrome 插件不能登印象笔记进行裁剪,被困扰有段时间了.昨天偶然在知乎上找到了解决方法: 链接:https://www.zhihu.com/question/20340803/answer/291 ...
- powershell小脚本--批量添加用户属性----导出登录时间
需求1:某公司所有员工少了MAIL属性,需要批量添加.例如,用户chenyy 添加邮件属性chenyy@xxxx.com 先导出(只导出名字)备用: Get-ADUser -Filter * -Pr ...
- 数字麦克风PDM信号采集与STM32 I2S接口应用(二)
在使用STM32的数字麦克风I2S接口时,计算采样率让人头疼,芯片手册上没有明确的说法,而手册上的计算方法经过测试确和实验不符.借助搜索引擎,大部分资料都是来自于开发板卖家或开发板论坛,主要是咪头采集 ...
- WPF后台设置颜色字体等
Button TempButton = new Button(); TempButton.Tag = “按 ...
- codeforces1088D_Ehab and another another xor problem交互题
传送门 一道考验思维的交互题 大致思路就是从最高的二进制位向下询问 代入例子比如: 5 6 6 5 7 4 6 4 讨论一下 交互题的重点学会推理和归纳 #include <bits/stdc+ ...
- 使用nginx代理centos yum 源
我们在安装centos 服务器时,可能会有以下情况: 局域网内有若干台服务器,但是只有一台服务器可以连接外网,其余服务器都不可以连接外网,但通过局域网与外网机器联通. 那么我们再使用 yum 安装软件 ...