blog-comments icon indicating copy to clipboard operation
blog-comments copied to clipboard

springcloud(七):配置中心svn示例和refresh - ityouknow's Blog

Open ityouknow opened this issue 7 years ago • 23 comments

http://www.ityouknow.com//springcloud/2017/05/23/springcloud-config-svn-refresh.html

上一篇springcloud(六):配置中心git示例留了一个小问题,当重新修改配置文件提交后,客户端获取的仍然是修改前的信息,这个问题我们先放下,待会再讲。国内很多公司都使用的svn来做代码的版本控制,我们先介绍以下如何使用svn+Spring Cloud Config来做配置中心。

ityouknow avatar Dec 19 '17 08:12 ityouknow

生产上, client应用部署多台服务器, 这种方式不太合适

huangningren avatar Feb 27 '18 08:02 huangningren

我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

Ruanyifei avatar Apr 20 '18 03:04 Ruanyifei

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

我也遇到了这个问题

mianjuhou avatar May 10 '18 08:05 mianjuhou

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

我也有同样的疑问,你们现在解决了吗

wuyichen avatar Jun 26 '18 07:06 wuyichen

启动的时候报错:java.lang.IllegalArgumentException: Could not resolve placeholder 'neo.hello' in value "${neo.hello}"

yinc001 avatar Jul 11 '18 11:07 yinc001

@yinc001 启动的时候报错:java.lang.IllegalArgumentException: Could not resolve placeholder 'neo.hello' in value "${neo.hello}"

需要先启动server端 再启动client-refresh端
注意修改client-refresh端中配置文件spring.cloud.config.uri=server端地址

liqimoon avatar Jul 17 '18 10:07 liqimoon

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

如果用的是idea的话,看看是不是修改 pom.xml 添加 spring-boot-starter-actuator 依赖后没有Reimport重新导包。

changhr2013 avatar Aug 09 '18 03:08 changhr2013

@changhr2013

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

如果用的是idea的话,看看是不是修改 pom.xml 添加 spring-boot-starter-actuator 依赖后没有Reimport重新导包。

是不是使用了springboot2.0啊?如果是的话,“management.security.enabled=false”是不能使用的,需要在server应用添加:

management:
  endpoints:
    web:
      exposure:
        include: "*"

在client应用上添加:

management:
  endpoints:
    web:
      exposure:
        include: refresh

然后再执行:

 curl -v -X POST "http://localhost:8002/actuator/refresh"

即可(注意版本不同的区别!)

mingwayXue avatar Aug 15 '18 03:08 mingwayXue

@mingwayXue

@changhr2013

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

如果用的是idea的话,看看是不是修改 pom.xml 添加 spring-boot-starter-actuator 依赖后没有Reimport重新导包。

是不是使用了springboot2.0啊?如果是的话,“management.security.enabled=false”是不能使用的,需要在server应用添加:

management:
  endpoints:
    web:
      exposure:
        include: "*"

在client应用上添加:

management:
  endpoints:
    web:
      exposure:
        include: refresh

然后再执行:

 curl -v -X POST "http://localhost:8002/actuator/refresh"

即可(注意版本不同的区别!)

配置项已经调整过,但是POST "http://localhost:8002/actuator/refresh"后返回的结果是 [],没有任何改动

shangwenbin1989 avatar Oct 18 '18 09:10 shangwenbin1989

@shangwenbin1989

@mingwayXue

@changhr2013

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

如果用的是idea的话,看看是不是修改 pom.xml 添加 spring-boot-starter-actuator 依赖后没有Reimport重新导包。

是不是使用了springboot2.0啊?如果是的话,“management.security.enabled=false”是不能使用的,需要在server应用添加:

management:
  endpoints:
    web:
      exposure:
        include: "*"

在client应用上添加:

management:
  endpoints:
    web:
      exposure:
        include: refresh

然后再执行:

 curl -v -X POST "http://localhost:8002/actuator/refresh"

即可(注意版本不同的区别!)

配置项已经调整过,但是POST "http://localhost:8002/actuator/refresh"后返回的结果是 [],没有任何改动

同操作,也是得到[]

AresJian avatar Nov 28 '18 07:11 AresJian

@AresJian

@shangwenbin1989

@mingwayXue

@changhr2013

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

如果用的是idea的话,看看是不是修改 pom.xml 添加 spring-boot-starter-actuator 依赖后没有Reimport重新导包。

是不是使用了springboot2.0啊?如果是的话,“management.security.enabled=false”是不能使用的,需要在server应用添加:

management:
  endpoints:
    web:
      exposure:
        include: "*"

在client应用上添加:

management:
  endpoints:
    web:
      exposure:
        include: refresh

然后再执行:

 curl -v -X POST "http://localhost:8002/actuator/refresh"

即可(注意版本不同的区别!)

配置项已经调整过,但是POST "http://localhost:8002/actuator/refresh"后返回的结果是 [],没有任何改动

同操作,也是得到[]

8002的client的,不是server的

xingyiyang avatar Dec 14 '18 07:12 xingyiyang

@AresJian

@shangwenbin1989

@mingwayXue

@changhr2013

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

如果用的是idea的话,看看是不是修改 pom.xml 添加 spring-boot-starter-actuator 依赖后没有Reimport重新导包。

是不是使用了springboot2.0啊?如果是的话,“management.security.enabled=false”是不能使用的,需要在server应用添加:

management:
  endpoints:
    web:
      exposure:
        include: "*"

在client应用上添加:

management:
  endpoints:
    web:
      exposure:
        include: refresh

然后再执行:

 curl -v -X POST "http://localhost:8002/actuator/refresh"

即可(注意版本不同的区别!)

配置项已经调整过,但是POST "http://localhost:8002/actuator/refresh"后返回的结果是 [],没有任何改动

同操作,也是得到[]

yml里面git配置 增加 force-pull: true

wangwenbo3813368 avatar Feb 19 '19 05:02 wangwenbo3813368

@wuyichen

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

我也有同样的疑问,你们现在解决了吗

是在cmd中执行

xiaxiaorui2003 avatar Jun 04 '19 14:06 xiaxiaorui2003

@huangningren 生产上, client应用部署多台服务器, 这种方式不太合适

是不是要结合消息总线来使用,会更方便,合理

With-Her avatar Aug 12 '19 09:08 With-Her

@Ruanyifei 我的post请求:http://localhost:8002/refresh 返回:{"timestamp":1524194355384,"status":404,"error":"Not Found","message":"No message available","path":"/refresh"} 是怎么回事

127.0.0.1:7002/actuator/refresh

With-Her avatar Aug 12 '19 09:08 With-Her

我这边用gitlab的webhooks去调服务的http://ip:7002/actuator/refresh,然后解析json时报错:Cannot deserialize instance of java.lang.String out of START_OBJECT token,请问有遇到这种情况的同学么

With-Her avatar Aug 13 '19 02:08 With-Her

@With-Her 我这边用gitlab的webhooks去调服务的http://ip:7002/actuator/refresh,然后解析json时报错:Cannot deserialize instance of java.lang.String out of START_OBJECT token,请问有遇到这种情况的同学么

webhooks发过来的请求body里是带参数的,/actuator/refresh应该需要的是没有body的post请求吧

trcatgithub avatar Sep 18 '19 02:09 trcatgithub

前面都成功了,就是在webhooks那里出了问题,总是说什么We couldn’t deliver this payload: Failure when receiving data from the peer,有大神帮忙解答一下吗

pokehunter1 avatar Sep 25 '19 14:09 pokehunter1

用到1.5.3版本,也导入依赖了 cmd post为啥还是{"timestamp":1569478573046,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource.","path":"/refresh"}呢

KKsmall avatar Sep 26 '19 06:09 KKsmall

666 学到了

qianchengxu avatar Nov 05 '19 02:11 qianchengxu

404,No label found for: trunk svn 服务器上,需要创建trunk目录/*.properties

a794635471 avatar Nov 14 '19 07:11 a794635471

修改配置文件后 使用 /actuator/refresh 方式去请求客户端服务,来重新获取配置时,返回[]的问题有个细节需要注意,如果服务端的配置文件管理是读取的本地磁盘,一定不要 spring.cloud.config.server.ative.searchLocations=classpath:/config 这种方式,要换一种,

#这里有个巨坑的地方,千万不要配置读取项目资源目录,否则更改配置文件不会刷新,因为项目资源是在服务启动时就加载的,你改的只是本地磁盘,它不会重新加载这个文件,所以必须使用读取磁盘的方式 #spring.cloud.config.server.ative.searchLocations=classpath:/config spring.cloud.config.server.native.searchLocations=/Users/tanjun/it/study/spring/spring-cloud-config/src/main/resources/config

这样修改后具体体现就是,每次修改配置文件后, 在服务端访问配置文件 就立即获取的是新值.

js1688 avatar Dec 20 '19 09:12 js1688

为什么设置了webhook还是不能更新

spynker avatar Jul 12 '20 11:07 spynker