springcloud bus study notes

1 environment

  • System environment: win10
  • Editor: IDEA
  • springcloud:H版
  • rabbitmq

2 Introduction

  • springcloud bus agent connected by a lightweight micro-messaging service is available each broadcast configuration file to change / monitoring or management services
  • Installation rabbitmq article reference

3 Refresh All

1 Add rely bus

config-server和config-client pom都要添加

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>

2 rabbitmq YML 配置

config-server和config-client bootstrap.yml都要添加如下配置

spring:
  rabbitmq:
    host: xxxx
    port: 5672
    username: guest
    password: guest

3 config-server add-dependent monitoring

	<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

4 springsecurity profile

Config previous article retry closed springsecurity yml configuration content is now open

5 Start Project (config-server config-client eureka-server)

  • Check whether access client refresh implementation
    Here Insert Picture Description
  • Modify the file post -> http: // localhost: 8088 / actuator / bus-refresh
    Here Insert Picture Description
  • Indeed visit again updated
    Here Insert Picture Description

6-by-refresh

1 packaged config-client

Here Insert Picture Description

2 Start 2 client

java -jar config-client-0.0.1-SNAPSHOT.jar --server.port=8091
java -jar config-client-0.0.1-SNAPSHOT.jar --server.port=8090

3 git modified again on the test file is test321

4 unvisited ago

Here Insert Picture Description

5 single client interface to refresh

  • Now I want to refresh the 8090 port 8091 is not updated (a real scene is impossible refresh n other interfaces)
    • accesshttp://localhost:8088/actuator/bus-refresh/client1:8090
      Here Insert Picture Description
      Here Insert Picture Description
      Here Insert Picture Description

7 Summary

Dependent monitoring and configuration rabbitmq xxx bus-refresh rabbitmq
Refresh All (visit http: // localhost: 8088 / actuator / bus-refresh) and by-refresh (server does not change) the need for client-by-refresh yml be configured for example eureka should use name : Application Name {}: {Port number} access monitoring post little difference http: // localhost: 8088 / actuatorApplication name: port number

Published 76 original articles · won praise 41 · views 40000 +

Guess you like

Origin blog.csdn.net/edtwar/article/details/105149297