Package org.apache.hadoop.hdfs.protocol
Class DatanodeID
java.lang.Object
org.apache.hadoop.hdfs.protocol.DatanodeID
- All Implemented Interfaces:
Comparable<DatanodeID>
- Direct Known Subclasses:
DatanodeInfo
This class represents the primary identifier for a Datanode.
Datanodes are identified by how they can be contacted (hostname
and ports) and their storage ID, a unique number that associates
the Datanodes blocks with a particular Datanode.
DatanodeInfo.getName() should be used to get the network
location (for topology) of a datanode, instead of using
getXferAddr() here. Helpers are defined below
for each context in which a DatanodeID is used.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDatanodeID(String ipAddr, String hostName, String datanodeUuid, int xferPort, int infoPort, int infoSecurePort, int ipcPort) Create a DatanodeIDDatanodeID(String datanodeUuid, DatanodeID from) DatanodeID(DatanodeID from) -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(DatanodeID that) Compare based on data transfer address.booleanorg.apache.hadoop.thirdparty.protobuf.ByteStringorg.apache.hadoop.thirdparty.protobuf.ByteStringintintorg.apache.hadoop.thirdparty.protobuf.ByteStringgetIpcAddr(boolean useHostname) intgetXferAddr(boolean useHostname) intinthashCode()voidvoidsetPeerHostName(String peerHostName) toString()voidupdateRegInfo(DatanodeID nodeReg) Update fields when a new registration request comes in.
-
Field Details
-
EMPTY_ARRAY
-
EMPTY_DATANODE_ID
-
-
Constructor Details
-
DatanodeID
-
DatanodeID
-
DatanodeID
public DatanodeID(String ipAddr, String hostName, String datanodeUuid, int xferPort, int infoPort, int infoSecurePort, int ipcPort) Create a DatanodeID- Parameters:
ipAddr- IPhostName- hostnamedatanodeUuid- data node ID, UUID for new Datanodes, may be the storage ID for pre-UUID datanodes. NULL if unknown e.g. if this is a new datanode. A new UUID will be assigned by the namenode.xferPort- data transfer portinfoPort- info server portipcPort- ipc server port
-
-
Method Details
-
setIpAddr
-
setPeerHostName
-
getDatanodeUuid
- Returns:
- data node ID.
-
getDatanodeUuidBytes
public org.apache.hadoop.thirdparty.protobuf.ByteString getDatanodeUuidBytes() -
getIpAddr
- Returns:
- ipAddr;
-
getIpAddrBytes
public org.apache.hadoop.thirdparty.protobuf.ByteString getIpAddrBytes() -
getHostName
- Returns:
- hostname
-
getHostNameBytes
public org.apache.hadoop.thirdparty.protobuf.ByteString getHostNameBytes() -
getPeerHostName
- Returns:
- hostname from the actual connection
-
getXferAddr
- Returns:
- IP:xferPort string
-
getInfoAddr
- Returns:
- IP:infoPort string
-
getInfoSecureAddr
- Returns:
- IP:infoPort string
-
getXferAddrWithHostname
- Returns:
- hostname:xferPort
-
getXferAddr
- Parameters:
useHostname- true to use the DN hostname, use the IP otherwise- Returns:
- name:xferPort
-
getIpcAddr
- Parameters:
useHostname- true to use the DN hostname, use the IP otherwise- Returns:
- name:ipcPort
-
getXferPort
public int getXferPort()- Returns:
- xferPort (the port for data streaming)
-
getInfoPort
public int getInfoPort()- Returns:
- infoPort (the port at which the HTTP server bound to)
-
getInfoSecurePort
public int getInfoSecurePort()- Returns:
- infoSecurePort (the port at which the HTTPS server bound to)
-
getIpcPort
public int getIpcPort()- Returns:
- ipcPort (the port at which the IPC server bound to)
-
equals
-
hashCode
public int hashCode() -
toString
-
updateRegInfo
Update fields when a new registration request comes in. Note that this does not update storageID. -
compareTo
Compare based on data transfer address.- Specified by:
compareToin interfaceComparable<DatanodeID>- Parameters:
that- datanode to compare with- Returns:
- as specified by Comparable
-
getResolvedAddress
-