类 NodeManager
- java.lang.Object
-
- org.apache.iotdb.confignode.manager.node.NodeManager
-
public class NodeManager extends java.lang.ObjectNodeManager manages cluster node addition and removal requests
-
-
字段概要
字段 修饰符和类型 字段 说明 static longHEARTBEAT_INTERVAL
-
构造器概要
构造器 构造器 说明 NodeManager(IManager configManager, NodeInfo nodeInfo)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidapplyConfigNode(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation configNodeLocation)Only leader use this interface, record the new ConfigNode's informationorg.apache.iotdb.common.rpc.thrift.TSStatuscheckConfigNodeBeforeRemove(RemoveConfigNodePlan removeConfigNodePlan)Only leader use this interface, check the ConfigNode before remove itjava.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus>clearCache()java.util.List<org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation>filterConfigNodeThroughStatus(org.apache.iotdb.commons.cluster.NodeStatus... status)Filter the registered ConfigNodes through the specific NodeStatusjava.util.List<org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration>filterDataNodeThroughStatus(org.apache.iotdb.commons.cluster.NodeStatus... status)Filter the registered DataNodes through the specific NodeStatusjava.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus>flush(org.apache.iotdb.common.rpc.thrift.TFlushReq req)java.util.Map<java.lang.Integer,java.lang.Long>getAllLoadScores()Get the loadScore of each DataNodeDataNodeConfigurationRespgetDataNodeConfiguration(GetDataNodeConfigurationPlan req)Get TDataNodeConfigurationlonggetFreeDiskSpace(int dataNodeId)Get the free disk space of the specified DataNodejava.util.Optional<org.apache.iotdb.common.rpc.thrift.TDataNodeLocation>getLowestLoadDataNode()Get the DataNodeLocation of the DataNode which has the lowest loadScoreorg.apache.iotdb.common.rpc.thrift.TDataNodeLocationgetLowestLoadDataNode(java.util.Set<java.lang.Integer> nodes)Get the DataNodeLocation which has the lowest loadScore within inputjava.util.Map<java.lang.Integer,BaseNodeCache>getNodeCacheMap()org.apache.iotdb.commons.cluster.NodeStatusgetNodeStatusByNodeId(int nodeId)Get NodeStatus by nodeIdjava.util.List<org.apache.iotdb.confignode.rpc.thrift.TConfigNodeInfo>getRegisteredConfigNodeInfoList()java.util.List<org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation>getRegisteredConfigNodes()org.apache.iotdb.common.rpc.thrift.TDataNodeConfigurationgetRegisteredDataNode(int dataNodeId)Only leader use this interfaceintgetRegisteredDataNodeCount()Only leader use this interfacejava.util.List<org.apache.iotdb.confignode.rpc.thrift.TDataNodeInfo>getRegisteredDataNodeInfoList()java.util.Map<java.lang.Integer,org.apache.iotdb.common.rpc.thrift.TDataNodeLocation>getRegisteredDataNodeLocations()java.util.List<org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration>getRegisteredDataNodes()Only leader use this interfaceorg.apache.iotdb.consensus.common.DataSetgetSystemConfiguration()Get system configurationsintgetTotalCpuCoreCount()Only leader use this interfacevoidinitNodeHeartbeatCache()Initialize the nodeCacheMap when the ConfigNode-Leader is switchedjava.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus>loadConfiguration()java.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus>merge()org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterRespregisterConfigNode(org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterReq req)org.apache.iotdb.consensus.common.DataSetregisterDataNode(RegisterDataNodePlan registerDataNodePlan)Register DataNodeorg.apache.iotdb.consensus.common.DataSetremoveDataNode(RemoveDataNodePlan removeDataNodePlan)Remove DataNodesvoidremoveNodeCache(int nodeId)org.apache.iotdb.common.rpc.thrift.TSStatusrestartConfigNode(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation configNodeLocation)org.apache.iotdb.confignode.rpc.thrift.TDataNodeRestartResprestartDataNode(org.apache.iotdb.common.rpc.thrift.TDataNodeLocation dataNodeLocation)org.apache.iotdb.common.rpc.thrift.TSStatussetDataNodeStatus(org.apache.iotdb.confignode.rpc.thrift.TSetDataNodeStatusReq setDataNodeStatusReq)java.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus>setSystemStatus(java.lang.String status)voidstartHeartbeatService()Start the heartbeat servicevoidstartUnknownDataNodeDetector()Start unknownDataNodeDetectorvoidstopHeartbeatService()Stop the heartbeat servicevoidstopUnknownDataNodeDetector()Stop the heartbeat serviceorg.apache.iotdb.consensus.common.DataSetupdateDataNode(UpdateDataNodePlan updateDataNodePlan)Update the specified DataNode‘s location
-
-
-
方法详细资料
-
getSystemConfiguration
public org.apache.iotdb.consensus.common.DataSet getSystemConfiguration()
Get system configurations- 返回:
- ConfigurationResp. The TSStatus will be set to SUCCESS_STATUS.
-
registerDataNode
public org.apache.iotdb.consensus.common.DataSet registerDataNode(RegisterDataNodePlan registerDataNodePlan)
Register DataNode- 参数:
registerDataNodePlan- RegisterDataNodeReq- 返回:
- DataNodeConfigurationDataSet. The TSStatus will be set to SUCCESS_STATUS when register success, and DATANODE_ALREADY_REGISTERED when the DataNode is already exist.
-
restartDataNode
public org.apache.iotdb.confignode.rpc.thrift.TDataNodeRestartResp restartDataNode(org.apache.iotdb.common.rpc.thrift.TDataNodeLocation dataNodeLocation)
-
removeDataNode
public org.apache.iotdb.consensus.common.DataSet removeDataNode(RemoveDataNodePlan removeDataNodePlan)
Remove DataNodes- 参数:
removeDataNodePlan- removeDataNodePlan- 返回:
- DataNodeToStatusResp, The TSStatus will be SUCCEED_STATUS if the request is accepted, DATANODE_NOT_EXIST when some datanode does not exist.
-
updateDataNode
public org.apache.iotdb.consensus.common.DataSet updateDataNode(UpdateDataNodePlan updateDataNodePlan)
Update the specified DataNode‘s location- 参数:
updateDataNodePlan- UpdateDataNodePlan- 返回:
- TSStatus. The TSStatus will be set to SUCCESS_STATUS when update success, and DATANODE_NOT_EXIST when some datanode is not exist, UPDATE_DATANODE_FAILED when update failed.
-
registerConfigNode
public org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterResp registerConfigNode(org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterReq req)
-
restartConfigNode
public org.apache.iotdb.common.rpc.thrift.TSStatus restartConfigNode(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation configNodeLocation)
-
getDataNodeConfiguration
public DataNodeConfigurationResp getDataNodeConfiguration(GetDataNodeConfigurationPlan req)
Get TDataNodeConfiguration- 参数:
req- GetDataNodeConfigurationPlan- 返回:
- The specific DataNode's configuration or all DataNodes' configuration if dataNodeId in GetDataNodeConfigurationPlan is -1
-
getRegisteredDataNodeCount
public int getRegisteredDataNodeCount()
Only leader use this interface- 返回:
- The number of registered DataNodes
-
getTotalCpuCoreCount
public int getTotalCpuCoreCount()
Only leader use this interface- 返回:
- The number of total cpu cores in online DataNodes
-
getRegisteredDataNodes
public java.util.List<org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration> getRegisteredDataNodes()
Only leader use this interface- 返回:
- All registered DataNodes
-
getRegisteredDataNode
public org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration getRegisteredDataNode(int dataNodeId)
Only leader use this interfaceNotice: The result will be an empty TDataNodeConfiguration if the specified DataNode doesn't register
- 参数:
dataNodeId- The specified DataNode's index- 返回:
- The specified registered DataNode
-
getRegisteredDataNodeLocations
public java.util.Map<java.lang.Integer,org.apache.iotdb.common.rpc.thrift.TDataNodeLocation> getRegisteredDataNodeLocations()
-
getRegisteredDataNodeInfoList
public java.util.List<org.apache.iotdb.confignode.rpc.thrift.TDataNodeInfo> getRegisteredDataNodeInfoList()
-
getRegisteredConfigNodes
public java.util.List<org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation> getRegisteredConfigNodes()
-
getRegisteredConfigNodeInfoList
public java.util.List<org.apache.iotdb.confignode.rpc.thrift.TConfigNodeInfo> getRegisteredConfigNodeInfoList()
-
applyConfigNode
public void applyConfigNode(org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation configNodeLocation)
Only leader use this interface, record the new ConfigNode's information- 参数:
configNodeLocation- The new ConfigNode
-
checkConfigNodeBeforeRemove
public org.apache.iotdb.common.rpc.thrift.TSStatus checkConfigNodeBeforeRemove(RemoveConfigNodePlan removeConfigNodePlan)
Only leader use this interface, check the ConfigNode before remove it- 参数:
removeConfigNodePlan- RemoveConfigNodePlan
-
merge
public java.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus> merge()
-
flush
public java.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus> flush(org.apache.iotdb.common.rpc.thrift.TFlushReq req)
-
clearCache
public java.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus> clearCache()
-
loadConfiguration
public java.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus> loadConfiguration()
-
setSystemStatus
public java.util.List<org.apache.iotdb.common.rpc.thrift.TSStatus> setSystemStatus(java.lang.String status)
-
setDataNodeStatus
public org.apache.iotdb.common.rpc.thrift.TSStatus setDataNodeStatus(org.apache.iotdb.confignode.rpc.thrift.TSetDataNodeStatusReq setDataNodeStatusReq)
-
startHeartbeatService
public void startHeartbeatService()
Start the heartbeat service
-
stopHeartbeatService
public void stopHeartbeatService()
Stop the heartbeat service
-
getNodeCacheMap
public java.util.Map<java.lang.Integer,BaseNodeCache> getNodeCacheMap()
-
startUnknownDataNodeDetector
public void startUnknownDataNodeDetector()
Start unknownDataNodeDetector
-
stopUnknownDataNodeDetector
public void stopUnknownDataNodeDetector()
Stop the heartbeat service
-
removeNodeCache
public void removeNodeCache(int nodeId)
-
filterConfigNodeThroughStatus
public java.util.List<org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation> filterConfigNodeThroughStatus(org.apache.iotdb.commons.cluster.NodeStatus... status)
Filter the registered ConfigNodes through the specific NodeStatus- 参数:
status- The specific NodeStatus- 返回:
- Filtered ConfigNodes with the specific NodeStatus
-
getNodeStatusByNodeId
public org.apache.iotdb.commons.cluster.NodeStatus getNodeStatusByNodeId(int nodeId)
Get NodeStatus by nodeId- 参数:
nodeId- The specific NodeId- 返回:
- NodeStatus of the specific node. If node does not exist, return null.
-
filterDataNodeThroughStatus
public java.util.List<org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration> filterDataNodeThroughStatus(org.apache.iotdb.commons.cluster.NodeStatus... status)
Filter the registered DataNodes through the specific NodeStatus- 参数:
status- The specific NodeStatus- 返回:
- Filtered DataNodes with the specific NodeStatus
-
getAllLoadScores
public java.util.Map<java.lang.Integer,java.lang.Long> getAllLoadScores()
Get the loadScore of each DataNode- 返回:
- Map
-
getFreeDiskSpace
public long getFreeDiskSpace(int dataNodeId)
Get the free disk space of the specified DataNode- 参数:
dataNodeId- The index of the specified DataNode- 返回:
- The free disk space that sample through heartbeat, 0 if no heartbeat received
-
getLowestLoadDataNode
public java.util.Optional<org.apache.iotdb.common.rpc.thrift.TDataNodeLocation> getLowestLoadDataNode()
Get the DataNodeLocation of the DataNode which has the lowest loadScore- 返回:
- TDataNodeLocation with the lowest loadScore
-
getLowestLoadDataNode
public org.apache.iotdb.common.rpc.thrift.TDataNodeLocation getLowestLoadDataNode(java.util.Set<java.lang.Integer> nodes)
Get the DataNodeLocation which has the lowest loadScore within input- 返回:
- TDataNodeLocation with the lowest loadScore
-
initNodeHeartbeatCache
public void initNodeHeartbeatCache()
Initialize the nodeCacheMap when the ConfigNode-Leader is switched
-
-