In the previous article about Zuul, it has been mentioned that the configuration service is used to store the configuration files for each service. It's spring Cloud Config.First, IntroductionIn distributed systems, because of the large number of services, in order to facilitate the unified management of service profiles, real-time updates, so the need for distributed configuration Center components. In
@SpringBootApplicationpublic class ConfigurationServiceApplication { public static void main(String[] args) { SpringApplication.run(ConfigurationServiceApplication.class, args); }}The last step is to configure the available ports in the Application.properties file and the warehouse address for saving the server configuration.server.port=9555#spring.profiles.active=native#spring.cloud.config.server.native.searchLocations=file:///${USERPROF
Spring Cloud Config provides server and client support for external configurations in distributed systems. with config Server, you can manage the external properties of your application in all environments. The conceptual mappin
@SpringBootApplication
public class ConfigurationServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigurationServiceApplication.class, args);
}
}
The last step is to configure the available ports in the Application.properties file and the warehouse address for saving the server configuration.
server.port=9555
#spring.profiles.active=native
#spring.cloud.config.server.native.searchLocations=file
.
In the "Spring Cloud Config" instance that is commonly seen online, the "config client" local configuration file "Bootstrap.properties" is as follows: the micro-service port number "8001" and the instance name "booking-server" Configuration items in the file are actua
Objective:
Must learn to springboot basic knowledge
Brief introduction:
Spring Cloud provides developers with tools to quickly build distributed systems, including configuration management, service discovery, circuit breakers, routing, micro-proxies, event busses, global locks, decision-making campaigns, distributed sessions, and more. It runs in a simple environment and can run on a
Start the server:$cdspring-cloud-config-server$../mvnwspring-boot:runthe server is a spring boot application, so you can run it from the IDE instead of liking it (the main class is ConfigServerApplication ). then try a client:$cu
as) to change the location of the application.properties configuration server, but for the boot phase of the application context, for examplespring.cloud.config.uri: http://myconfigserver.comThe Boot property /env appears as a high-priority property source in the endpoint, such as$ curl localhost:8080/env{ "profiles":[], "configService:https://github.com/spring-cloud
The previous article described how a service reads a file from the configuration center, how the configuration center reads the configuration file from a remote git, and when the service instance is many, reads the file from the configuration center, you can consider the configuration center as a micro-service, clustering it to achieve high availability, the frame composition is as follows:First, the preparatory workContinue with the project of the pr
: DataSource: username:dbuser ' {cipher}fksajdfgyos8f7glhakergfhlsaj 'The encrypted value in the. properties file cannot be enclosed in quotation marks, or the value will not be decrypted:Application.propertiesSpring.datasource.username:dbuserspring.datasource.password: {Cipher}fksajdfgyos8f7glhakergfhlsajYou can safely push this plain text to a shared git repository with a secret password.The server
Detailed reference: "Sprin Cloud and Docker Micro-service Architecture combat" p162-9.9.4 FestivalThe changes to be made are:1. Add SPRING-CLOUD-STARTER-BUS-AMQP package to Spring Cloud Config
Spring cloud config implements hot deployment of datasource, clouddatasource
The basic usage of spring cloud config has been mentioned in the previous blog. If you do not know about it, read the previous blog first.
1. Introduction The highly available distributed configuration Center, which is a microservices-ready configuration Center, is clustered to achieve high availability. Config-server and Config-client register with Eureka-server and Config-
password: ‘{cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJ‘The encrypted value in the. properties file cannot be enclosed in quotation marks, or the value will not be decrypted:application.propertiesspring.datasource.username: dbuserspring.datasource.password: {cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJYou can safely push this plain text to a shared git repository with a secret password.The server also exposes the/encryp
: ‘{cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJ‘The encrypted value in the. properties file cannot be enclosed in quotation marks, or the value will not be decrypted:Application.propertiesspring.datasource.username: dbuserspring.datasource.password: {cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJYou can safely push this plain text to a shared git repository with a secret password.The server also exposes the/encrypt and/decryp
: ‘{cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJ‘The encrypted value in the properties file cannot be enclosed in quotation marks, or the value will not be decrypted:Application.propertiesspring.datasource.username: dbuserspring.datasource.password: {cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJYou can safely push this plain text to a shared git repository with a secret password.The server also exposes the/encrypt and/decrypt
: dbuser password: ‘{cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJ‘The encrypted value in the properties file cannot be enclosed in quotation marks, or the value will not be decrypted:Application.propertiesspring.datasource.username: dbuserspring.datasource.password: {cipher}FKSAJDFGYOS8F7GLHAKERGFHLSAJYou can safely push this plain text to a shared git repository with a secret password.The server also exposes the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.