Tutorial for using git2consul configuration management tool

1. Preparation (  Original link )

Prerequisite: git2consul can only be used to manage configuration if and only if spring.cloud.consul.config.format = files, other formats cannot be used

1. Set up a remote warehouse on github or gitee, and put the consul configuration file into the remote warehouse for management


 

Java development tool download address and installation tutorial Daquan, click here .

More in-depth technical articles are here .

2. Download and install node.js

(1) Download

Go to https://nodejs.org/en/download/ to download the latest version of Node.js; go to https://nodejs.org/en/download/releases/ to download the specified version of Node.js; according to your operating system, Download and install

(2), installation

Basically, just follow the next step, omitted here

Second, install git2consul

mac system:

Execute: npm install -g git2consul if prompted without permission

Execute: sudo npm install -g git2consul, enter the password to authorize

windows system:

Execute: npm install -g git2consul-windows

Three, configure git2consul

Create a new git2consul.json file under the remote warehouse project


 

Add the following:

{

// Configuration version

“version”: “1.0”,

“repos”: [

{

// Name, refers to the name of the directory in consul

“name”: “config”,

// Git repository to be synchronized

"Url": "Your git repository",

“branches”: [

// Branch to be synchronized

“master”

],

// Do you want to use the branch name as Consul's key prefix

“include_branch_name”: false,

“hooks”: [

{

// pull mode

“type”: “polling”,

// Synchronization interval (minutes)

“interval”: “1”

}

]

}

]

}

For other options see: https://github.com/breser/git2consul

Four, start git2consul

Execute the following command to start git2consul

mac:git2consul --config-file /Users/itmuch/develop/git2consul.json

windows:git2consul-windows --config-file C:/xxxx/xxx/git2consul.json


 

Fifth, check whether it is successful

Go to the key / value tab on consul to see if it is registered

 


 

 


 

Original article, please indicate the source.

Java development tool download address and installation tutorial Daquan, click here .

More in-depth technical articles are here .

Guess you like

Origin www.cnblogs.com/darendu/p/12706421.html