单体应用存在的问题

  • 随着业务的发展,开发变得越来越复杂。
  • 修改、新增某个功能,需要对整个系统进行测试、重新部署。
  • 一个模块出现问题,很可能导致整个系统崩溃。
  • 多个开发团队同时对数据进行管理,容易产生安全漏洞。
  • 各个模块使用同一种技术进行开发,各个模块很难根据实际情况选择更合适的技术框架,局限性很大。
  • 模块内容过于复杂,如果员工离职,可能需要很长时间才能完成工作交接。

分布式、集群

集群:一台服务器无法负荷高并发的数据访问量,那么就设置十台服务器一起分担压力,十台不行就设置一百台(物理层面)。很多人干同一件事情,来分摊压力。

分布式:将一个复杂问题拆分成若干个简单的小问题,将一个大型的项目架构拆分成若干个微服务来协同完成。(软件设计层面)。将一个庞大的工作拆分成若干个小步骤,分别由不同的人完成这些小步骤,最终将所有的结果进行整合实现大的需求。

服务治理的核心又三部分组成:服务提供者、服务消费者、注册中心。

在分布式系统架构中,每个微服务在启动时,将自己的信息存储在注册中心,叫做服务注册。

服务消费者从注册中心获取服务提供者的网络信息,通过该信息调用服务,叫做服务发现。

Spring Cloud 的服务治理使用 Eureka 来实现,Eureka 是 Netflix 开源的基于 REST 的服务治理解决方案,Spring Cloud 集成了 Eureka,提供服务注册和服务发现的功能,可以和基于 Spring Boot 搭建的微服务应用轻松完成整合,开箱即用,Spring Cloud Eureka。

Spring Cloud Eureka

  • Eureka Server,注册中心
  • Eureka Client,所有要进行注册的微服务通过 Eureka Client 连接到 Eureka Server,完成注册。

Eureka Server代码实现

  • 创建父工程,pom.xml
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.7.RELEASE</version>
</parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- 解决 JDK 9 以上没有 JAXB API 的问题 --><dependency><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId><version>2.3.0</version></dependency><dependency><groupId>com.sun.xml.bind</groupId><artifactId>jaxb-impl</artifactId><version>2.3.0</version></dependency><dependency><groupId>com.sun.xml.bind</groupId><artifactId>jaxb-core</artifactId><version>2.3.0</version></dependency><dependency><groupId>javax.activation</groupId><artifactId>activation</artifactId><version>1.1.1</version></dependency>
</dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Finchley.SR2</version><type>pom</type><scope>import</scope></dependency></dependencies>
</dependencyManagement>
  • 在父工程下创建 Module,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-server</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml,添加 Eureka Server 相关配置。
server:port: 8761
eureka:client:register-with-eureka: false 是否需要注册fetch-registry: false 是否需要同步其他注册中心的配置service-url:defaultZone: http://localhost:8761/eureka 

属性说明

server.port:当前 Eureka Server 服务端口。

eureka.client.register-with-eureka:是否将当前的 Eureka Server 服务作为客户端进行注册。

eureka.client.fetch-fegistry:是否获取其他 Eureka Server 服务的数据。

eureka.client.service-url.defaultZone:注册中心的访问地址。

  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {public static void main(String[] args) {SpringApplication.run(EurekaServerApplication.class,args);}
}

注解说明:

@SpringBootApplication:声明该类是 Spring Boot 服务的入口。

@EnableEurekaServer:声明该类是一个 Eureka Server 微服务,提供服务注册和服务发现功能,即注册中心。

Eureka Client 代码实现

  • 创建 Module ,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml,添加 Eureka Client 相关配置
server:port: 8010
spring:application:name: provider
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/instance:prefer-ip-address: true

属性说明:

spring.application.name:当前服务注册在 Eureka Server 上的名称。

eureka.client.service-url.defaultZone:注册中心的访问地址。

eureka.instance.prefer-ip-address:是否将当前服务的 IP 注册到 Eureka Server。

  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class ProviderApplication {public static void main(String[] args) {SpringApplication.run(ProviderApplication.class,args);}
}
  • 实体类
package com.southwind.entity;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student {private long id;private String name;private int age;
}
  • Repository
package com.southwind.repository;import com.southwind.entity.Student;import java.util.Collection;public interface StudentRepository {public Collection<Student> findAll();public Student findById(long id);public void saveOrUpdate(Student student);public void deleteById(long id);
}
  • RepositoryImpl
package com.southwind.repository.impl;import com.southwind.entity.Student;
import com.southwind.repository.StudentRepository;
import org.springframework.stereotype.Repository;import java.util.Collection;
import java.util.HashMap;
import java.util.Map;@Repository
public class StudentRepositoryImpl implements StudentRepository {private static Map<Long,Student> studentMap;static {studentMap = new HashMap<>();studentMap.put(1L,new Student(1L,"张三",22));studentMap.put(2L,new Student(2L,"李四",23));studentMap.put(3L,new Student(3L,"王五",24));}@Overridepublic Collection<Student> findAll() {return studentMap.values();}@Overridepublic Student findById(long id) {return studentMap.get(id);}@Overridepublic void saveOrUpdate(Student student) {studentMap.put(student.getId(),student);}@Overridepublic void deleteById(long id) {studentMap.remove(id);}
}
  • Handler
package com.southwind.controller;import com.southwind.entity.Student;
import com.southwind.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;import java.util.Collection;@RestController
@RequestMapping("/student")
public class StudentHandler {@Autowiredprivate StudentRepository studentRepository;@GetMapping("/findAll")public Collection<Student> findAll(){return studentRepository.findAll();}@GetMapping("/findById/{id}")public Student findById(@PathVariable("id") long id){return studentRepository.findById(id);}@PostMapping("/save")public void save(@RequestBody Student student){studentRepository.saveOrUpdate(student);}@PutMapping("/update")public void update(@RequestBody Student student){studentRepository.saveOrUpdate(student);}@DeleteMapping("/deleteById/{id}")public void deleteById(@PathVariable("id") long id){studentRepository.deleteById(id);}
}

RestTemplate 的使用

  • 什么是 RestTemplate?

RestTemplate 是 Spring 框架提供的基于 REST 的服务组件,底层是对 HTTP 请求及响应进行了封装,提供了很多访问 RETS 服务的方法,可以简化代码开发。

  • 如何使用 RestTemplate?

1、创建 Maven 工程,pom.xml。

2、创建实体类

package com.southwind.entity;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student {private long id;private String name;private int age;
}

3、Handler

package com.southwind.controller;import com.southwind.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;import java.util.Collection;@RestController
@RequestMapping("/rest")
public class RestHandler {@Autowiredprivate RestTemplate restTemplate;@GetMapping("/findAll")public Collection<Student> findAll(){return restTemplate.getForEntity("http://localhost:8010/student/findAll",Collection.class).getBody();}@GetMapping("/findAll2")public Collection<Student> findAll2(){return restTemplate.getForObject("http://localhost:8010/student/findAll",Collection.class);}@GetMapping("/findById/{id}")public Student findById(@PathVariable("id") long id){return restTemplate.getForEntity("http://localhost:8010/student/findById/{id}",Student.class,id).getBody();}@GetMapping("/findById2/{id}")public Student findById2(@PathVariable("id") long id){return restTemplate.getForObject("http://localhost:8010/student/findById/{id}",Student.class,id);}@PostMapping("/save")public void save(@RequestBody Student student){restTemplate.postForEntity("http://localhost:8010/student/save",student,null).getBody();}@PostMapping("/save2")public void save2(@RequestBody Student student){restTemplate.postForObject("http://localhost:8010/student/save",student,null);}@PutMapping("/update")public void update(@RequestBody Student student){restTemplate.put("http://localhost:8010/student/update",student);}@DeleteMapping("/deleteById/{id}")public void deleteById(@PathVariable("id") long id){restTemplate.delete("http://localhost:8010/student/deleteById/{id}",id);}
}

4、启动类

package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;@SpringBootApplication
public class RestTemplateApplication {public static void main(String[] args) {SpringApplication.run(RestTemplateApplication.class,args);}@Beanpublic RestTemplate restTemplate(){return new RestTemplate();}
}

服务消费者 consumer

  • 创建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 8020
spring:application:name: consumer
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/instance:prefer-ip-address: true
  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;@SpringBootApplication
public class ConsumerApplication {public static void main(String[] args) {SpringApplication.run(ConsumerApplication.class,args);}@Beanpublic RestTemplate restTemplate(){return new RestTemplate();}
}
  • Handler
package com.southwind.controller;import com.southwind.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;import java.util.Collection;@RestController
@RequestMapping("/consumer")
public class ConsumerHandler {@Autowiredprivate RestTemplate restTemplate;@GetMapping("/findAll")public Collection<Student> findAll(){return restTemplate.getForEntity("http://localhost:8010/student/findAll",Collection.class).getBody();}@GetMapping("/findAll2")public Collection<Student> findAll2(){return restTemplate.getForObject("http://localhost:8010/student/findAll",Collection.class);}@GetMapping("/findById/{id}")public Student findById(@PathVariable("id") long id){return restTemplate.getForEntity("http://localhost:8010/student/findById/{id}",Student.class,id).getBody();}@GetMapping("/findById2/{id}")public Student findById2(@PathVariable("id") long id){return restTemplate.getForObject("http://localhost:8010/student/findById/{id}",Student.class,id);}@PostMapping("/save")public void save(@RequestBody Student student){restTemplate.postForEntity("http://localhost:8010/student/save",student,null).getBody();}@PostMapping("/save2")public void save2(@RequestBody Student student){restTemplate.postForObject("http://localhost:8010/student/save",student,null);}@PutMapping("/update")public void update(@RequestBody Student student){restTemplate.put("http://localhost:8010/student/update",student);}@DeleteMapping("/deleteById/{id}")public void deleteById(@PathVariable("id") long id){restTemplate.delete("http://localhost:8010/student/deleteById/{id}",id);}
}

服务网关

Spring Cloud 集成了 Zuul 组件,实现服务网关。

  • 什么是 Zuul?

Zuul 是 Netflix 提供的一个开源的 API 网关服务器,是客户端和网站后端所有请求的中间层,对外开放一个 API,将所有请求导入统一的入口,屏蔽了服务端的具体实现逻辑,Zuul 可以实现反向代理的功能,在网关内部实现动态路由、身份认证、IP 过滤、数据监控等。

  • 创建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId><version>2.0.2.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-zuul</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 8030
spring:application:name: gateway
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/
zuul:routes:provider: /p/**

属性说明:

zuul.routes.provider:给服务提供者 provider 设置映射

  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;@EnableZuulProxy
@EnableAutoConfiguration
public class ZuulApplication {public static void main(String[] args) {SpringApplication.run(ZuulApplication.class,args);}
}

注解说明:

@EnableZuulProxy:包含了 @EnableZuulServer,设置该类是网关的启动类。

@EnableAutoConfiguration:可以帮助 Spring Boot 应用将所有符合条件的 @Configuration 配置加载到当前 Spring Boot 创建并使用的 IoC 容器中。

  • Zuul 自带了负载均衡功能,修改 provider 的代码。
package com.southwind.controller;import com.southwind.entity.Student;
import com.southwind.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;import java.util.Collection;@RestController
@RequestMapping("/student")
public class StudentHandler {@Autowiredprivate StudentRepository studentRepository;@Value("${server.port}")private String port;@GetMapping("/findAll")public Collection<Student> findAll(){return studentRepository.findAll();}@GetMapping("/findById/{id}")public Student findById(@PathVariable("id") long id){return studentRepository.findById(id);}@PostMapping("/save")public void save(@RequestBody Student student){studentRepository.saveOrUpdate(student);}@PutMapping("/update")public void update(@RequestBody Student student){studentRepository.saveOrUpdate(student);}@DeleteMapping("/deleteById/{id}")public void deleteById(@PathVariable("id") long id){studentRepository.deleteById(id);}@GetMapping("/index")public String index(){return "当前端口:"+this.port;}
}

Ribbon 负载均衡

  • 什么是 Ribbon?

Spring Cloud Ribbon 是一个负载均衡解决方案,Ribbon 是 Netflix 发布的负载均衡器,Spring Cloud Ribbon 是基于 Netflix Ribbon 实现的,是一个用于对 HTTP 请求进行控制的负载均衡客户端。

在注册中心对 Ribbon 进行注册之后,Ribbon 就可以基于某种负载均衡算法,如轮询、随机、加权轮询、加权随机等自动帮助服务消费者调用接口,开发者也可以根据具体需求自定义 Ribbon 负载均衡算法。实际开发中,Spring Cloud Ribbon 需要结合 Spring Cloud Eureka 来使用,Eureka Server 提供所有可以调用的服务提供者列表,Ribbon 基于特定的负载均衡算法从这些服务提供者中选择要调用的具体实例。

  • 创建 Module,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 8040
spring:application:name: ribbon
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/instance:prefer-ip-address: true
  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;@SpringBootApplication
public class RibbonApplication {public static void main(String[] args) {SpringApplication.run(RibbonApplication.class,args);}@Bean@LoadBalancedpublic RestTemplate restTemplate(){return new RestTemplate();}
}

@LoadBalanced:声明一个基于 Ribbon 的负载均衡。

  • Handler
package com.southwind.controller;import com.southwind.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;import java.util.Collection;@RestController
@RequestMapping("/ribbon")
public class RibbonHandler {@Autowiredprivate RestTemplate restTemplate;@GetMapping("/findAll")public Collection<Student> findAll(){return restTemplate.getForObject("http://provider/student/findAll",Collection.class);}@GetMapping("/index")public String index(){return restTemplate.getForObject("http://provider/student/index",String.class);}
}

Feign

  • 什么是 Feign?

与 Ribbon 一样,Feign 也是由 Netflix 提供的,Feign 是一个声明式、模版化的 Web Service 客户端,它简化了开发者编写 Web 服务客户端的操作,开发者可以通过简单的接口和注解来调用 HTTP API,Spring Cloud Feign,它整合了 Ribbon 和 Hystrix,具有可插拔、基于注解、负载均衡、服务熔断等一系列便捷功能。

相比较于 Ribbon + RestTemplate 的方式,Feign 大大简化了代码的开发,Feign 支持多种注解,包括 Feign 注解、JAX-RS 注解、Spring MVC 注解等,Spring Cloud 对 Feing 进行了优化,整合了 Ribbon 和 Eureka,从而让 Feign 的使用更加方便。

  • Ribbon 和 Feign 的区别

Ribbon 是一个通用的 HTTP 客户端工具,Feign 是基于 Ribbon 实现的。

  • Feign 的tedian

1、Feign 是一个声明式的 Web Service 客户端。

2、支持 Feign 注解、Spring MVC 注解、JAX-RS 注解。

3、Feign 基于 Ribbon 实现,使用起来更加简单。

4、Feign 集成了 Hystrix,具备服务熔断的功能。

  • 创建 Module,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId><version>2.0.2.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 8050
spring:application:name: feign
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/instance:prefer-ip-address: true
  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;@SpringBootApplication
@EnableFeignClients
public class FeignApplication {public static void main(String[] args) {SpringApplication.run(FeignApplication.class,args);}
}
  • 创建声明式接口
package com.southwind.feign;import com.southwind.entity.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;import java.util.Collection;@FeignClient(value = "provider")
public interface FeignProviderClient {@GetMapping("/student/findAll")public Collection<Student> findAll();@GetMapping("/student/index")public String index();
}
  • Handler
package com.southwind.controller;import com.southwind.entity.Student;
import com.southwind.feign.FeignProviderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.Collection;@RestController
@RequestMapping("/feign")
public class FeignHandler {@Autowiredprivate FeignProviderClient feignProviderClient;@GetMapping("/findAll")public Collection<Student> findAll(){return feignProviderClient.findAll();}@GetMapping("/index")public String index(){return feignProviderClient.index();}
}
  • 服务熔断,application.yml 添加熔断机制。
server:port: 8050
spring:application:name: feign
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/instance:prefer-ip-address: true
feign:hystrix:enabled: true

feign.hystrix.enabled:是否开启熔断器。

  • 创建 FeignProviderClient 接口的实现类 FeignError,定义容错处理逻辑,通过 @Component 注解将 FeignError 实例注入 IoC 容器中。
package com.southwind.feign.impl;import com.southwind.entity.Student;
import com.southwind.feign.FeignProviderClient;
import org.springframework.stereotype.Component;import java.util.Collection;@Component
public class FeignError implements FeignProviderClient {@Overridepublic Collection<Student> findAll() {return null;}@Overridepublic String index() {return "服务器维护中......";}
}
  • 在 FeignProviderClient 定义处通过 @FeignClient 的 fallback 属性设置映射。
package com.southwind.feign;import com.southwind.entity.Student;
import com.southwind.feign.impl.FeignError;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;import java.util.Collection;@FeignClient(value = "provider",fallback = FeignError.class)
public interface FeignProviderClient {@GetMapping("/student/findAll")public Collection<Student> findAll();@GetMapping("/student/index")public String index();
}

Hystrix 容错机制

在不改变各个微服务调用关系的前提下,针对错误情况进行预先处理。

  • 设计原则

1、服务隔离机制

2、服务降级机制

3、熔断机制

4、提供实时的监控和报警功能

5、提供实时的配置修改功能

Hystrix 数据监控需要结合 Spring Boot Actuator 来使用,Actuator 提供了对服务的健康健康、数据统计,可以通过 hystrix.stream 节点获取监控的请求数据,提供了可视化的监控界面。

  • 创建 Maven,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId><version>2.0.2.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId><version>2.0.2.RELEASE</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId><version>2.0.7.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-hystrix</artifactId><version>2.0.2.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 8060
spring:application:name: hystrix
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/instance:prefer-ip-address: true
feign:hystrix:enabled: true
management:endpoints:web:exposure:include: 'hystrix.stream'
  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;@SpringBootApplication
@EnableFeignClients
@EnableCircuitBreaker
@EnableHystrixDashboard
public class HystrixApplication {public static void main(String[] args) {SpringApplication.run(HystrixApplication.class,args);}
}

注解说明:

@EnableCircuitBreaker:声明启用数据监控

@EnableHystrixDashboard:声明启用可视化数据监控

  • Handler
package com.southwind.controller;import com.southwind.entity.Student;
import com.southwind.feign.FeignProviderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.Collection;@RestController
@RequestMapping("/hystrix")
public class HystrixHandler {@Autowiredprivate FeignProviderClient feignProviderClient;@GetMapping("/findAll")public Collection<Student> findAll(){return feignProviderClient.findAll();}@GetMapping("/index")public String index(){return feignProviderClient.index();}
}
  • 启动成功之后,访问 http://localhost:8060/actuator/hystrix.stream 可以监控到请求数据,
  • 访问 http://localhost:8060/hystrix,可以看到可视化的监控界面,输入要监控的地址节点即可看到该节点的可视化数据监控。

Spring Cloud 配置中心

Spring Cloud Config,通过服务端可以为多个客户端提供配置服务。Spring Cloud Config 可以将配置文件存储在本地,也可以将配置文件存储在远程 Git 仓库,创建 Config Server,通过它管理所有的配置文件。

本地文件系统

  • 创建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-config-server</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建 application.yml
server:port: 8762
spring:application:name: nativeconfigserverprofiles:active: nativecloud:config:server:native:search-locations: classpath:/shared

注解说明

profiles.active:配置文件的获取方式

cloud.config.server.native.search-locations:本地配置文件存放的路径

  • resources 路径下创建 shared 文件夹,并在此路径下创建 configclient-dev.yml。
server:port: 8070
foo: foo version 1
  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;@SpringBootApplication
@EnableConfigServer
public class NativeConfigServerApplication {public static void main(String[] args) {SpringApplication.run(NativeConfigServerApplication.class,args);}
}

注解说明

@EnableConfigServer:声明配置中心。

创建客户端读取本地配置中心的配置文件

  • 创建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-config</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建 bootstrap.yml,配置读取本地配置中心的相关信息。
spring:application:name: configclientprofiles:active: devcloud:config:uri: http://localhost:8762fail-fast: true

注解说明

cloud.config.uri:本地 Config Server 的访问路径

cloud.config.fail-fase:设置客户端优先判断 Config Server 获取是否正常。

通过spring.application.name 结合spring.profiles.active拼接目标配置文件名,configclient-dev.yml,去 Config Server 中查找该文件。

  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class NativeConfigClientApplication {public static void main(String[] args) {SpringApplication.run(NativeConfigClientApplication.class,args);}
}
  • Handler
package com.southwind.controller;import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/native")
public class NativeConfigHandler {@Value("${server.port}")private String port;@Value("${foo}")private String foo;@GetMapping("/index")public String index(){return this.port+"-"+this.foo;}
}

Spring Cloud Config 远程配置

  • 创建配置文件,上传至 GitHub
server:port: 8070
eureka:client:serviceUrl:defaultZone: http://localhost:8761/eureka/
spring:application:name: configclient
  • 创建 Config Server,新建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-config-server</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 8888
spring:application:name: configservercloud:config:server:git:uri: https://github.com/southwind9801/aispringcloud.gitsearchPaths: configusername: rootpassword: rootlabel: master
eureka:client:serviceUrl:defaultZone: http://localhost:8761/eureka/
  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {public static void main(String[] args) {SpringApplication.run(ConfigServerApplication.class,args);}
}

创建 Config Client

  • 创建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-config</artifactId><version>2.0.2.RELEASE</version></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建 bootstrap.yml
spring:cloud:config:name: configclientlabel: masterdiscovery:enabled: trueservice-id: configserver
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/

注解说明

spring.cloud.config.name:当前服务注册在 Eureka Server 上的名称,与远程仓库的配置文件名对应。

spring.cloud.config.label:Git Repository 的分支。

spring.cloud.config.discovery.enabled:是否开启 Config 服务发现支持。

spring.cloud.config.discovery.service-id:配置中心在 Eureka Server 上注册的名称。

  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class ConfigClientApplication {public static void main(String[] args) {SpringApplication.run(ConfigClientApplication.class,args);}
}
  • Handler
package com.southwind.controller;import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/hello")
public class HelloHandler {@Value("${server.port}")private String port;@GetMapping("/index")public String index(){return this.port;}
}

服务跟踪

Spring Cloud Zipkin

Zipkin 是一个可以采集并且跟踪分布式系统中请求数据的组件,让开发者可以更加直观的监控到请求在各个微服务所耗费的时间等,Zipkin:Zipkin Server、Zipkin Client。

####创建 Zipkin Server

  • 创建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>io.zipkin.java</groupId><artifactId>zipkin-server</artifactId><version>2.9.4</version></dependency><dependency><groupId>io.zipkin.java</groupId><artifactId>zipkin-autoconfigure-ui</artifactId><version>2.9.4</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 9090
  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import zipkin.server.internal.EnableZipkinServer;@SpringBootApplication
@EnableZipkinServer
public class ZipkinApplication {public static void main(String[] args) {SpringApplication.run(ZipkinApplication.class,args);}
}

注解说明

@EnableZipkinServer:声明启动 Zipkin Server

创建 Zipkin Client

  • 创建 Maven 工程,pom.xml
<dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zipkin</artifactId><version>2.0.2.RELEASE</version></dependency>
</dependencies>
  • 创建配置文件 application.yml
server:port: 8090
spring:application:name: zipkinclientsleuth:web:client:enabled: truesampler:probability: 1.0zipkin:base-url: http://localhost:9090/
eureka:client:service-url:defaultZone: http://localhost:8761/eureka/

属性说明

spring.sleuth.web.client.enabled:设置开启请求跟踪

spring.sleuth.sampler.probability:设置采样比例,默认是 1.0

srping.zipkin.base-url:Zipkin Server 地址

  • 创建启动类
package com.southwind;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class ZipkinClientApplication {public static void main(String[] args) {SpringApplication.run(ZipkinClientApplication.class,args);}
}
  • Handler
package com.southwind.controller;import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/zipkin")
public class ZipkinHandler {@Value("${server.port}")private String port;@GetMapping("/index")public String index(){return this.port;}
}
查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. Spring MVC防止数据重复提交(防止二次提交)

    SpringMvc使用Token 使用token的逻辑是&#xff0c;给所有的url加一个拦截器&#xff0c;在拦截器里面用java的UUID生成一个随机的UUID并把这个UUID放到session里面&#xff0c;然后在浏览器做数据提交的时候将此UUID提交到服务器。服务器在接收到此UUID后&#xff0c;检查一下…...

    2024/3/4 11:46:28
  2. 哈佛结构和冯诺依曼结构特点

    指令和数据的区分 冯认为指令也是一种数据&#xff0c;所以冯诺依曼构架只有数据总线和地址总线。 哈佛构架认为指令是指令&#xff0c;数据是数据&#xff0c;所以哈佛构架有供给指令的地址总线和数据总线&#xff0c;还有供给数据的地址总线和数据总线。 两者其实有点互补…...

    2024/3/4 11:46:27
  3. 三维数字化套件使用介绍之五:矢量建模(4)

    三维数字化套件主要功能 三维数字化套件是一款集二维、三维数据转化、影像下载及加工处理、二维坐标变换、静态服务器为一体的数字化套件。具体功能可以访问 http://www.dascad.net 矢量建模 矢量建模是该数字化套件的主要功能&#xff0c;该功能包括 生成建筑、生成道路、生成…...

    2024/3/7 8:48:02
  4. java接受JSON字符串

    java接受字符串&#xff0c;先将JSON字符串变为JSON对象&#xff0c;然后再或者JSON对象中的各个值&#xff0c;可以是字符串&#xff0c;也可能是数组。 String str1"{\"name\":\"lss\"}"; JSONObject jsonObjectJSONObject.parseObject(str); …...

    2024/3/7 8:48:01
  5. L1-002 打印沙漏 (20 分)

    L1-002 打印沙漏 (20 分) 本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”&#xff0c;要求按下列格式打印 ************ *****所谓“沙漏形状”&#xff0c;是指每行输出奇数个符号&#xff1b;各行符号中心对齐&#xff1b;相邻两行符号数差2&#xff…...

    2024/3/7 8:48:02
  6. PyTorch(2)-numpy-opencv-pytorch基本操作

    1.numpy 2.opencv 3.pytorch 1.numpy import numpy as np #1.定义数组 打印维度 a np.array([1, 2, 3, 4, 5, 6]) b np.array([8, 7, 6, 5]) #2.改变数组维度 aa np.reshape(a, (3, 2)) #一维改成3行2列 bb np.reshape(b, (1, 1, 4)) #一维变3维 #print(bb, bb.sha…...

    2024/3/7 8:47:59
  7. 【Axure原型】新闻资讯客户端APP原型 今日头条同类APP实战原型

    作品说明 作品页数&#xff1a;共 216 页 文件大小&#xff1a;16.6 MB 支持软件&#xff1a;Axure RP 9/10 应用领域&#xff1a;新闻资讯&#xff0c;信息内容 作品特色 本作品属于新闻资讯领域的手机客户端&#xff0c;定位偏向今日头条、网易新闻等综合新闻类APP&…...

    2024/3/7 8:47:58
  8. 陷阱警告(if语句中的注意点)

    1.请问输出结果为hehe还是haha? #include <stdio.h> int main() { int a 0; int b 2; if (a1) if (b2) printf("hehe\n") else printf("haha\n") return 0; } 想好了吗&#xff1f; 公布答案&#xff1a;什么也不输出 解析&#xff…...

    2024/3/7 8:47:57
  9. JavaWeb入门-Cookie与Session

    什么是Cookie? Cookie&#xff0c;有时也用其复数形式 Cookies。类型为“小型文本文件”&#xff0c;是某些网站为了辨别用户身份&#xff0c;进行Session跟踪而储存在用户本地终端上的数据&#xff08;通常经过加密&#xff09;&#xff0c;由用户客户端计算机暂时或永久保存…...

    2024/3/7 8:47:56
  10. react-router的使用(一)

    一、阶段一&#xff1a;后端路由阶段 早期的网站开发整个HTML页面是由服务器来渲染的. 服务器直接生产渲染好对应的HTML页面, 返回给客户端进行展示. 但是, 一个网站, 这么多页面服务器如何处理呢? 一个页面有自己对应的网址, 也就是URL.URL会发送到服务器, 服务器会通过正…...

    2024/3/7 8:47:55
  11. 计算键入字符数量

    一.代码功能 计算键入字符数量&#xff0c;当键入为‘.’时&#xff0c;结束 二、代码 #include <stdio.h> #define PERIOD .int main(void) {char ch;int charcount0;while((chgetchar())!PERIOD){if(ch!"&&ch!\)charcount;}printf("There are %d …...

    2024/3/7 8:47:54
  12. Python零基础教程之——Python 运算符

    什么是运算符&#xff1f; 本章节主要说明Python的运算符。举个简单的例子** 4 5 9 。 例子中&#xff0c;4 和 5 被称为操作数**&#xff0c;"" 称为运算符。 Python语言支持以下类型的运算符: 算术运算符比较&#xff08;关系&#xff09;运算符赋值运算符逻辑…...

    2024/3/7 8:47:53
  13. 搭建机器人电控系统——通信协议——CAN通信及其实例

    通信协议 计算机与外界的信息交互称为通信。 基本的通信方式分为两种&#xff1a; 串行通信&#xff1a;所传送的数据各位按顺序一位一位地发送或接受&#xff0c;占用资源少&#xff0c;速度相对较慢。 并行通信&#xff1a;所传送的数据的各个位是同时发送或接受。速度快&a…...

    2024/3/7 8:47:52
  14. 浏览器渲染原理的学习与总结

    参考文章&#xff1a;浏览器渲染原理 浏览器渲染原理 1. 进程和线程 进程包涵线程, 微信是一个进程, 里面有很多诸如用户登录等线程. a.线程共享内存, 进程独立内存: 进程与进程之间是相互独立的, 他们各自有各自的内存, 而线程之间是独立的, 但他们共享同一个内存空间. …...

    2024/3/7 8:47:51
  15. 版本控制工具

    版本控制工具版本控制工具Git工作机制代码托管中心Git命令查看版本设置签名初始化本地库分支GitHubidea应用环境配置初始化本地库加入暂存区提交本地库提交记录、版本切换分支集成gitHub集成GiteeGitLab版本控制工具 分布式版本控制工具&#xff1a;Git集中式版本控制工具&…...

    2024/3/16 1:01:23
  16. 【仪器仪表】万用表的精度和准确度怎么看?

    万用表精度就是指在特定的使用环境下出现的最大允许误差。换句话说&#xff0c;精度就是用来表明数字万用表的测量值与被测信号的实际值的接近程度。精度越小说明与实际值越接近&#xff0c;因此性能也就越好。 对于大多数万用表来说&#xff0c;精度通常是使用读数的百分数来表…...

    2024/3/29 2:51:22
  17. Django应用与分布式路由

    应用&#xff0c;项目中的独立业务模块&#xff0c;可以保函自己的路由、视图、模板、模型。 一、创建应用 (一&#xff09;创建应用文件夹 python manage.py startapp [应用名](二&#xff09;settings配置 在settings.py的INSTALLED_APPS中注册 INSTALLED_APPS [django…...

    2024/3/7 8:47:48
  18. 免费破解图片验证码(数字或中英混合)(附代码)(2022)(验证码篇2)

    前言 对应博客文章:点此跳转&#xff0c;获取该文章的更多信息 前面有破解谷歌验证码&#xff0c;现在来破解相对简单的图片验证码。(数字以及中英混合) 插件过验证码 需要加载谷歌插件AutoVerify 这种识别是为了过简单的文字数字的验证图片用的方法。 这个插件能实现点击…...

    2024/3/7 8:47:47
  19. 最新版多仓库进销存源码

    最新版多仓库进销存源码 开发语言:PHP 数据库:MySQL 压缩包:21.44M 编号:4519.90649078378216yuegaowang...

    2024/3/4 11:46:34
  20. JavaWeb入门-Tomcat

    Tomcat 官方网址&#xff1a;https://tomcat.apache.org/ Tomcat目录介绍 bin 专门用来存放 Tomcat 服务器的可执行程序 conf 专门用来存放 Tocmat 服务器的配置文件 lib 专门用来存放 Tomcat 服务器的 jar 包 logs 专门用来存放 Tomcat 服务器运行时输出的日记信息 temp…...

    2024/3/4 11:46:33

最新文章

  1. 快速入门Axure RP:解答4个关键问题!

    软件Axure RP 是一种功能强大的设计工具&#xff0c;用于使用 Web、移动和桌面应用程序项目创建交互原型。Axure RP软件中的 RP代表快速原型制作&#xff0c;这是软件Axure RP的核心特征。用户使用Axurere RP软件可以快速地将简单的想法创建成线框图和原型。Axure 因此&#xf…...

    2024/3/29 8:47:13
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/3/20 10:50:27
  3. ADB 操作命令详解及用法大全

    ADB&#xff08;Android Debug Bridge&#xff09;是用于在计算机和 Android 设备之间进行通信的命令行工具。它可以用于调试和测试 Android 应用程序&#xff0c;以及在计算机上执行各种操作。 以下是一些常用的 ADB 命令及其用法&#xff1a; adb devices 用途&#xff1a;列…...

    2024/3/29 4:22:08
  4. oracle ADG主备切换

    1.主库切换备库 SQL> select name,open_mode,switchover_status from v$database;NAME OPEN_MODE SWITCHOVER_STATUS --------- -------------------- -------------------- PROD1 READ WRITE TO STANDBYSQL> alter system switch logfile;System altered.SQL> alter…...

    2024/3/29 4:36:40
  5. git基础-获取git仓库

    通过本章的学习&#xff0c;应该能够配置和初始化一个仓库&#xff0c;开始和停止跟踪文件&#xff0c;暂存和提交更改。我们还将展示如何设置 Git 来忽略特定的文件和文件模式&#xff0c;如何快速轻松地撤销错误&#xff0c;如何浏览项目的历史记录并查看提交之间的更改&…...

    2024/3/28 15:51:31
  6. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/3/27 10:21:24
  7. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/3/24 20:11:25
  8. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/3/29 2:45:46
  9. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/3/24 20:11:23
  10. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/3/29 5:19:52
  11. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/3/28 17:01:12
  12. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/3/24 5:55:47
  13. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/3/29 1:13:26
  14. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/3/29 8:28:16
  15. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/3/29 7:41:19
  16. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/3/24 20:11:18
  17. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/3/28 9:10:53
  18. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/3/29 0:49:46
  19. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/3/24 20:11:15
  20. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/3/27 7:12:50
  21. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/3/24 20:11:13
  22. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/3/26 11:21:23
  23. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/3/28 18:26:34
  24. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/3/28 12:42:28
  25. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/3/28 20:09:10
  26. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  27. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  28. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  29. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  30. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  31. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  32. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  33. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  34. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  35. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  36. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  37. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  38. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  39. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  40. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  41. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  42. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  43. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  44. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  45. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57