@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 |
versionID
versionID
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, setConf
public 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
IOException
public void reportRemoteBadBlock(DatanodeInfo srcDataNode, ExtendedBlock block) throws IOException
srcDataNode
- the DN hosting the bad blockblock
- the block itselfIOException
public 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
- IOException
protected Socket newSocket() throws IOException
IOException
public static InterDatanodeProtocol createInterDataNodeProtocolProxy(DatanodeID datanodeid, Configuration conf, int socketTimeout, boolean connectToDnViaHostname) throws IOException
IOException
public static void setNewStorageID(DatanodeID dnId)
public BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock block, Token<BlockTokenIdentifier> token) throws IOException
ClientDatanodeProtocol
getBlockLocalPathInfo
in interface ClientDatanodeProtocol
block
- 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
ClientDatanodeProtocol
VolumeId
for each configured
data directory, which is not guaranteed to be the same across DN restarts.getHdfsBlocksMetadata
in interface ClientDatanodeProtocol
blocks
- list of blocks on the local datanodetokens
- block access tokens corresponding to the requested blocksExtendedBlock
s with
data directoriesIOException
- if datanode is unreachable, or replica is not found on datanodeUnsupportedOperationException
public void shutdown()
protected void checkDiskError(Exception e) throws IOException
e
- that caused this checkDiskError callIOException
public void checkDiskError()
public int getXceiverCount()
getXceiverCount
in interface DataNodeMXBean
public void runDatanodeDaemon() throws IOException
IOException
public boolean isDatanodeUp()
public static DataNode instantiateDataNode(String[] args, Configuration conf) throws IOException
runDatanodeDaemon()
subsequently.IOException
public static DataNode instantiateDataNode(String[] args, Configuration conf, SecureDataNodeStarter.SecureResources resources) throws IOException
runDatanodeDaemon()
subsequently.IOException
public 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
IOException
public 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
InterDatanodeProtocol
initReplicaRecovery
in interface InterDatanodeProtocol
IOException
public String updateReplicaUnderRecovery(ExtendedBlock oldBlock, long recoveryId, long newLength) throws IOException
updateReplicaUnderRecovery
in interface InterDatanodeProtocol
IOException
public DatanodeProtocolClientSideTranslatorPB getActiveNamenodeForBP(String bpid) throws IOException
bpid
- Block pool IdIOException
- if unable to get the corresponding NameNodepublic long getReplicaVisibleLength(ExtendedBlock block) throws IOException
ClientDatanodeProtocol
getReplicaVisibleLength
in interface ClientDatanodeProtocol
IOException
public String getVersion()
DataNodeMXBean
getVersion
in interface DataNodeMXBean
public String getRpcPort()
DataNodeMXBean
getRpcPort
in interface DataNodeMXBean
public String getHttpPort()
DataNodeMXBean
getHttpPort
in interface DataNodeMXBean
public int getInfoPort()
public int getInfoSecurePort()
public String getNamenodeAddresses()
getNamenodeAddresses
in interface DataNodeMXBean
public String getVolumeInfo()
getVolumeInfo
in interface DataNodeMXBean
public String getClusterId()
DataNodeMXBean
getClusterId
in interface DataNodeMXBean
public void refreshNamenodes(Configuration conf) throws IOException
IOException
public void refreshNamenodes() throws IOException
ClientDatanodeProtocol
refreshNamenodes
in interface ClientDatanodeProtocol
IOException
- on errorpublic void deleteBlockPool(String blockPoolId, boolean force) throws IOException
ClientDatanodeProtocol
deleteBlockPool
in interface ClientDatanodeProtocol
blockPoolId
- 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.IOException
public 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.