Eclipse配置运行SpringCloud(Hoxton + 2.2.4)微服务框架 + 消息总线集成Spring Cloud Bus(RabbitMQ || Kafka)
Spring Cloud BusSpring Cloud Config服务端负责将git svn中存储的配置文件发布成REST接口,客户端可以从服务端REST接口获取配置。但客户端并不能主动感知到配置的变化,从而主动去获取新的配置,这需要每个客户端通过POST方法触发各自的/refresh。Spring Cloud Bus通过一个轻量级消息代理连接分布式系统的节点。这可以用于广播状态更改(如配..
Spring Cloud Bus
Spring Cloud Config服务端负责将git svn中存储的配置文件发布成REST接口,客户端可以从服务端REST接口获取配置。但客户端并不能主动感知到配置的变化,从而主动去获取新的配置,这需要每个客户端通过POST方法触发各自的/refresh。
Spring Cloud Bus通过一个轻量级消息代理连接分布式系统的节点。这可以用于广播状态更改(如配置更改)或其他管理指令。Spring Cloud Bus提供了通过POST方法访问的endpoint/bus/refresh,这个接口通常由git的钩子功能调用,用以通知各个Spring Cloud Config的客户端去服务端更新配置。
SpringCloudConfig结合SpringCloudBus实现分布式配置的工作流
- 提交代码触发post请求给bus/refresh
- server端接收到请求并发送给Spring Cloud Bus
- Spring Cloud bus接到消息并通知给其它客户端
- 其它客户端接收到通知,请求Server端获取最新配置
- 全部客户端均获取到最新的配置
消息代理
消息代理(Message Broker)是一种消息验证、传输、路由的架构模式。消息代理是一个中间件产品,它的核心是一个消息的路由程序,用来实现接收和分发消息,并根据设定好的消息处理流来转发给正确的应用。它包括独立的通信和消息传递协议,能够实现组织内部和组织间的网络通信。设计代理的目的就是为了能够从应用程序中传入消息,并执行一些特别的操作。
目前Spring Cloud Bus 支持
- RabbitMQ:spring-cloud-starter-bus-amqp
- Kafka:spring-cloud-starter-bus-kafka
RabbitMQ方式
配置RabbitMQ
创建用户
rabbitmqctl add_user [username] [password]
设置tag
rabbitmqctl set_user_tags username [tag1] [tag2] ...
用户授权
rabbitmqctl set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
登录
浏览器访问http://localhost:15672
服务端配置 Config Server
依赖包文件POM.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.springcloud</groupId>
<artifactId>springcloud-root</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>springcloud-eureka-provider</artifactId>
<name>springcloud-eureka-provider</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<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>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
配置application.yml文件
spring:
application:
name: springcloud-config-server
freemarker:
prefer-file-system-access: false
security:
user:
name: admin
password: 123456
cloud:
config:
# 配置仓库的分支
label: master
server:
git:
# 配置git仓库地址
# uri: git@local-git.com/springcloud-config.git
uri: file:E:/SpringBoot/SpringCloud/springcloud-root/springcloud-config
# 配置仓库路径
search-paths: config-file
# 访问git仓库的用户名
username: zhaojq
# 访问git仓库的用户密码
password: 123456
bus:
enabled: true
trace:
enabled: true
refresh:
enabled: true
rabbitmq:
host: localhost
port: 5672
username: zhaojq
password: 123456
server:
port: 8130
management:
endpoints:
web:
exposure:
include: '*'
eureka:
instance:
hostname: eureka-config-server.com
instance-id: eureka-config-server
client:
service-url:
defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer1.com:8897/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer2.com:8898/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer3.com:8899/eureka/
启动项目springcloud-config-server
rabbit,kafka, and no default binder has been set.错误
org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: A default binder has been requested, but there is more than one binder available for 'org.springframework.cloud.stream.messaging.DirectWithAttributesChannel' : rabbit,kafka, and no default binder has been set.
Kafka 和 RabbitMQ 只能配置一个,如果 kafka 和 RabbitMQ 依赖包同时存在,启动时会报上述错误。
客户端配置 Config Client
依赖包文件POM.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.springcloud</groupId>
<artifactId>springcloud-root</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>springcloud-eureka-provider</artifactId>
<name>springcloud-eureka-provider</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<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>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
bootstrap.yml文件
spring:
application:
name: springcloud-eureka-provider
freemarker:
prefer-file-system-access: false
security:
user:
name: admin
password: 123456
cloud:
config:
#profile: dev
label: master
fail-fast: true
#指明配置服务中心的网址
#uri: http://eureka-config-server.com:8130
discovery:
service-id: springcloud-config-server
enabled: true
bus:
enabled: true
trace:
enabled: true
refresh:
enabled: true
rabbitmq:
host: localhost
port: 5672
username: zhaojq
password: 123456
# Spring Boot 2.x已淘汰的方式:management.security.enabled=false
management:
endpoints:
web:
exposure:
include: '*'
eureka:
instance:
hostname: eureka-provider2.com
instance-id: eureka-provider2
client:
service-url:
defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer1.com:8897/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer2.com:8898/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer3.com:8899/eureka/
修改配置类
在需要更新的配置类上加@RefreshScope注解,@RefreshScope必须加,否则客户端会收到服务端的更新消息,但是更新不了,因为不知道更新哪里的。
package org.springcloud.eureka.provider;
import org.springframework.beans.factory.annotation.Value;
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;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@EnableDiscoveryClient
@RestController
@RefreshScope
public class ConfigProviderApplication {
@Value("${content}")
String content;
@Value("${server.port}")
String port;
@RequestMapping("/config")
public String Home(@RequestParam String name) {
return "Hello "+name+", This is from serverport:" + port+",content="+content;
}
public static void main(String[] args) {
SpringApplication.run(ConfigProviderApplication.class, args);
}
}
依次启动项目
springcloud-eureka-cluster-peer1
springcloud-eureka-cluster-peer2
springcloud-eureka-cluster-peer3
springcloud-config-server
springcloud-eureka-provider1
springcloud-eureka-provider2
springcloud-eureka-provider3
An unexpected connection driver error occured错误
2020-02-23 01:17:02.141 INFO 26300 --- [SeGTZQPlTXZGQ-9] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2020-02-23 01:17:02.145 ERROR 26300 --- [ 127.0.0.1:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occured
用户授予了角色,只能登录控制台,但是没有给读写以及管理队列的权限,通过控制台admin按钮查看,参考用户授权,rabbitmqctl set_permissions后
测试服务
1、修改配置
修改Git仓库配置
2、查看 Config Server
浏览器访问http://eureka-config-server.com:8130/application/test/master
Config Server 已经是最新的值。
3、刷新配置
发送 POST请求到:http://eureka-config-server.com:8130/actuator/bus-refresh
springcloud-eureka-provider1收到远程更新请求
Received remote refresh request. Keys refreshed [config.client.version, content]
Attempting to connect to: [localhost:5672]
Created new connection: rabbitConnectionFactory.publisher#9282cf2:0/SimpleConnection@6f1560a7 [delegate=amqp://zhaojq@127.0.0.1:5672/, localPort= 53197]
DiscoveryClient_SPRINGCLOUD-EUREKA-PROVIDER/eureka-provider1 - registration status: 204
DiscoveryClient_SPRINGCLOUD-EUREKA-PROVIDER/eureka-provider1: registering service...
DiscoveryClient_SPRINGCLOUD-EUREKA-PROVIDER/eureka-provider1 - registration status: 204
springcloud-eureka-provider2,springcloud-eureka-provider3也收到了如上请求。
4、再次访问 Config Client
访问:
http://eureka-provider1.com:8001/config?name=zhaojq,
http://eureka-provider2.com:8002/config?name=zhaojq
http://eureka-provider3.com:8003/config?name=zhaojq
已经刷新了配置
Kafka方式
配置Kafka
zookeeper
- 下载安装包
http://zookeeper.apache.org/releases.html#download - 解压并进入ZooKeeper目录,如:E:\SpringBoot\apache-zookeeper-3.5.7-bin\conf
- 将“zoo_sample.cfg”重命名为“zoo.cfg”
- 打开“zoo.cfg”找到并编辑dataDir=E:\SpringBoot\apache-zookeeper-3.5.7-bin\tmp
- 添加系统变量:ZOOKEEPER_HOME=E:\SpringBoot\apache-zookeeper-3.5.7-bin
- 编辑path系统变量,添加路径:%ZOOKEEPER_HOME%\bin
- 在zoo.cfg文件中修改默认的Zookeeper端口(默认端口2181)
- 按下Shift+右键,打开新的PowerShell,输入“zkServer“,运行Zookeeper
- 命令行提示如下:说明本地Zookeeper启动成功
注意:此窗口不关闭
Kafka
- 下载安装包
http://kafka.apache.org/downloads - 解压并进入Kafka目录,如:E:\SpringBoot\kafka_2.13-2.4.0
- 进入config目录找到文件server.properties并打开
- 找到并编辑log.dirs=log.dirs=E:\SpringBoot\kafka_2.13-2.4.0\kafka-logs
- 找到并编辑zookeeper.connect=localhost:2181
- Kafka会按照默认,在9092端口上运行,并连接zookeeper的默认端口:2181
- 进入Kafka安装目录E:\SpringBoot\kafka_2.13-2.4.0,按下Shift+右键,打开新的PowerShell,打开命令行,输入:
.\bin\windows\kafka-server-start.bat .\config\server.properties
- 命令行提示如下:说明本地Kafka启动成功
注意:此窗口不关闭
测试Kafka
进入Kafka安装目录E:\SpringBoot\kafka_2.13-2.4.0,按下Shift+右键,打开新的PowerShell,打开命令行,输入:
创建Topic
.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
查看Topic
.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181
创建生产者
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test
创建消费者
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
服务端配置 Config Server
依赖包文件POM.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.springcloud</groupId>
<artifactId>springcloud-root</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>springcloud-config-server</artifactId>
<name>springcloud-config-server</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</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-bus-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
配置application.yml文件
spring:
application:
name: springcloud-config-server
freemarker:
prefer-file-system-access: false
security:
user:
name: admin
password: 123456
cloud:
config:
# 配置仓库的分支
label: master
server:
git:
# 配置git仓库地址
# uri: git@local-git.com/springcloud-config.git
uri: file:E:/SpringBoot/SpringCloud/springcloud-root/springcloud-config
# 配置仓库路径
search-paths: config-file
# 访问git仓库的用户名
username: zhaojq
# 访问git仓库的用户密码
password: 123456
bus:
enabled: true
trace:
enabled: true
refresh:
enabled: true
#rabbitmq:
#host: localhost
#port: 5672
#username: zhaojq
#password: 123456
kafka:
bootstrap-servers:
- localhost:9092
server:
port: 8130
management:
endpoints:
web:
exposure:
include: '*'
eureka:
instance:
hostname: eureka-config-server.com
instance-id: eureka-config-server
client:
service-url:
defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer1.com:8897/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer2.com:8898/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer3.com:8899/eureka/
启动项目springcloud-config-server
客户端配置 Config Client
依赖包文件POM.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.springcloud</groupId>
<artifactId>springcloud-root</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>springcloud-eureka-provider</artifactId>
<name>springcloud-eureka-provider</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<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>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
bootstrap.yml文件
spring:
application:
name: springcloud-eureka-provider
freemarker:
prefer-file-system-access: false
security:
user:
name: admin
password: 123456
cloud:
config:
#profile: dev
label: master
fail-fast: true
#指明配置服务中心的网址
#uri: http://eureka-config-server.com:8130
discovery:
service-id: springcloud-config-server
enabled: true
bus:
enabled: true
trace:
enabled: true
refresh:
enabled: true
#rabbitmq:
#host: localhost
#port: 5672
#username: zhaojq
#password: 123456
kafka:
bootstrap-servers:
- localhost:9092
# Spring Boot 2.x已淘汰的方式:management.security.enabled=false
management:
endpoints:
web:
exposure:
include: '*'
eureka:
instance:
hostname: eureka-provider2.com
instance-id: eureka-provider2
client:
service-url:
defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer1.com:8897/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer2.com:8898/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer3.com:8899/eureka/
依次启动项目
springcloud-eureka-cluster-peer1
springcloud-eureka-cluster-peer2
springcloud-eureka-cluster-peer3
springcloud-config-server
springcloud-eureka-provider1
springcloud-eureka-provider2
springcloud-eureka-provider3
springcloud-eureka-provider1输出如下:
2020-02-24 02:16:36.436 INFO 12888 --- [ main] o.a.kafka.common.utils.AppInfoParser : Kafka version: 2.3.1
2020-02-24 02:16:36.436 INFO 12888 --- [ main] o.a.kafka.common.utils.AppInfoParser : Kafka commitId: 18a913733fb71c01
2020-02-24 02:16:36.436 INFO 12888 --- [ main] o.a.kafka.common.utils.AppInfoParser : Kafka startTimeMs: 1582481796436
2020-02-24 02:16:36.457 INFO 12888 --- [ main] o.a.k.clients.consumer.ConsumerConfig : ConsumerConfig values:
allow.auto.create.topics = true
auto.commit.interval.ms = 100
auto.offset.reset = latest
bootstrap.servers = [localhost:9092]
check.crcs = true
client.dns.lookup = default
client.id =
client.rack =
connections.max.idle.ms = 540000
default.api.timeout.ms = 60000
enable.auto.commit = false
exclude.internal.topics = true
fetch.max.bytes = 52428800
fetch.max.wait.ms = 500
fetch.min.bytes = 1
group.id = anonymous.81ab530a-354f-407f-b513-84d6641b561c
group.instance.id = null
heartbeat.interval.ms = 3000
interceptor.classes = []
internal.leave.group.on.close = true
isolation.level = read_uncommitted
key.deserializer = class org.apache.kafka.common.serialization.ByteArrayDeserializer
max.partition.fetch.bytes = 1048576
max.poll.interval.ms = 300000
max.poll.records = 500
metadata.max.age.ms = 300000
metric.reporters = []
metrics.num.samples = 2
metrics.recording.level = INFO
metrics.sample.window.ms = 30000
partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor]
receive.buffer.bytes = 65536
reconnect.backoff.max.ms = 1000
reconnect.backoff.ms = 50
request.timeout.ms = 30000
retry.backoff.ms = 100
sasl.client.callback.handler.class = null
sasl.jaas.config = null
sasl.kerberos.kinit.cmd = /usr/bin/kinit
sasl.kerberos.min.time.before.relogin = 60000
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
sasl.kerberos.ticket.renew.window.factor = 0.8
sasl.login.callback.handler.class = null
sasl.login.class = null
sasl.login.refresh.buffer.seconds = 300
sasl.login.refresh.min.period.seconds = 60
sasl.login.refresh.window.factor = 0.8
sasl.login.refresh.window.jitter = 0.05
sasl.mechanism = GSSAPI
security.protocol = PLAINTEXT
send.buffer.bytes = 131072
session.timeout.ms = 10000
ssl.cipher.suites = null
ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
ssl.endpoint.identification.algorithm = https
ssl.key.password = null
ssl.keymanager.algorithm = SunX509
ssl.keystore.location = null
ssl.keystore.password = null
ssl.keystore.type = JKS
ssl.protocol = TLS
ssl.provider = null
ssl.secure.random.implementation = null
ssl.trustmanager.algorithm = PKIX
ssl.truststore.location = null
ssl.truststore.password = null
ssl.truststore.type = JKS
value.deserializer = class org.apache.kafka.common.serialization.ByteArrayDeserializer
测试服务
1、修改配置
修改Git仓库配置
2、查看 Config Server
浏览器访问http://eureka-config-server.com:8130/application/test/master
Config Server 已经是最新的值。
3、刷新配置
发送 POST请求到:http://eureka-config-server.com:8130/actuator/bus-refresh
4、再次访问 Config Client
访问:http://eureka-provider3.com:8003/config?name=zhaojq
已经刷新了配置。
更多推荐
所有评论(0)