Spring cloud config high availability configuration instance code of spring cloud distributed configuration center
1、 Introduction
When deploying the configuration center to the production environment, we also want it to be a highly available application like the service registry. Spring cloud config is very simple to achieve high availability on the server side, mainly in the following two ways.
Traditional mode: there is no need to make any additional configuration for these servers, just follow a configuration rule and point all config servers to the same git warehouse, so that all configuration contents can be maintained through a unified shared file system. When specifying the location of config server, the client only needs to configure the load balancing device address on the upper layer of config server, as shown in the following figure.
Service mode: in addition to the above traditional implementation mode, we can also incorporate config server into Eureka's service governance system as a common microservice application. In this way, our microservice application can obtain the configuration information through the service name of the configuration center. This method is more conducive to maintenance than the traditional implementation mode, because the load balancing configuration of the server and the designation of the configuration center of the client are solved through the service governance mechanism, which not only realizes high availability, but also realizes self maintenance. Since the implementation of this part requires the cooperation of the client, readers of specific examples can read the section "service configuration center" in the section "detailed explanation of the client".
2、 Preliminary preparation
A service registry, eurekaserver, with port 5555;