spring cloud of micro-services - the configuration file into the Road

0- Introduction

  In the spring cloud micro-service architecture, basically every split micro service will deploy multiple running instances , these basic running instance, the configuration is the same, except that a small number of configurations, such as port, and these different configurations and It is essential

  Then we how to deploy a number of different instances of the same micro service it,

  You can not change to change the configuration file - compiled - released one by one come on, dozens of hundreds of examples that have exhausted cow

  Not an instance of a configuration file it, that configuration files are piled high, a change to change exhausted cow

  Others jar package from the release profile, when there are changes that can change one or exhausted cattle;

1- How to Split

  We basically use the spring cloud config server to manage the configuration files, how to split it that, the correct approach should be:

  1, pulled out a common configuration items into the configuration file application.yml spring cloud config server managed,

  2, bootstrap.yml few examples of different configurations for each item on the item, such as: port number, machine number, etc.

  3, bootstrap.yml different configuration items as a startup parameter passed:

java -jar -Xms256m -Xmx512m -Dserver.port -Dserver.workId = 8099 = 1 = 1 -Dserver.datacenterId anson.jar 

When starting the above example, set different ports, datacenterId, workId, three different examples of different settings,

 

In this way, our service with a micro only a set of configuration files, deployment is an example of how much change is not needed, only need to pass to set an example at the start;

  

Guess you like

Origin www.cnblogs.com/yanghj/p/12157549.html