Springcloud+bus+本地gitlab自动刷新问题

服务端配置文件:bootstrap.yml,关键配置

spring:
application:
name: config-server
#config-server配置
cloud:
config:
server:
git:
# gitlab需要加.git后缀
uri: http://ip:port/root/config-source.git
username: root
password: 密码
# 访问ssh私钥口令—git,在创建秘钥的时候回要求输入此密码,不输入的话跟password一样
passphrase: 密码
# 多个用“,”隔开
search-paths: user-center,config-client,test-client
# 忽略SSL证书校验
skip-ssl-validation: true
# 指定svn目录下的某个文件夹作为配置仓库 默认为trunk,git默认是master,gitlab需要创建分支,idea中右下角,在提交资源配置文件时,先切换到对应的分支下(没有就先新增),再提交
default-label: config
bus:
trace:
enabled: true
enabled: true
#指定配置中心使用svn管理: subversion
profiles:
active: dev
#rabbitmq 配置
rabbitmq:
host: rabbit的ip地址
port: 5672
username: 用户名
password: 密码

客户端配置文件:bootstrap.yml,关键配置

spring:
application:
name: config-client
cloud:
config:
# 开启通过服务来访问Config Server的功能
discovery:
enabled: true
service-id: config-server
# 可以写多个,中间用“,”隔开
name: config-client
# 环境名,对应前配置文件中的{profile}部分
profile: dev
# 启动失败时能够快速响应
fail-fast: true
# 指定分支
label: config
bus:
# 将不同的项目在bus中区分
id: s p r i n g . a p p l i c a t i o n . n a m e : {spring.application.name}: spring.application.name:{spring.cloud.config.profile}?{random.value}
trace:
enabled: true
enabled: true
inetutils:
# 可用ip地址段表示,本地测试用
preferred-networks: [‘172’]
rabbitmq:
host: ip
port: 5672
username: root
password: 密码
#actuator健康检查
management:
endpoints:
web:
exposure:
include: “*” #暴露所有端点 默认是info和health
endpoint:
health:
show-details: always #默认是never

gitlab中的webhook地址:

http://config-server的ip:端口/monitor
push events中我录入了*,表示刷新所有分支
启用:SSL verification

手工刷新:

postman中post方式调用http://config-server端的ip:端口/actuator/bus-refresh

不能刷新原因

webhook地址不对

客户端spring.application.name与spring.cloud.config.name的名称不一样,导致不能自动刷新,但能手工刷新

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值