@InterfaceAudience.Private public class DataNode extends Configured implements InterDatanodeProtocol, ClientDatanodeProtocol, DataNodeMXBean
| Modifier and Type | Class and Description |
|---|---|
static class |
DataNode.ShortCircuitFdsUnsupportedException |
static class |
DataNode.ShortCircuitFdsVersionException |
| Modifier and Type | Field and Description |
|---|---|
static String |
DN_CLIENTTRACE_FORMAT |
static String |
EMPTY_DEL_HINT |
RPC.Server |
ipcServer |
static org.apache.commons.logging.Log |
LOG |
versionIDversionID| Modifier and Type | Method and Description |
|---|---|
void |
checkDiskError()
Check if there is a disk failure and if so, handle the error
|
protected void |
checkDiskError(Exception e)
Check if there is no space in disk
|
void |
clearAllBlockSecretKeys() |
static DataNode |
createDataNode(String[] args,
Configuration conf)
Instantiate & Start a single datanode daemon and wait for it to finish.
|
static DataNode |
createDataNode(String[] args,
Configuration conf,
SecureDataNodeStarter.SecureResources resources)
Instantiate & Start a single datanode daemon and wait for it to finish.
|
static InterDatanodeProtocol |
createInterDataNodeProtocolProxy(DatanodeID datanodeid,
Configuration conf,
int socketTimeout,
boolean connectToDnViaHostname) |
static InetSocketAddress |
createSocketAddr(String target)
Deprecated.
|
void |
deleteBlockPool(String blockPoolId,
boolean force)
Delete the block pool directory.
|
DatanodeProtocolClientSideTranslatorPB |
getActiveNamenodeForBP(String bpid)
Get the NameNode corresponding to the given block pool.
|
Long |
getBalancerBandwidth()
Get current value of the max balancer bandwidth in bytes per second.
|
BlockLocalPathInfo |
getBlockLocalPathInfo(ExtendedBlock block,
Token<BlockTokenIdentifier> token)
Retrieves the path names of the block file and metadata file stored on the
local file system.
|
DataBlockScanner |
getBlockScanner() |
String |
getClusterId()
Gets the cluster id.
|
DatanodeID |
getDatanodeId() |
String |
getDisplayName() |
DNConf |
getDnConf() |
DatanodeRegistration |
getDNRegistrationForBP(String bpid)
get BP registration by blockPool id
|
HdfsBlocksMetadata |
getHdfsBlocksMetadata(List<ExtendedBlock> blocks,
List<Token<BlockTokenIdentifier>> tokens)
Retrieves volume location information about a list of blocks on a datanode.
|
String |
getHttpPort()
Gets the http port.
|
static InetSocketAddress |
getInfoAddr(Configuration conf)
Determine the http server's effective addr
|
int |
getInfoPort() |
int |
getInfoSecurePort() |
int |
getIpcPort() |
String |
getNamenodeAddresses()
Returned information is a JSON representation of a map with
name node host name as the key and block pool Id as the value.
|
long |
getReplicaVisibleLength(ExtendedBlock block)
Return the visible length of a replica.
|
String |
getRpcPort()
Gets the rpc port.
|
String |
getVersion()
Gets the version of Hadoop.
|
String |
getVolumeInfo()
Returned information is a JSON representation of a map with
volume name as the key and value is a map of volume attribute
keys to its values
|
int |
getXceiverCount()
Number of concurrent xceivers per node.
|
InetSocketAddress |
getXferAddress()
NB: The datanode can perform data transfer on the streaming
address however clients are given the IPC IP address for data
transfer, and that may be a different address.
|
int |
getXferPort() |
ReplicaRecoveryInfo |
initReplicaRecovery(BlockRecoveryCommand.RecoveringBlock rBlock)
Initialize a replica recovery.
|
static DataNode |
instantiateDataNode(String[] args,
Configuration conf)
Instantiate a single datanode object.
|
static DataNode |
instantiateDataNode(String[] args,
Configuration conf,
SecureDataNodeStarter.SecureResources resources)
Instantiate a single datanode object, along with its secure resources.
|
boolean |
isBPServiceAlive(String bpid) |
boolean |
isConnectedToNN(InetSocketAddress addr) |
boolean |
isDatanodeFullyStarted()
A datanode is considered to be fully started if all the BP threads are
alive and all the block pools are initialized.
|
boolean |
isDatanodeUp()
A data node is considered to be up if one of the bp services is up
|
static void |
main(String[] args) |
protected Socket |
newSocket()
Creates either NIO or regular depending on socketWriteTimeout.
|
void |
notifyNamenodeDeletedBlock(ExtendedBlock block)
Notify the corresponding namenode to delete the block.
|
protected void |
notifyNamenodeReceivedBlock(ExtendedBlock block,
String delHint) |
protected void |
notifyNamenodeReceivingBlock(ExtendedBlock block) |
Daemon |
recoverBlocks(String who,
Collection<BlockRecoveryCommand.RecoveringBlock> blocks) |
void |
refreshNamenodes()
Refresh the list of federated namenodes from updated configuration
Adds new namenodes and stops the deleted namenodes.
|
void |
refreshNamenodes(Configuration conf) |
void |
reportBadBlocks(ExtendedBlock block)
Report a bad block which is hosted on the local DN.
|
void |
reportRemoteBadBlock(DatanodeInfo srcDataNode,
ExtendedBlock block)
Report a bad block on another DN (eg if we received a corrupt replica
from a remote host).
|
void |
runDatanodeDaemon()
Start a single datanode daemon and wait for it to finish.
|
void |
scheduleAllBlockReport(long delay)
This methods arranges for the data node to send
the block report at the next heartbeat.
|
static void |
secureMain(String[] args,
SecureDataNodeStarter.SecureResources resources) |
static void |
setNewStorageID(DatanodeID dnId) |
void |
shutdown()
Shut down this instance of the datanode.
|
String |
toString() |
String |
updateReplicaUnderRecovery(ExtendedBlock oldBlock,
long recoveryId,
long newLength)
Update replica with the new generation stamp and length.
|
getConf, setConfpublic static final org.apache.commons.logging.Log LOG
public static final String DN_CLIENTTRACE_FORMAT
public static final String EMPTY_DEL_HINT
public RPC.Server ipcServer
@Deprecated public static InetSocketAddress createSocketAddr(String target)
NetUtils.createSocketAddr(String) instead.protected void notifyNamenodeReceivedBlock(ExtendedBlock block, String delHint)
protected void notifyNamenodeReceivingBlock(ExtendedBlock block)
public void notifyNamenodeDeletedBlock(ExtendedBlock block)
public void reportBadBlocks(ExtendedBlock block) throws IOException
IOExceptionpublic void reportRemoteBadBlock(DatanodeInfo srcDataNode, ExtendedBlock block) throws IOException
srcDataNode - the DN hosting the bad blockblock - the block itselfIOExceptionpublic static InetSocketAddress getInfoAddr(Configuration conf)
public int getXferPort()
public String getDisplayName()
public InetSocketAddress getXferAddress()
public int getIpcPort()
public DatanodeRegistration getDNRegistrationForBP(String bpid) throws IOException
bpid - IOExceptionprotected Socket newSocket() throws IOException
IOExceptionpublic static InterDatanodeProtocol createInterDataNodeProtocolProxy(DatanodeID datanodeid, Configuration conf, int socketTimeout, boolean connectToDnViaHostname) throws IOException
IOExceptionpublic static void setNewStorageID(DatanodeID dnId)
public BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock block, Token<BlockTokenIdentifier> token) throws IOException
ClientDatanodeProtocolgetBlockLocalPathInfo in interface ClientDatanodeProtocolblock - the specified block on the local datanodetoken - the block access token.IOException - on errorpublic HdfsBlocksMetadata getHdfsBlocksMetadata(List<ExtendedBlock> blocks, List<Token<BlockTokenIdentifier>> tokens) throws IOException, UnsupportedOperationException
ClientDatanodeProtocolVolumeId for each configured
data directory, which is not guaranteed to be the same across DN restarts.getHdfsBlocksMetadata in interface ClientDatanodeProtocolblocks - list of blocks on the local datanodetokens - block access tokens corresponding to the requested blocksExtendedBlocks with
data directoriesIOException - if datanode is unreachable, or replica is not found on datanodeUnsupportedOperationExceptionpublic void shutdown()
protected void checkDiskError(Exception e) throws IOException
e - that caused this checkDiskError callIOExceptionpublic void checkDiskError()
public int getXceiverCount()
getXceiverCount in interface DataNodeMXBeanpublic void runDatanodeDaemon()
throws IOException
IOExceptionpublic boolean isDatanodeUp()
public static DataNode instantiateDataNode(String[] args, Configuration conf) throws IOException
runDatanodeDaemon() subsequently.IOExceptionpublic static DataNode instantiateDataNode(String[] args, Configuration conf, SecureDataNodeStarter.SecureResources resources) throws IOException
runDatanodeDaemon()
subsequently.IOExceptionpublic static DataNode createDataNode(String[] args, Configuration conf) throws IOException
IOException@InterfaceAudience.Private public static DataNode createDataNode(String[] args, Configuration conf, SecureDataNodeStarter.SecureResources resources) throws IOException
IOExceptionpublic void scheduleAllBlockReport(long delay)
public DataBlockScanner getBlockScanner()
public static void secureMain(String[] args, SecureDataNodeStarter.SecureResources resources)
public static void main(String[] args)
public Daemon recoverBlocks(String who, Collection<BlockRecoveryCommand.RecoveringBlock> blocks)
public ReplicaRecoveryInfo initReplicaRecovery(BlockRecoveryCommand.RecoveringBlock rBlock) throws IOException
InterDatanodeProtocolinitReplicaRecovery in interface InterDatanodeProtocolIOExceptionpublic String updateReplicaUnderRecovery(ExtendedBlock oldBlock, long recoveryId, long newLength) throws IOException
updateReplicaUnderRecovery in interface InterDatanodeProtocolIOExceptionpublic DatanodeProtocolClientSideTranslatorPB getActiveNamenodeForBP(String bpid) throws IOException
bpid - Block pool IdIOException - if unable to get the corresponding NameNodepublic long getReplicaVisibleLength(ExtendedBlock block) throws IOException
ClientDatanodeProtocolgetReplicaVisibleLength in interface ClientDatanodeProtocolIOExceptionpublic String getVersion()
DataNodeMXBeangetVersion in interface DataNodeMXBeanpublic String getRpcPort()
DataNodeMXBeangetRpcPort in interface DataNodeMXBeanpublic String getHttpPort()
DataNodeMXBeangetHttpPort in interface DataNodeMXBeanpublic int getInfoPort()
public int getInfoSecurePort()
public String getNamenodeAddresses()
getNamenodeAddresses in interface DataNodeMXBeanpublic String getVolumeInfo()
getVolumeInfo in interface DataNodeMXBeanpublic String getClusterId()
DataNodeMXBeangetClusterId in interface DataNodeMXBeanpublic void refreshNamenodes(Configuration conf) throws IOException
IOExceptionpublic void refreshNamenodes()
throws IOException
ClientDatanodeProtocolrefreshNamenodes in interface ClientDatanodeProtocolIOException - on errorpublic void deleteBlockPool(String blockPoolId, boolean force) throws IOException
ClientDatanodeProtocoldeleteBlockPool in interface ClientDatanodeProtocolblockPoolId - Blockpool id to be deleted.force - If false blockpool directory is deleted only if it is empty
i.e. if it doesn't contain any block files, otherwise it is
deleted along with its contents.IOExceptionpublic boolean isConnectedToNN(InetSocketAddress addr)
addr - rpc address of the namenodepublic boolean isBPServiceAlive(String bpid)
bpid - block pool Idpublic boolean isDatanodeFullyStarted()
public DatanodeID getDatanodeId()
public void clearAllBlockSecretKeys()
public Long getBalancerBandwidth()
public DNConf getDnConf()
Copyright © 2013 Apache Software Foundation. All rights reserved.