当前位置:网站首页>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
边栏推荐
- Promise details
- Laravel admin time range selector daterange default value problem
- Using Baidu PaddlePaddle EasyDL to accomplish specified target recognition
- 进程间通信 -- 消息队列
- 实践数据湖iceberg 第三十课 mysql->iceberg,不同客户端有时区问题
- After the MySQL router is reinstalled, it reconnects to the cluster for boot - a problem that has been configured in this host before
- mysql中整数数据类型tinyint详解
- The way to change children's programming structure
- Analyzing the role of social robots in basic science
- @Valid, @ validated learning notes
猜你喜欢

Structure of C language (Advanced)

Summary of the relationship among GPU, CUDA and cudnn

Write console script by laravel

Laravel绑定钉钉群警报(php)

redis优化系列(二)Redis主从原理、主从常用配置

Significance of actively participating in middle school robot competition

解读2022机器人教育产业分析报告

分享两个实用的shell脚本

得物技术网络优化-CDN资源请求优化实践
![Change exchange II - [leetcode]](/img/ad/33b13a004208d613c9a211fec9e5b1.png)
Change exchange II - [leetcode]
随机推荐
QT 64 bit static version display gif
Analyze the rules for the use of robots with good performance
采用百度飞桨EasyDL完成指定目标识别
MQ is easy to use in laravel
GPU, CUDA,cuDNN三者的關系總結
汇编语言 运行环境设置等教程链接整理
oh-my-lotto
Mysql排序的特性详情
Oracle连通性测试小工具
laravel编写Console脚本
qt5.8 64 位静态库中想使用sqlite但静态库没有编译支持库的方法
Detailed explanation of MySQL creation stored procedure and function
Mysql系列SQL查询语句书写顺序及执行顺序详解
Usage Summary of datetime and timestamp in MySQL
解决 『SunCertPathBuilderException:unable to find valid certification path to requested target』 问题
MySQL分区表实现按月份归类
MQ的了解
PDMS软光刻加工过程
Detailed explanation of writing sequence and execution sequence of MySQL series SQL query statements
QT 怎么把QWigdet变成QDialog