public class DataNode extends Configured implements InterDatanodeProtocol, ClientDatanodeProtocol, FSConstants, Runnable, DataNodeMXBean
FSConstants.DatanodeReportType, FSConstants.SafeModeAction, FSConstants.UpgradeAction| 限定符和类型 | 字段和说明 |
|---|---|
org.apache.hadoop.hdfs.server.datanode.DataBlockScanner |
blockScanner |
Daemon |
blockScannerThread |
FSDatasetInterface |
data |
static String |
DATA_DIR_KEY |
static String |
DATA_DIR_PERMISSION_KEY |
static String |
DN_CLIENTTRACE_FORMAT |
DatanodeRegistration |
dnRegistration |
static String |
EMPTY_DEL_HINT |
Server |
ipcServer |
static org.apache.commons.logging.Log |
LOG |
DatanodeProtocol |
namenode |
static int |
PKT_HEADER_LEN
Header size for a packet
|
versionIDversionIDBLOCKREPORT_INITIAL_DELAY, BLOCKREPORT_INTERVAL, BUFFER_SIZE, DEFAULT_BLOCK_SIZE, DEFAULT_DATA_SOCKET_SIZE, HEARTBEAT_INTERVAL, LAYOUT_VERSION, LEASE_HARDLIMIT_PERIOD, LEASE_RECOVER_PERIOD, LEASE_SOFTLIMIT_PERIOD, MAX_PATH_DEPTH, MAX_PATH_LENGTH, MIN_BLOCKS_FOR_WRITE, QUOTA_DONT_SET, QUOTA_RESET, SIZE_OF_INTEGER, SMALL_BUFFER_SIZE| 限定符和类型 | 方法和说明 |
|---|---|
protected 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
|
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(DatanodeInfo info,
Configuration conf,
int socketTimeout,
boolean connectToDnViaHostname) |
static InetSocketAddress |
createSocketAddr(String target)
已过时。
|
Long |
getBalancerBandwidth()
Get current value of the max balancer bandwidth in bytes per second.
|
Block |
getBlockInfo(Block block)
Returns a block object that contains the specified block object
from the specified Datanode.
|
BlockLocalPathInfo |
getBlockLocalPathInfo(Block block,
Token<BlockTokenIdentifier> token)
Retrieves the path names of the block file and metadata file stored on the
local file system.
|
BlockMetaDataInfo |
getBlockMetaDataInfo(Block block) |
static DataNode |
getDataNode()
Return the DataNode object
|
FSDatasetInterface |
getFSDataset()
This method is used for testing.
|
String |
getHostName() |
String |
getHttpPort()
Gets the http port.
|
static InetSocketAddress |
getInfoAddr(Configuration conf)
Determine the http server's effective addr
|
String |
getNamenode()
Return the namenode's identifier
|
InetSocketAddress |
getNameNodeAddr() |
String |
getNamenodeAddress()
Gets the namenode IP address.
|
long |
getProtocolVersion(String protocol,
long clientVersion)
Return protocol version corresponding to protocol interface.
|
String |
getRpcPort()
Gets the rpc port.
|
InetSocketAddress |
getSelfAddr() |
static InetSocketAddress |
getStreamingAddr(Configuration conf) |
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.
|
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.
|
static void |
main(String[] args) |
static DataNode |
makeInstance(String[] dataDirs,
Configuration conf,
SecureDataNodeStarter.SecureResources resources)
Make an instance of DataNode after ensuring that at least one of the
given data directories (and their parent directories, if necessary)
can be created.
|
protected Socket |
newSocket()
Creates either NIO or regular depending on socketWriteTimeout.
|
protected void |
notifyNamenodeReceivedBlock(Block block,
String delHint) |
void |
offerService()
Main loop for the DataNode.
|
LocatedBlock |
recoverBlock(Block block,
boolean keepLength,
DatanodeInfo[] targets)
Start generation-stamp recovery for specified block
|
Daemon |
recoverBlocks(Block[] blocks,
DatanodeInfo[][] targets) |
void |
run()
No matter what kind of exception we get, keep retrying to offerService().
|
static void |
runDatanodeDaemon(DataNode dn)
Start a single datanode daemon and wait for it to finish.
|
void |
scheduleBlockReport(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(DatanodeRegistration dnReg) |
void |
shutdown()
Shut down this instance of the datanode.
|
BlockRecoveryInfo |
startBlockRecovery(Block block)
Begin recovery on a block - this interrupts writers and returns the
necessary metadata for recovery to begin.
|
String |
toString() |
void |
unRegisterMXBean() |
void |
updateBlock(Block oldblock,
Block newblock,
boolean finalize)
Update the block to the new generation stamp and length.
|
getConf, setConfpublic static final org.apache.commons.logging.Log LOG
public DatanodeProtocol namenode
public FSDatasetInterface data
public DatanodeRegistration dnRegistration
public org.apache.hadoop.hdfs.server.datanode.DataBlockScanner blockScanner
public Daemon blockScannerThread
public Server ipcServer
public static final int PKT_HEADER_LEN
@Deprecated public static InetSocketAddress createSocketAddr(String target) throws IOException
NetUtils.createSocketAddr(String) instead.IOExceptionpublic void unRegisterMXBean()
public static InetSocketAddress getInfoAddr(Configuration conf)
protected Socket newSocket() throws IOException
IOExceptionpublic static DataNode getDataNode()
public static InterDatanodeProtocol createInterDataNodeProtocolProxy(DatanodeInfo info, Configuration conf, int socketTimeout, boolean connectToDnViaHostname) throws IOException
IOExceptionpublic InetSocketAddress getNameNodeAddr()
public InetSocketAddress getSelfAddr()
public String getNamenode()
public static void setNewStorageID(DatanodeRegistration dnReg)
public void shutdown()
protected void checkDiskError(Exception e) throws IOException
e - that caused this checkDiskError callIOExceptionprotected void checkDiskError()
public int getXceiverCount()
getXceiverCount 在接口中 DataNodeMXBeanpublic void offerService()
throws Exception
Exceptionpublic void run()
public static void runDatanodeDaemon(DataNode dn) throws IOException
IOExceptionpublic static DataNode instantiateDataNode(String[] args, Configuration conf) throws IOException
runDatanodeDaemon(DataNode) subsequently.IOExceptionpublic static DataNode instantiateDataNode(String[] args, Configuration conf, SecureDataNodeStarter.SecureResources resources) throws IOException
runDatanodeDaemon(DataNode) subsequently.resources - Secure resources needed to run under KerberosIOExceptionpublic static DataNode createDataNode(String[] args, Configuration conf) throws IOException
IOExceptionpublic static DataNode createDataNode(String[] args, Configuration conf, SecureDataNodeStarter.SecureResources resources) throws IOException
IOExceptionpublic static DataNode makeInstance(String[] dataDirs, Configuration conf, SecureDataNodeStarter.SecureResources resources) throws IOException
dataDirs - List of directories, where the new DataNode instance should
keep its files.conf - Configuration instance to use.resources - Secure resources needed to run under KerberosIOExceptionpublic void scheduleBlockReport(long delay)
public FSDatasetInterface getFSDataset()
public static void secureMain(String[] args, SecureDataNodeStarter.SecureResources resources)
public static void main(String[] args)
public BlockMetaDataInfo getBlockMetaDataInfo(Block block) throws IOException
getBlockMetaDataInfo 在接口中 InterDatanodeProtocolIOExceptionpublic BlockRecoveryInfo startBlockRecovery(Block block) throws IOException
InterDatanodeProtocolstartBlockRecovery 在接口中 InterDatanodeProtocolIOExceptionpublic Daemon recoverBlocks(Block[] blocks, DatanodeInfo[][] targets)
public void updateBlock(Block oldblock, Block newblock, boolean finalize) throws IOException
updateBlock 在接口中 InterDatanodeProtocolIOExceptionpublic long getProtocolVersion(String protocol, long clientVersion) throws IOException
getProtocolVersion 在接口中 VersionedProtocolprotocol - The classname of the protocol interfaceclientVersion - The version of the protocol that the client speaksIOExceptionpublic BlockLocalPathInfo getBlockLocalPathInfo(Block block, Token<BlockTokenIdentifier> token) throws IOException
ClientDatanodeProtocolgetBlockLocalPathInfo 在接口中 ClientDatanodeProtocolblock - the specified block on the local datanodetoken - the block access token.IOException - on errorpublic LocatedBlock recoverBlock(Block block, boolean keepLength, DatanodeInfo[] targets) throws IOException
recoverBlock 在接口中 ClientDatanodeProtocolblock - the specified blockkeepLength - keep the block lengthtargets - the list of possible locations of specified blockIOExceptionpublic Block getBlockInfo(Block block) throws IOException
getBlockInfo 在接口中 ClientDatanodeProtocolblock - the specified blockIOException - if the block does not existpublic static InetSocketAddress getStreamingAddr(Configuration conf)
public String getHostName()
getHostName 在接口中 DataNodeMXBeanpublic String getVersion()
DataNodeMXBeangetVersion 在接口中 DataNodeMXBeanpublic String getRpcPort()
DataNodeMXBeangetRpcPort 在接口中 DataNodeMXBeanpublic String getHttpPort()
DataNodeMXBeangetHttpPort 在接口中 DataNodeMXBeanpublic String getNamenodeAddress()
DataNodeMXBeangetNamenodeAddress 在接口中 DataNodeMXBeanpublic String getVolumeInfo()
getVolumeInfo 在接口中 DataNodeMXBeanpublic Long getBalancerBandwidth()
Copyright © 2009 The Apache Software Foundation