feat(master): nocos + admin

nocos 基本配置
admin 基础配置
master
土豆兄弟 2 months ago
parent 3e350dc766
commit 4c744ab351

@ -1,5 +1,8 @@
# 项目大致说明
- 微服务注册与配置中心 - (Alibaba Nacos)
- [dev-protocol-springcloud-nacos](dev-protocol-springcloud-nacos)
- 微服务应用监控 - (SpringBoot Admin)
- [dev-protocol-springcloud-admin](dev-protocol-springcloud-admin)
- 微服务通信 - (RestTemplate/Ribbon/Feign/OpenFeign)
- [dev-protocol-springcloud-communication](dev-protocol-springcloud-communication)
- 微服务网关 - (Gateway)

@ -0,0 +1,57 @@
## 1. 搭建 SpringBoot Admin 监控服务器
- 认识 SpringBoot Actuator
- Actuator Endpoints(端点)
- Endpoints 是 Actuator 的核心部分, 它用来监视应用程序及交互, SpringBoot Actuator 内置了很多 Endpoints, 并支持扩展
- SpringBoot Actuator 提供的原生端点有三类:
- 应用配置类:自动配置信息、Spring Bean 信息、yml 文件信息、环境信息等等
- 度量指标类:主要是运行期间的动态信息例如堆、健康指标、metrics 信息等等
- 操作控制类:主要是指 shutdown用户可以发送一个请求将应用的监控功能关闭
---
- 搭建 SpringBoot Admin 监控服务器
- 搭建监控服务器的步骤
- 添加 SpringBoot Admin Starter 自动配置依赖
- spring-boot-admin-starter-server
- 添加启动注解:@EnableAdminServer
---
- SpringBoot Admin 的访问地址: 127.0.0.1:7001/dev-protocol-springcloud-admin
- 其他要被监控的服务加入
```yml
spring:
# ...
cloud:
nacos:
discovery:
enabled: true
server-addr: 127.0.0.1:8848
namespace: 1bc13fd5-843b-4ac0-aa55-695c25bc0ac6
metadata:
management:
context-path: ${server.servlet.context-path}/actuator
# 暴露端点
management:
endpoints:
web:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 *, 可以开放所有端点
endpoint:
health:
show-details:
```
## 2. 监控中心服务器添加安全访问控制
- 要记住要户名和密码, 防止之后忘记用户名和密码
## 3. SpringBoot Admin 应用监控总结
- 自定义告警
- 需要有邮箱服务器, 来进行使用邮件告警
- 其他的定制可以自己通过 AbstractEventNotifier 进行定制

@ -0,0 +1,91 @@
<?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>
<parent>
<groupId>org.example</groupId>
<artifactId>dev-protocol</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>dev-protocol-springcloud-admin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<!-- 模块名及描述信息 -->
<name>dev-protocol-springcloud-admin</name>
<description>监控服务器</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- spring cloud alibaba nacos discovery 依赖 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringBoot Admin -->
<!-- 实现对 Spring Boot Admin Server 的自动化配置 -->
<!--
包含
1. spring-boot-admin-server: Server 端
2. spring-boot-admin-server-ui: UI 界面
3. spring-boot-admin-server-cloud: 对 Spring Cloud 的接入
-->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.2.0</version>
</dependency>
<!-- 开启登录认证功能 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--
实现对 Java Mail 的自动化配置
完成自动化报警
-->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>-->
<!-- <dependency>
<groupId>com.imooc.ecommerce</groupId>
<artifactId>e-commerce-mvc-config</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>-->
</dependencies>
<!--
SpringBoot的Maven插件, 能够以Maven的方式为应用提供SpringBoot的支持可以将
SpringBoot应用打包为可执行的jar或war文件, 然后以通常的方式运行SpringBoot应用
-->
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,16 @@
package org.example;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* <h1></h1>
* */
@EnableAdminServer
@SpringBootApplication
public class AdminApplication {
public static void main(String[] args) {
SpringApplication.run(AdminApplication.class, args);
}
}

@ -0,0 +1,60 @@
package org.example.conf;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
/**
* <h1>, 便</h1>
* Spring Security
* */
@Configuration
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
/** 应用上下文路径 */
private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
// 成功授权后的 successHandler 的处理
SavedRequestAwareAuthenticationSuccessHandler successHandler =
new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/");
http.authorizeRequests()
// 1. 配置所有的静态资源和登录页可以公开访问
.antMatchers(adminContextPath + "/assets/**").permitAll()
.antMatchers(adminContextPath + "/login").permitAll()
// 2. 其他请求, 必须要经过认证
.anyRequest().authenticated()
.and()
// 3. 配置登录和登出路径
.formLogin().loginPage(adminContextPath + "/login")
.successHandler(successHandler)
.and()
.logout().logoutUrl(adminContextPath + "/logout")
.and()
// 4. 开启 http basic 支持, 其他的服务模块注册时需要使用
.httpBasic()
.and()
// 5. 开启基于 cookie 的 csrf 保护
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
// 6. 忽略这些路径的 csrf 保护以便其他的模块可以实现注册
.ignoringAntMatchers(
adminContextPath + "/instances",
adminContextPath + "/actuator/**"
);
}
}

@ -0,0 +1,44 @@
package org.example.notifier;
import de.codecentric.boot.admin.server.domain.entities.Instance;
import de.codecentric.boot.admin.server.domain.entities.InstanceRepository;
import de.codecentric.boot.admin.server.domain.events.InstanceEvent;
import de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent;
import de.codecentric.boot.admin.server.notify.AbstractEventNotifier;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
/**
* <h1></h1>
* */
@Slf4j
@Component
@SuppressWarnings("all")
public class QNotifier extends AbstractEventNotifier {
protected QNotifier(InstanceRepository repository) {
super(repository);
}
/**
* <h2></h2>
* */
@Override
protected Mono<Void> doNotify(InstanceEvent event, Instance instance) {
return Mono.fromRunnable(() -> {
if (event instanceof InstanceStatusChangedEvent) {
// todo 当状态发生改变的时候, 后面自己设置发送邮件或者短信啥的
log.info("Instance Status Change: [{}], [{}], [{}]",
instance.getRegistration().getName(), event.getInstance(),
((InstanceStatusChangedEvent) event).getStatusInfo().getStatus());
} else {
log.info("Instance Info: [{}], [{}], [{}]",
instance.getRegistration().getName(), event.getInstance(),
event.getType());
}
});
}
}

@ -0,0 +1,56 @@
server:
port: 7001
servlet:
context-path: /dev-protocol-springcloud-admin
spring:
application:
name: dev-protocol-springcloud-admin
# 添加访问控制
security:
user:
name: baiye-test
password: 88888888
cloud:
nacos:
discovery:
enabled: true
server-addr: 127.0.0.1:8848
namespace: 1bc13fd5-843b-4ac0-aa55-695c25bc0ac6
metadata:
management:
context-path: ${server.servlet.context-path}/actuator
# 添加访问控制 和上面配置的保持一致
user.name: baiye-test
user.password: 88888888
# vue 的检查配置
thymeleaf:
check-template: false
check-template-location: false
# 被监控的应用状态变更为 DOWN、OFFLINE、UNKNOWN 时, 会自动发出告警: 实例的状态、原因、实例地址等信息
# 需要在 pom.xml 文件中添加 spring-boot-starter-mail 依赖
# 配置发送告警的邮箱服务器
# 但是, 这个要能连接上, 否则会报错
# mail:
# host: qinyi.imooc.com
# username: qinyi@imooc.com
# password: QinyiZhang
# default-encoding: UTF-8
# 监控告警通知
# boot:
# admin:
# notify:
# mail:
# from: ${spring.mail.username}
# to: qinyi@imooc.com
# cc: qinyi@imooc.com
# 暴露端点
management:
endpoints:
web:
exposure:
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 *, 可以开放所有端点
endpoint:
health:
show-details: always

@ -80,6 +80,11 @@
## 5. 通过 Feign 的原生 API 解析其实现原理
- ![Feign实现流程图.png](pic/Feign实现流程图.png)
## 6. 微服务通信总结
- Rest、Ribbon、OpenFeign 一步步的演进过程
- Rest: 需要写死服务的 ip 和端口(可以通过注册中心手动获取),灵活性低
- Ribbon: 提供基于 RestTemplate 的 HTTP 客户端并且支持服务负载均衡功能
- OpenFeign: 基于 Ribbon只需要使用注解和接口的配置即可完成对服务提供方的接口绑定
## OpenFeign 核心源码解析

@ -0,0 +1,41 @@
## 1. 部署 Nacos 单机版本 - (测试使用)
- 服务, 配置服务, 名字服务
- ![Nacos基本架构.png](pic/Nacos基本架构.png)
- Alibaba Nacos 概念解读
- 服务注册中心:它是服务,实例及元数据的数据库;服务注册中心可能会调用服务实例的健康检查 API 来验证它是否能够处理请求
- 服务元数据:包括服务端点(endpoints)、服务标签、服务版本号、服务实例权重、路由规则安全策略等描述服务的数据
- 服务提供、消费方:提供可复用和可调用服务的应用方;会发起对某个服务调用的应用方
- 配置:在系统开发过程中通常会将一些需要变更的参数、变量等从代码中分离出来独立管理以独立的配置文件的形式存在
- 一般不会把不会改变的数据库配置啥的信息放在nacos中, 只会有一些限流配置啥的放在nacos中
---
- 单机版本部署步骤
- 下载你所需要的版本:https://github.com/alibaba/nacos/releases
- 解压:tar -xzvf nacos-server-2.0.0.tar.gz
- 单机模式启动(默认配置就可以):./startup.sh -m standalone
- 默认地址 http://127.0.0.1:8848/nacos
- 账号密码: nacos nacos
---
- 给 Nacos 配置自定义的 MySQL 持久化
- 修改配置,指定 MySQL 地址、用户名、端口号
- 修改表名, 执行 schema.sql 文件
- 重启 Nacos 服务
---
- PS: select * from tenant_info\G 可以让查询记录格式化
## 2. 集群化部署 Alibaba Nacos - (线上使用)
- 至少使用3个节点 - 模拟的话可以用3个端口号进行标识
- 集群化部署 Alibaba Nacos 的步骤
- 定义集群部署的 ip 和端口,即 cluster.conf 文件
- 集群必须要使用可以共同访问(例如 MVSQL、PG 等等)到的数据源作为持久化的方式
- 集群化启动没有额外的参数:./startup.sh
- 修改端口号, 分别启动3个节点
---
## 3. Alibaba Nacos Client 服务注册与发现

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

@ -0,0 +1,125 @@
<?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>
<parent>
<groupId>org.example</groupId>
<artifactId>dev-protocol</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>dev-protocol-springcloud-nacos</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<!-- 模块名及描述信息 -->
<name>dev-protocol-springcloud-nacos</name>
<description>Nacos Client</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- spring cloud alibaba nacos discovery 依赖 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2.2.3.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>com.imooc.ecommerce</groupId>
<artifactId>e-commerce-mvc-config</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>-->
<!-- 数据绑定 -->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
&lt;!&ndash; nacos config &ndash;&gt;
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- &lt;!&ndash; zipkin = spring-cloud-starter-sleuth + spring-cloud-sleuth-zipkin&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-zipkin</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.kafka</groupId>-->
<!-- <artifactId>spring-kafka</artifactId>-->
<!-- <version>2.5.0.RELEASE</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; Ribbon &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; open feign &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-openfeign</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; feign 替换 JDK 默认的 URLConnection 为 okhttp &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>io.github.openfeign</groupId>-->
<!-- <artifactId>feign-okhttp</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; 使用原生的 Feign Api 做的自定义配置, encoder 和 decoder &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>io.github.openfeign</groupId>-->
<!-- <artifactId>feign-gson</artifactId>-->
<!-- <version>11.0</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; 集成 hystrix &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>-->
<!-- </dependency>-->
</dependencies>
<!--
SpringBoot的Maven插件, 能够以Maven的方式为应用提供SpringBoot的支持可以将
SpringBoot应用打包为可执行的jar或war文件, 然后以通常的方式运行SpringBoot应用
-->
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- 配置远程仓库 -->
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>

@ -0,0 +1,18 @@
package org.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
/**
* <h1>Nacos Client </h1>
* */
//@RefreshScope // 刷新配置
@EnableDiscoveryClient
@SpringBootApplication
public class NacosClientApplication {
public static void main(String[] args) {
SpringApplication.run(NacosClientApplication.class, args);
}
}

@ -0,0 +1,38 @@
package org.example.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class NacosClientService {
private final DiscoveryClient discoveryClient;
public NacosClientService(DiscoveryClient discoveryClient) {
this.discoveryClient = discoveryClient;
}
/**
* <h2> Nacos Client </h2>
* */
public List<ServiceInstance> getNacosClientInfo(String serviceId) {
// 测试 UseHystrixCommandAnnotation 的超时
// try {
// Thread.sleep(2000);
// } catch (InterruptedException ex) {
// //
// }
// 测试 NacosClientHystrixCommand 熔断
// throw new RuntimeException("has some error");
log.info("request nacos client to get service instance info: [{}]", serviceId);
return discoveryClient.getInstances(serviceId);
}
}

@ -0,0 +1,74 @@
server:
port: 8000
servlet:
context-path: /e-commerce-nacos-client
spring:
application:
name: e-commerce-nacos-client # 应用名称也是构成 Nacos 配置管理 dataId 字段的一部分 (当 config.prefix 为空时)
cloud:
nacos:
# 服务注册发现
discovery:
enabled: true # 如果不想使用 Nacos 进行服务注册和发现, 设置为 false 即可
server-addr: 127.0.0.1:8848
# server-addr: 127.0.0.1:8848,127.0.0.1:8849,127.0.0.1:8850 # Nacos 服务器地址, 集群模式
# todo 根据你自己的业务来进行区分找到
namespace: 1ccc74ae-9398-4dbe-b9d7-4f9addf9f40c
# group: e-commerce
# metadata:
# management:
# context-path: ${server.servlet.context-path}/actuator
# # 配置管理
# config:
# prefix: imooc-e-commerce
# file-extension: yaml # 配置内容的数据格式, 默认为 properties
# enabled: true # 如果不想使用 Nacos 进行配置管理, 设置为 false 即可
# group: DEFAULT_GROUP # 组, 默认为 DEFAULT_GROUP
# namespace: 1bc13fd5-843b-4ac0-aa55-695c25bc0ac6
# server-addr: 127.0.0.1:8848
# kafka:
# bootstrap-servers: 127.0.0.1:9092
# producer:
# retries: 3
# consumer:
# auto-offset-reset: latest
# sleuth:
# sampler:
# # ProbabilityBasedSampler 抽样策略
# probability: 1.0 # 采样比例, 1.0 表示 100%, 默认是 0.1
# # RateLimitingSampler 抽样策略, 设置了限速采集, spring.sleuth.sampler.probability 属性值无效
# rate: 100 # 每秒间隔接受的 trace 量
# zipkin:
# sender:
# type: kafka # 默认是 web
# base-url: http://localhost:9411/
#
## Feign 的相关配置
#feign:
# # feign 开启 gzip 压缩
# compression:
# request:
# enabled: true
# mime-types: text/xml,application/xml,application/json
# min-request-size: 1024
# response:
# enabled: true
# # 禁用默认的 http, 启用 okhttp
# httpclient:
# enabled: false
# okhttp:
# enabled: true
# # OpenFeign 集成 Hystrix
# hystrix:
# enabled: true
# 暴露端点
#management:
# endpoints:
# web:
# exposure:
# include: '*'
# endpoint:
# health:
# show-details: always

@ -0,0 +1,58 @@
### 获取 Token
POST http://127.0.0.1:8000/ecommerce-nacos-client/communication/rest-template
Content-Type: application/json
{
"username": "Qinyi@imooc.com",
"password": "25d55ad283aa400af464c76d713c07ad"
}
### 获取 Token, 带有负载均衡
POST http://127.0.0.1:8000/ecommerce-nacos-client/communication/rest-template-load-balancer
Content-Type: application/json
{
"username": "Qinyi@imooc.com",
"password": "25d55ad283aa400af464c76d713c07ad"
}
### 通过 Ribbon 去获取 Token
POST http://127.0.0.1:8000/ecommerce-nacos-client/communication/ribbon
Content-Type: application/json
{
"username": "Qinyi@imooc.com",
"password": "25d55ad283aa400af464c76d713c07ad"
}
### 通过原生 Ribbon Api 去获取 Token
POST http://127.0.0.1:8000/ecommerce-nacos-client/communication/thinking-in-ribbon
Content-Type: application/json
{
"username": "Qinyi@imooc.com",
"password": "25d55ad283aa400af464c76d713c07ad"
}
### 通过 OpenFeign 获取 Token
POST http://127.0.0.1:8000/ecommerce-nacos-client/communication/token-by-feign
Content-Type: application/json
{
"username": "Qinyi@imooc.com",
"password": "25d55ad283aa400af464c76d713c07ad"
}
### 通过原生 Feign Api 获取 Token
POST http://127.0.0.1:8000/ecommerce-nacos-client/communication/thinking-in-feign
Content-Type: application/json
{
"username": "Qinyi@imooc.com",
"password": "25d55ad283aa400af464c76d713c07ad"
}

@ -0,0 +1,35 @@
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/hystrix-command-annotation?serviceId=e-commerce-nacos-client
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/simple-hystrix-command?serviceId=e-commerce-nacos-client
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/hystrix-observable-command?serviceId=e-commerce-nacos-client
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/cache-hystrix-command?serviceId=e-commerce-nacos-client
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/cache-annotation-01?serviceId=e-commerce-nacos-client
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/cache-annotation-02?serviceId=e-commerce-nacos-client
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/cache-annotation-03?serviceId=e-commerce-nacos-client
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/request-merge
Content-Type: application/json
### 根据提供的 serviceId 获取实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/hystrix/request-merge-annotation
Content-Type: application/json

@ -0,0 +1,13 @@
### 查询服务实例信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/nacos-client/service-instance
Accept: application/json
### 动态从 Nacos Server 中获取配置信息
GET http://127.0.0.1:8000/ecommerce-nacos-client/nacos-client/project-config
Accept: application/json
### 查看 Sleuth 跟踪信息
GET http://127.0.0.1:9001/imooc/ecommerce-nacos-client/sleuth/trace-info
Accept: application/json
e-commerce-user: eyJhbGciOiJSUzI1NiJ9.eyJlLWNvbW1lcmNlLXVzZXIiOiJ7XCJpZFwiOjE3LFwidXNlcm5hbWVcIjpcIkltb29jUWlueWlAaW1vb2MuY29tXCJ9IiwianRpIjoiMGIxNzQyYWItMWU3OC00OTZjLWIyNTAtMjNkZGQ1ZGEyZTU1IiwiZXhwIjoxNjI0MjA0ODAwfQ.QKGHzohSHdYDHzUVHpe9gNPUgzfkPwrSbB-WiMWYjLlt2tr9BufzZM8bSt-whb_bd0hKoC6rkYYO0WUVR67uSML-2yaTL1xMIn8GH9Flyig3rpO4vefL3Hp2TXIpwHHa7WlKsLzcUpNk9lxWs2B5k0ICdYCH_jD5Tx6N7CzfSUG9u4fOnVeM9UFE2nX_DURupUh_DKCc2oOoMeyCSR7Ma8-Ab4WQU3r-U0YivR8G1A0kmKOIoTeRhM3LcPuxUPh3rCbrjzMg--fexRGw0O38Qsby6pz-ku2IlTyFXY6_jNOG1BZR34-jBOnaIciP1TExw9bFumeuC2GcowTHJVH1Nw
token: imooc

@ -51,6 +51,8 @@
<module>spring/spring-security/spring-security-demo</module>
<module>dev-protocol-springcloud/dev-protocol-springcloud-gateway</module>
<module>dev-protocol-springcloud/dev-protocol-springcloud-communication</module>
<module>dev-protocol-springcloud/dev-protocol-springcloud-admin</module>
<module>dev-protocol-springcloud/dev-protocol-springcloud-nacos</module>
</modules>
<properties>

Loading…
Cancel
Save