TIPS
If and only if
spring.cloud.consul.config.format=files
when , Only available git2consul Configuration management , Other formats cannot be used .
Stand-alone version Consul The configuration of is not persistent , Once rebooted, it will be lost , And in the development process , restart Consul Maybe more often . To solve this problem , The configuration can be stored in Git Warehouse , And use git2consul Synchronize configuration to Consul in , Here are the steps .
install Node.js
download Node.js
Go to https://nodejs.org/en/download/
Download the latest version Node.js; Go to https://nodejs.org/en/download/releases/
Download the specified version Node.js; According to your own operating system , Download and install .
TIPS
Try to install LTS edition , for example :
10.16.3
install Node.js
Reference resources https://www.runoob.com/nodejs/nodejs-install-setup.html
install Node.js, Common system installation instructions are .
install git2consul
Specify the following command to install git2consul
1 |
npm install -g git2consul |
If the network is not good , Installation speed is too slow , You can use the following command :
1 |
npm install -g git2consul --registry=https://registry.npm.taobao.org |
Be careful : about Windows operating system , To be implemented :
1 |
npm install -g consul-windows |
To configure git2consul
Prepare the configuration file , be known as git2consul.json
The contents are as follows :
1 |
{ |
Other options can be found in :https://github.com/breser/git2consul
start-up git2consul
Execute the following command , You can start git2consul
1 |
git2consul --config-file /Users/itmuch/develop/git2consul.json |
Be careful : about Windows operating system , To be implemented :
1 |
git2consul-windows --config-file C:/xxxx/xxx/git2consul.json |
Reference documents
- git2consul Of GitHub:https://github.com/breser/git2consul
- Spring Cloud Consul Official documents :https://cloud.spring.io/spring-cloud-static/spring-cloud-consul/2.1.3.RELEASE/single/spring-cloud-consul.html
- spring cloud Use git2consul Manage configuration center :https://blog.csdn.net/qq_19671173/article/details/82260070
- fix crash on windows:https://github.com/breser/git2consul/pull/173