|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.dfs.NameNode
NameNode serves as both directory namespace manager and "inode table" for the Hadoop DFS. There is a single NameNode running in any DFS deployment. (Well, except when there is a second backup/failover NameNode.) The NameNode controls two critical tables: 1) filename->blocksequence (namespace) 2) block->machinelist ("inodes") The first table is stored on disk and is very precious. The second table is rebuilt every time the NameNode comes up. 'NameNode' refers to both this class as well as the 'NameNode server'. The 'FSNamesystem' class actually performs most of the filesystem management. The majority of the 'NameNode' class itself is concerned with exposing the IPC interface to the outside world, plus some configuration management. NameNode implements the ClientProtocol interface, which allows clients to ask for DFS services. ClientProtocol is not designed for direct use by authors of DFS client code. End-users should instead use the org.apache.nutch.hadoop.fs.FileSystem class. NameNode also implements the DatanodeProtocol interface, used by DataNode programs that actually store DFS data blocks. These methods are invoked repeatedly and automatically by all the DataNodes in a DFS deployment.
Constructor Summary | |
NameNode(Configuration conf)
Create a NameNode at the default location |
|
NameNode(File dir,
int port,
Configuration conf)
Create a NameNode at the specified location and start it. |
Method Summary | |
void |
abandonBlock(org.apache.hadoop.dfs.Block b,
String src)
The client needs to give up on the block. |
void |
abandonFileInProgress(String src)
A client that wants to abandon writing to the current file should call abandonFileInProgress(). |
org.apache.hadoop.dfs.LocatedBlock |
addBlock(String src,
String clientMachine)
A client that wants to write an additional block to the indicated filename (which must currently be open for writing) should call addBlock(). |
void |
blockReceived(String sender,
org.apache.hadoop.dfs.Block[] blocks)
blockReceived() allows the DataNode to tell the NameNode about recently-received block data. |
org.apache.hadoop.dfs.Block[] |
blockReport(String sender,
org.apache.hadoop.dfs.Block[] blocks)
blockReport() tells the NameNode about all the locally-stored blocks. |
boolean |
complete(String src,
String clientName)
The client is done writing data to the given filename, and would like to complete it. |
org.apache.hadoop.dfs.LocatedBlock |
create(String src,
String clientName,
String clientMachine,
boolean overwrite)
Create a new file. |
boolean |
delete(String src)
Remove the given filename from the filesystem |
void |
errorReport(String sender,
String msg)
errorReport() tells the NameNode about something that has gone awry. |
boolean |
exists(String src)
Check whether the given file exists |
static void |
format(Configuration conf)
Format a new filesystem. |
org.apache.hadoop.dfs.BlockCommand |
getBlockwork(String sender,
int xmitsInProgress)
Return a block-oriented command for the datanode to execute. |
org.apache.hadoop.dfs.DatanodeInfo[] |
getDatanodeReport()
Get a full report on the system's current datanodes. |
String[][] |
getHints(String src,
long start,
long len)
getHints() returns a list of hostnames that store data for a specific file region. |
org.apache.hadoop.dfs.DFSFileInfo[] |
getListing(String src)
Get a listing of the indicated directory |
long[] |
getStats()
Get a set of statistics about the filesystem. |
boolean |
isDir(String src)
Check whether the given filename is a directory or not. |
void |
join()
Wait for service to finish. |
static void |
main(String[] argv)
|
boolean |
mkdirs(String src)
Create a directory (or hierarchy of directories) with the given name. |
boolean |
obtainLock(String src,
String clientName,
boolean exclusive)
obtainLock() is used for lock managemnet. |
org.apache.hadoop.dfs.LocatedBlock[] |
open(String src)
Open an existing file, at the given name. |
boolean |
releaseLock(String src,
String clientName)
releaseLock() is called if the client would like to release a held lock. |
boolean |
rename(String src,
String dst)
Rename an item in the fs namespace |
void |
renewLease(String clientName)
Client programs can cause stateful changes in the NameNode that affect other clients. |
void |
reportWrittenBlock(org.apache.hadoop.dfs.LocatedBlock lb)
The client can report in a set written blocks that it wrote. |
void |
sendHeartbeat(String sender,
long capacity,
long remaining)
sendHeartbeat() tells the NameNode that the DataNode is still alive and well. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Logger LOG
public static final int BLOCK_SIZE
public static final int MIN_BLOCKS_FOR_WRITE
public static final long WRITE_COMPLETE
public static final byte OP_ERROR
public static final byte OP_HEARTBEAT
public static final byte OP_BLOCKRECEIVED
public static final byte OP_BLOCKREPORT
public static final byte OP_TRANSFERDATA
public static final byte OP_CLIENT_OPEN
public static final byte OP_CLIENT_STARTFILE
public static final byte OP_CLIENT_ADDBLOCK
public static final byte OP_CLIENT_RENAMETO
public static final byte OP_CLIENT_DELETE
public static final byte OP_CLIENT_COMPLETEFILE
public static final byte OP_CLIENT_LISTING
public static final byte OP_CLIENT_OBTAINLOCK
public static final byte OP_CLIENT_RELEASELOCK
public static final byte OP_CLIENT_EXISTS
public static final byte OP_CLIENT_ISDIR
public static final byte OP_CLIENT_MKDIRS
public static final byte OP_CLIENT_RENEW_LEASE
public static final byte OP_CLIENT_ABANDONBLOCK
public static final byte OP_CLIENT_RAWSTATS
public static final byte OP_CLIENT_DATANODEREPORT
public static final byte OP_CLIENT_DATANODE_HINTS
public static final byte OP_ACK
public static final byte OP_TRANSFERBLOCKS
public static final byte OP_INVALIDATE_BLOCKS
public static final byte OP_FAILURE
public static final byte OP_CLIENT_OPEN_ACK
public static final byte OP_CLIENT_STARTFILE_ACK
public static final byte OP_CLIENT_ADDBLOCK_ACK
public static final byte OP_CLIENT_RENAMETO_ACK
public static final byte OP_CLIENT_DELETE_ACK
public static final byte OP_CLIENT_COMPLETEFILE_ACK
public static final byte OP_CLIENT_TRYAGAIN
public static final byte OP_CLIENT_LISTING_ACK
public static final byte OP_CLIENT_OBTAINLOCK_ACK
public static final byte OP_CLIENT_RELEASELOCK_ACK
public static final byte OP_CLIENT_EXISTS_ACK
public static final byte OP_CLIENT_ISDIR_ACK
public static final byte OP_CLIENT_MKDIRS_ACK
public static final byte OP_CLIENT_RENEW_LEASE_ACK
public static final byte OP_CLIENT_ABANDONBLOCK_ACK
public static final byte OP_CLIENT_RAWSTATS_ACK
public static final byte OP_CLIENT_DATANODEREPORT_ACK
public static final byte OP_CLIENT_DATANODE_HINTS_ACK
public static final byte OP_WRITE_BLOCK
public static final byte OP_READ_BLOCK
public static final byte OP_READSKIP_BLOCK
public static final byte RUNLENGTH_ENCODING
public static final byte CHUNKED_ENCODING
public static final int OPERATION_FAILED
public static final int STILL_WAITING
public static final int COMPLETE_SUCCESS
public static final long HEARTBEAT_INTERVAL
public static final long EXPIRE_INTERVAL
public static final long BLOCKREPORT_INTERVAL
public static final long DATANODE_STARTUP_PERIOD
public static final long LEASE_PERIOD
public static final int READ_TIMEOUT
public static final int BUFFER_SIZE
Constructor Detail |
public NameNode(Configuration conf) throws IOException
public NameNode(File dir, int port, Configuration conf) throws IOException
Method Detail |
public static void format(Configuration conf) throws IOException
IOException
public void join()
public org.apache.hadoop.dfs.LocatedBlock[] open(String src) throws IOException
org.apache.hadoop.dfs.ClientProtocol
open
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public org.apache.hadoop.dfs.LocatedBlock create(String src, String clientName, String clientMachine, boolean overwrite) throws IOException
org.apache.hadoop.dfs.ClientProtocol
create
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public org.apache.hadoop.dfs.LocatedBlock addBlock(String src, String clientMachine) throws IOException
org.apache.hadoop.dfs.ClientProtocol
addBlock
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public void reportWrittenBlock(org.apache.hadoop.dfs.LocatedBlock lb) throws IOException
reportWrittenBlock
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public void abandonBlock(org.apache.hadoop.dfs.Block b, String src) throws IOException
abandonBlock
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public void abandonFileInProgress(String src) throws IOException
org.apache.hadoop.dfs.ClientProtocol
abandonFileInProgress
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean complete(String src, String clientName) throws IOException
org.apache.hadoop.dfs.ClientProtocol
complete
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public String[][] getHints(String src, long start, long len) throws IOException
org.apache.hadoop.dfs.ClientProtocol
getHints
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean rename(String src, String dst) throws IOException
org.apache.hadoop.dfs.ClientProtocol
rename
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean delete(String src) throws IOException
org.apache.hadoop.dfs.ClientProtocol
delete
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean exists(String src) throws IOException
org.apache.hadoop.dfs.ClientProtocol
exists
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean isDir(String src) throws IOException
org.apache.hadoop.dfs.ClientProtocol
isDir
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean mkdirs(String src) throws IOException
org.apache.hadoop.dfs.ClientProtocol
mkdirs
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean obtainLock(String src, String clientName, boolean exclusive) throws IOException
org.apache.hadoop.dfs.ClientProtocol
obtainLock
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public boolean releaseLock(String src, String clientName) throws IOException
org.apache.hadoop.dfs.ClientProtocol
releaseLock
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public void renewLease(String clientName) throws IOException
org.apache.hadoop.dfs.ClientProtocol
renewLease
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public org.apache.hadoop.dfs.DFSFileInfo[] getListing(String src) throws IOException
org.apache.hadoop.dfs.ClientProtocol
getListing
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public long[] getStats() throws IOException
org.apache.hadoop.dfs.ClientProtocol
getStats
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public org.apache.hadoop.dfs.DatanodeInfo[] getDatanodeReport() throws IOException
org.apache.hadoop.dfs.ClientProtocol
getDatanodeReport
in interface org.apache.hadoop.dfs.ClientProtocol
IOException
public void sendHeartbeat(String sender, long capacity, long remaining)
org.apache.hadoop.dfs.DatanodeProtocol
sendHeartbeat
in interface org.apache.hadoop.dfs.DatanodeProtocol
public org.apache.hadoop.dfs.Block[] blockReport(String sender, org.apache.hadoop.dfs.Block[] blocks)
org.apache.hadoop.dfs.DatanodeProtocol
blockReport
in interface org.apache.hadoop.dfs.DatanodeProtocol
public void blockReceived(String sender, org.apache.hadoop.dfs.Block[] blocks)
org.apache.hadoop.dfs.DatanodeProtocol
blockReceived
in interface org.apache.hadoop.dfs.DatanodeProtocol
public void errorReport(String sender, String msg)
org.apache.hadoop.dfs.DatanodeProtocol
errorReport
in interface org.apache.hadoop.dfs.DatanodeProtocol
public org.apache.hadoop.dfs.BlockCommand getBlockwork(String sender, int xmitsInProgress)
getBlockwork
in interface org.apache.hadoop.dfs.DatanodeProtocol
public static void main(String[] argv) throws Exception
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |