当前位置:网站首页>Nacos Foundation (7): Configuration Management
Nacos Foundation (7): Configuration Management
2022-04-23 11:26:00 【There is no retreat when sailing against the current】
List of articles
Preface
nacos Detailed use of configuration management .
Section 1 Configuration list
1. Modifying data
Modifying data , Click publish , Pop up content comparison , Help users reduce modification errors , Differences in the occurrence of data items , Click OK to publish .
2. Export import
When we want to start from the namespace A Move the configuration of to namespace B when , There may be a lot of content , At this time, the export and import function is used to improve efficiency .
(1) export
(2) Switch namespace , And click Import configuration , Select the file you just downloaded .
3. clone
We can also use cloning , take A The configuration of the namespace is cloned into the namespace B
In the second quarter Version history
We can view the historical modification record of the configuration file through the historical version function , And historical versions of belief information , You can also click rollback , Replace the current content with a historical version .
Details
In the third quarter Monitor query
nacos It provides the ability to configure the query of subscribers, i.e. listeners , At the same time, the current configuration of the client is provided MD5 Check value , In order to help users better check whether configuration changes are pushed to client paragraph .
Just add a listener here .
package com.it2;
import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.Listener;
import com.alibaba.nacos.api.exception.NacosException;
import java.util.Properties;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
public class NacosDemo02 {
public static void main(String[] args) throws NacosException, InterruptedException {
String dataId="nacos-demo.yaml";
String group="DEFAULT_GROUP";
String serverAddr="127.0.0.1:8848";
Properties properties=new Properties();
properties.put("serverAddr",serverAddr);
// This is from wrong public Get configuration set from namespace of , You need a namespace id
properties.put("namespace","d0f32411-9568-4cd3-a595-a1d98989bbeb");
ConfigService configService= NacosFactory.createConfigService(properties);
String config=configService.getConfig(dataId,group,3000);
System.out.println(config);
configService.addListener(dataId, group, new Listener() {
public Executor getExecutor() {
return null;
}
public void receiveConfigInfo(String s) {
// Used to accept listening content
System.out.println(s);
}
});
// Hibernation prevents the program from ending
TimeUnit.HOURS.sleep(1L);
}
}
Run code , Output content .
At this time in nacos Modify this configuration file , Add information to the monitored configuration file , And publish .
When in nacos After the modified dataset is published , The listener immediately receives the new configuration content .
At the same time nacos Listening and querying under configuration management , We can also see what is being monitored ,MD5 The code represents the of the monitored data set MD5 code .
版权声明
本文为[There is no retreat when sailing against the current]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231117595110.html
边栏推荐
- Summary of QT semaphore unresolved errors
- Using Baidu PaddlePaddle EasyDL to accomplish specified target recognition
- 全网最细的短网址系统设计与实战
- laravel 永远返回 JSON 响应
- Understanding of fileprovider path configuration strategy
- 学习 Go 语言 0x02:对切片 Slice 的理解
- laravel-admin表单验证
- VM set up static virtual machine
- 学习 Go 语言 0x03:理解变量之间的依赖以及初始化顺序
- 微型机器人的认知和研发技术
猜你喜欢
少儿编程结构的改变之路
On lambda powertools typescript
赛微微电科创板上市破发:跌幅达26% 公司市值44亿
On the integration of steam education in early childhood education
R-Drop:更强大的Dropout正则方法
nacos基础(6):nacos配置管理模型
Change exchange II - [leetcode]
解析性能良好的机器人使用守则
Overall plan management mode in maker Education
VM set up static virtual machine
随机推荐
MySQL对数据表已有表进行分区表的实现
FileProvider 路径配置策略的理解
PDMS软光刻加工过程
Learn go language 0x03: understand the dependency between variables and initialization order
map<QString, bool> 的使用记录
R-Drop:更强大的Dropout正则方法
MySQL8.0升级的踩坑历险记
Three web components (servlet, filter, listener)
Detailed introduction to paging exploration of MySQL index optimization
详解MySQL中timestamp和datetime时区问题导致做DTS遇到的坑
讯飞2021年营收183亿:同比增41% 净利为15.56亿
GPU, CUDA,cuDNN三者的關系總結
nacos基础(5):nacos配置入门
学习 Go 语言 0x03:理解变量之间的依赖以及初始化顺序
Get things technology network optimization - CDN resource request Optimization Practice
Pytorch neural network trainer
Significance of actively participating in middle school robot competition
进程间通信 -- 消息队列
mysql创建存储过程及函数详解
解决 『SunCertPathBuilderException:unable to find valid certification path to requested target』 问题