Consul add configuration details

1. Need to know

Two, use

1. Start

  • Assigned to the consuldirectory, the development mode is started .\consul agent -dev, and restarting after closing will not save the previous data

2. Use

  • 1), visit http://localhost:8500/, as follows, clickKey/Value
    Insert picture description here

  • 2) Click Createto createFile/folder
    Insert picture description here

  • 3) Create testa folder, enter test/and click Save.
    Insert picture description here

  • 4) SaveAfter clicking , you will return to this page, we can continue to create in the root directory 文件/文件夹, or click testto create testa subfolder
    Insert picture description here

  • 5), click test, click on the upper right Create, enter test1/test11/test111/, create a 多个层级folder once , and finally click Save, the page refreshes
    Insert picture description here

  • 6), in the test111creation under the name configof the configuration file, and configure content

[mysql]
host = 127.0.0.1
user = aaa
pwd = 111
dn = test

Insert picture description here

  • 7), edit, as shown in the figure
    Insert picture description here

Three, read consul content

  • Project configuration file congif, configuration read consulcontent
[consul]
address = 127.0.0.1:8500
contexts = test/test1/test11/test111/config
timeout = 15s

Guess you like

Origin blog.csdn.net/qq_36025814/article/details/109746905