#187 Add label dump task
This commit is contained in:
parent
7fac0909d4
commit
64f29ddd78
108
CHANGELOG.md
108
CHANGELOG.md
@ -1,7 +1,21 @@
|
|||||||
|
## 0.7.0(Dec, 2018)
|
||||||
|
|
||||||
|
* [ #461 ] Registration failed when instance port is set to 0
|
||||||
|
* [ #455 ] The console can't change the change code
|
||||||
|
* [ #447 ] 集群模式server挂掉一台后,提供方注册失败
|
||||||
|
* [ #445 ] 0.6.1控制台创建配置发布提交时,提示信息有问题
|
||||||
|
* [ #442 ] Typos in class names and variables.
|
||||||
|
* [ #413 ] The console has some uncaught exceptions
|
||||||
|
* [ #395 ] nacos surport mysql in the case of stand-alone mode
|
||||||
|
* [ #393 ] Support operation of selector on console
|
||||||
|
* [ #365 ] NodeJs SDK support
|
||||||
|
* [ #362 ] The metadata will lost when online or offline instance through web ui
|
||||||
|
* [ #187 ] Provide Label ability for Naming Service into NACOS for complex multi-DC scenario.
|
||||||
|
|
||||||
## 0.6.1(Dec, 2018)
|
## 0.6.1(Dec, 2018)
|
||||||
|
|
||||||
[#421] NamingService's serivce name can't use colon(:) in Windows
|
* [#421] NamingService's serivce name can't use colon(:) in Windows
|
||||||
[#432] When packing nacos-core, ${user.home} is replaced in the logback configuration file (nacos.xml)
|
* [#432] When packing nacos-core, ${user.home} is replaced in the logback configuration file (nacos.xml)
|
||||||
|
|
||||||
## 0.6.0(Dec, 2018)
|
## 0.6.0(Dec, 2018)
|
||||||
|
|
||||||
@ -16,61 +30,61 @@
|
|||||||
|
|
||||||
## 0.5.0(Nov, 2018)
|
## 0.5.0(Nov, 2018)
|
||||||
|
|
||||||
[#148] Naming write performace.
|
* [#148] Naming write performace.
|
||||||
[#175] Support deregistering instance automatically.
|
* [#175] Support deregistering instance automatically.
|
||||||
[#176] Naming client query instance method should bypass local cache at client start.
|
* [#176] Naming client query instance method should bypass local cache at client start.
|
||||||
[#177] Console supports registering new empty service and delete empty service.
|
* [#177] Console supports registering new empty service and delete empty service.
|
||||||
[#181] NPE when adding a instance if no leader in the raft cluster.
|
* [#181] NPE when adding a instance if no leader in the raft cluster.
|
||||||
[#193] Configure host domain name cause nacos server cluster is unavailable.
|
* [#193] Configure host domain name cause nacos server cluster is unavailable.
|
||||||
[#209] Disable service and cluster level customization in client registerInstance method.
|
* [#209] Disable service and cluster level customization in client registerInstance method.
|
||||||
[#214] Please support Java 11.
|
* [#214] Please support Java 11.
|
||||||
[#222] print more nacos server start status info in start.log.
|
* [#222] print more nacos server start status info in start.log.
|
||||||
[#231] Refactoring: Parsing the Nacos home directory and the cluster.conf file.
|
* [#231] Refactoring: Parsing the Nacos home directory and the cluster.conf file.
|
||||||
[#246] "mvn -B clean apache-rat:check findbugs:findbugs" did not work as expected.
|
* [#246] "mvn -B clean apache-rat:check findbugs:findbugs" did not work as expected.
|
||||||
[#251] Console Editor Optimization.
|
* [#251] Console Editor Optimization.
|
||||||
[#254] DataId and group are required in historical version and listener query.
|
* [#254] DataId and group are required in historical version and listener query.
|
||||||
[#256] Whether the service discovery data needs to add a newline link symbol.
|
* [#256] Whether the service discovery data needs to add a newline link symbol.
|
||||||
[#257] Listening query switching query dimension data is not refreshed.
|
* [#257] Listening query switching query dimension data is not refreshed.
|
||||||
[#258] Remove the Balloon of DataId/Group.
|
* [#258] Remove the Balloon of DataId/Group.
|
||||||
[#259] Listening query paging size problem.
|
* [#259] Listening query paging size problem.
|
||||||
[#272] "#it is ip" is also parsed into an instance IP.
|
* [#272] "#it is ip" is also parsed into an instance IP.
|
||||||
[#275] nacos coredns plugin to support DNS.
|
* [#275] nacos coredns plugin to support DNS.
|
||||||
[#281] We should lint the console code.
|
* [#281] We should lint the console code.
|
||||||
[#302] Maven build project supports java 11.
|
* [#302] Maven build project supports java 11.
|
||||||
[#316] In stand alone mode, Nacos still checks the cluster.conf.
|
* [#316] In stand alone mode, Nacos still checks the cluster.conf.
|
||||||
|
|
||||||
## 0.4.0(Nov 7, 2018)
|
## 0.4.0(Nov 7, 2018)
|
||||||
|
|
||||||
[#216] Fix tenant dir problem
|
* [#216] Fix tenant dir problem
|
||||||
[#197] Service update ignored some properties
|
* [#197] Service update ignored some properties
|
||||||
[#190] Client beat lose weight info and metadata info
|
* [#190] Client beat lose weight info and metadata info
|
||||||
[#188] Console delete data cannot be updated in time
|
* [#188] Console delete data cannot be updated in time
|
||||||
[#179] Listening query fail when namespace is not blank
|
* [#179] Listening query fail when namespace is not blank
|
||||||
[#157] Lack information in readme.md to describe the related project repositories for Nacos echosystem
|
* [#157] Lack information in readme.md to describe the related project repositories for Nacos echosystem
|
||||||
[#144] There have a error and something are not clear
|
* [#144] There have a error and something are not clear
|
||||||
[#106] Snapshot file create error
|
* [#106] Snapshot file create error
|
||||||
[#92] Eliminate warnings, refactor code, show start.log detail
|
* [#92] Eliminate warnings, refactor code, show start.log detail
|
||||||
|
|
||||||
|
|
||||||
## 0.3.0(Oct 26, 2018)
|
## 0.3.0(Oct 26, 2018)
|
||||||
|
|
||||||
[#171] UI debug errors
|
* [#171] UI debug errors
|
||||||
[#156] Web UI 404 problem
|
* [#156] Web UI 404 problem
|
||||||
[#155] use local resource
|
* [#155] use local resource
|
||||||
[#145] nacos-example not found :org.apache.logging.log4j.core.Logger
|
* [#145] nacos-example not found :org.apache.logging.log4j.core.Logger
|
||||||
[#142] UI console show Group
|
* [#142] UI console show Group
|
||||||
[#149] Fix naming client beat process failed bug.
|
* [#149] Fix naming client beat process failed bug.
|
||||||
[#150] Fix naming service registration hangs bug.
|
* [#150] Fix naming service registration hangs bug.
|
||||||
|
|
||||||
## 0.3.0-RC1(Oct 19, 2018)
|
## 0.3.0-RC1(Oct 19, 2018)
|
||||||
|
|
||||||
[#33] Support console for config management.
|
* [#33] Support console for config management.
|
||||||
[#51] Support console for naming service.
|
* [#51] Support console for naming service.
|
||||||
[#121] Fix get instance method hanging bug.
|
* [#121] Fix get instance method hanging bug.
|
||||||
[#138] Add a flag to indicate if instance is offline.
|
* [#138] Add a flag to indicate if instance is offline.
|
||||||
[#130] Fix health check disabled if machine has one CPU core bug.
|
* [#130] Fix health check disabled if machine has one CPU core bug.
|
||||||
[#139] Fix still get instance with zero weight bug.
|
* [#139] Fix still get instance with zero weight bug.
|
||||||
[#128] Fix console layout bug.
|
* [#128] Fix console layout bug.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,21 +55,21 @@ public interface CmdbService {
|
|||||||
/**
|
/**
|
||||||
* Get label value of label name of ip
|
* Get label value of label name of ip
|
||||||
*
|
*
|
||||||
|
* @param entityName entity name
|
||||||
* @param entityType entity type
|
* @param entityType entity type
|
||||||
* @param entityValue entity value
|
|
||||||
* @param labelName target label name
|
* @param labelName target label name
|
||||||
* @return label value
|
* @return label value
|
||||||
*/
|
*/
|
||||||
String getLabelValue(String entityValue, String entityType, String labelName);
|
String getLabelValue(String entityName, String entityType, String labelName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all label value of ip
|
* Get all label value of ip
|
||||||
*
|
*
|
||||||
|
* @param entityName entity name
|
||||||
* @param entityType entity type
|
* @param entityType entity type
|
||||||
* @param entityValue entity value
|
|
||||||
* @return all label values
|
* @return all label values
|
||||||
*/
|
*/
|
||||||
Map<String, String> getLabelValues(String entityValue, String entityType);
|
Map<String, String> getLabelValues(String entityName, String entityType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dump all entities in CMDB
|
* Dump all entities in CMDB
|
||||||
|
@ -55,6 +55,8 @@ public class OperationController {
|
|||||||
case "loadDataAtStart":
|
case "loadDataAtStart":
|
||||||
switches.setLoadDataAtStart(Boolean.parseBoolean(value));
|
switches.setLoadDataAtStart(Boolean.parseBoolean(value));
|
||||||
break;
|
break;
|
||||||
|
case "labelTaskInterval":
|
||||||
|
switches.setLabelTaskInterval(Integer.parseInt(value));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,9 @@ public class SwitchAndOptions {
|
|||||||
@Value("${nacos.cmdb.eventTaskInterval}")
|
@Value("${nacos.cmdb.eventTaskInterval}")
|
||||||
private int eventTaskInterval;
|
private int eventTaskInterval;
|
||||||
|
|
||||||
|
@Value("${nacos.cmdb.labelTaskInterval}")
|
||||||
|
private int labelTaskInterval;
|
||||||
|
|
||||||
@Value("${nacos.cmdb.loadDataAtStart}")
|
@Value("${nacos.cmdb.loadDataAtStart}")
|
||||||
private boolean loadDataAtStart;
|
private boolean loadDataAtStart;
|
||||||
|
|
||||||
@ -49,6 +52,14 @@ public class SwitchAndOptions {
|
|||||||
this.eventTaskInterval = eventTaskInterval;
|
this.eventTaskInterval = eventTaskInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLabelTaskInterval() {
|
||||||
|
return labelTaskInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabelTaskInterval(int labelTaskInterval) {
|
||||||
|
this.labelTaskInterval = labelTaskInterval;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLoadDataAtStart() {
|
public boolean isLoadDataAtStart() {
|
||||||
return loadDataAtStart;
|
return loadDataAtStart;
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,6 @@ public class CmdbProvider implements CmdbReader, CmdbWriter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO load data on disk:
|
|
||||||
|
|
||||||
// init label map:
|
// init label map:
|
||||||
Set<String> labelNames = cmdbService.getLabelNames();
|
Set<String> labelNames = cmdbService.getLabelNames();
|
||||||
if (labelNames == null || labelNames.isEmpty()) {
|
if (labelNames == null || labelNames.isEmpty()) {
|
||||||
@ -103,6 +101,7 @@ public class CmdbProvider implements CmdbReader, CmdbWriter {
|
|||||||
load();
|
load();
|
||||||
|
|
||||||
UtilsAndCommons.GLOBAL_EXECUTOR.schedule(new CmdbDumpTask(), switches.getDumpTaskInterval(), TimeUnit.SECONDS);
|
UtilsAndCommons.GLOBAL_EXECUTOR.schedule(new CmdbDumpTask(), switches.getDumpTaskInterval(), TimeUnit.SECONDS);
|
||||||
|
UtilsAndCommons.GLOBAL_EXECUTOR.schedule(new CmdbLabelTask(), switches.getLabelTaskInterval(), TimeUnit.SECONDS);
|
||||||
UtilsAndCommons.GLOBAL_EXECUTOR.schedule(new CmdbEventTask(), switches.getEventTaskInterval(), TimeUnit.SECONDS);
|
UtilsAndCommons.GLOBAL_EXECUTOR.schedule(new CmdbEventTask(), switches.getEventTaskInterval(), TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +141,38 @@ public class CmdbProvider implements CmdbReader, CmdbWriter {
|
|||||||
entityMap.get(entity.getType()).put(entity.getName(), entity);
|
entityMap.get(entity.getType()).put(entity.getName(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CmdbLabelTask implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
if (cmdbService == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Map<String, Label> tmpLabelMap = new HashMap<>();
|
||||||
|
|
||||||
|
Set<String> labelNames = cmdbService.getLabelNames();
|
||||||
|
if (labelNames == null || labelNames.isEmpty()) {
|
||||||
|
Loggers.MAIN.warn("CMDB-LABEL-TASK {}", "load label names failed!");
|
||||||
|
} else {
|
||||||
|
for (String labelName : labelNames) {
|
||||||
|
// If get null label, it's still ok. We will try it later when we meet this label:
|
||||||
|
tmpLabelMap.put(labelName, cmdbService.getLabel(labelName));
|
||||||
|
}
|
||||||
|
labelMap = tmpLabelMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Loggers.MAIN.error("CMDB-LABEL-TASK {}", "dump failed!", e);
|
||||||
|
} finally {
|
||||||
|
UtilsAndCommons.GLOBAL_EXECUTOR.schedule(this, switches.getLabelTaskInterval(), TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class CmdbDumpTask implements Runnable {
|
public class CmdbDumpTask implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,6 +32,7 @@ OPEN_SPAS=true
|
|||||||
|
|
||||||
nacos.cmdb.dumpTaskInterval=3600
|
nacos.cmdb.dumpTaskInterval=3600
|
||||||
nacos.cmdb.eventTaskInterval=10
|
nacos.cmdb.eventTaskInterval=10
|
||||||
|
nacos.cmdb.labelTaskInterval=300
|
||||||
nacos.cmdb.loadDataAtStart=false
|
nacos.cmdb.loadDataAtStart=false
|
||||||
|
|
||||||
db.num=2
|
db.num=2
|
||||||
|
@ -6,6 +6,7 @@ server.port=8848
|
|||||||
|
|
||||||
nacos.cmdb.dumpTaskInterval=3600
|
nacos.cmdb.dumpTaskInterval=3600
|
||||||
nacos.cmdb.eventTaskInterval=10
|
nacos.cmdb.eventTaskInterval=10
|
||||||
|
nacos.cmdb.labelTaskInterval=300
|
||||||
nacos.cmdb.loadDataAtStart=false
|
nacos.cmdb.loadDataAtStart=false
|
||||||
|
|
||||||
#db.num=2
|
#db.num=2
|
||||||
|
Loading…
Reference in New Issue
Block a user