|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hdfs.server.namenode.NameNode
org.apache.hadoop.hdfs.server.namenode.BackupNode
@InterfaceAudience.Private public class BackupNode
BackupNode.
Backup node can play two roles.
HdfsConstants.NamenodeRole.CHECKPOINT
node periodically creates checkpoints,
that is downloads image and edits from the active node, merges them, and
uploads the new image back to the active.HdfsConstants.NamenodeRole.BACKUP
node keeps its namespace in sync with the
active node, and periodically creates checkpoints by simply saving the
namespace image to local disk(s).
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.hadoop.hdfs.protocol.FSConstants |
---|
FSConstants.DatanodeReportType, FSConstants.SafeModeAction, FSConstants.UpgradeAction |
Field Summary |
---|
Fields inherited from class org.apache.hadoop.hdfs.server.namenode.NameNode |
---|
DEFAULT_PORT, httpAddress, httpServer, LOG, namesystem, nodeRegistration, role, rpcAddress, serviceRPCAddress, serviceRpcServer, stateChangeLog, stopRequested |
Fields inherited from interface org.apache.hadoop.hdfs.protocol.ClientProtocol |
---|
GET_STATS_CAPACITY_IDX, GET_STATS_CORRUPT_BLOCKS_IDX, GET_STATS_MISSING_BLOCKS_IDX, GET_STATS_REMAINING_IDX, GET_STATS_UNDER_REPLICATED_IDX, GET_STATS_USED_IDX, versionID |
Fields inherited from interface org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol |
---|
DISK_ERROR, DNA_ACCESSKEYUPDATE, DNA_FINALIZE, DNA_INVALIDATE, DNA_RECOVERBLOCK, DNA_REGISTER, DNA_SHUTDOWN, DNA_TRANSFER, DNA_UNKNOWN, FATAL_DISK_ERROR, INVALID_BLOCK, NOTIFY, versionID |
Fields inherited from interface org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol |
---|
ACT_CHECKPOINT, ACT_SHUTDOWN, ACT_UNKNOWN, FATAL, JA_CHECKPOINT_TIME, JA_IS_ALIVE, JA_JOURNAL, JA_JSPOOL_START, NOTIFY, versionID |
Fields inherited from interface org.apache.hadoop.security.authorize.RefreshAuthorizationPolicyProtocol |
---|
versionID |
Fields inherited from interface org.apache.hadoop.security.RefreshUserMappingsProtocol |
---|
versionID |
Method Summary | |
---|---|
void |
endCheckpoint(NamenodeRegistration registration,
CheckpointSignature sig)
A request to the active name-node to finalize previously started checkpoint. |
BlocksWithLocations |
getBlocks(DatanodeInfo datanode,
long size)
Get a list of blocks belonging to datanode
whose total size equals size . |
protected InetSocketAddress |
getHttpServerAddress(org.apache.hadoop.conf.Configuration conf)
|
protected InetSocketAddress |
getRpcServerAddress(org.apache.hadoop.conf.Configuration conf)
|
protected InetSocketAddress |
getServiceRpcServerAddress(org.apache.hadoop.conf.Configuration conf)
Given a configuration get the address of the service rpc server If the service rpc is not configured returns null |
protected void |
initialize(org.apache.hadoop.conf.Configuration conf)
Initialize name-node. |
void |
journal(NamenodeRegistration nnReg,
int jAction,
int length,
byte[] args)
Journal edit records. |
protected void |
loadNamesystem(org.apache.hadoop.conf.Configuration conf)
|
NamenodeRegistration |
register(NamenodeRegistration registration)
Register a subordinate name-node like backup node. |
protected void |
setHttpServerAddress(org.apache.hadoop.conf.Configuration conf)
|
protected void |
setRpcServerAddress(org.apache.hadoop.conf.Configuration conf)
|
protected void |
setRpcServiceServerAddress(org.apache.hadoop.conf.Configuration conf)
Modifies the configuration passed to contain the service rpc address setting |
boolean |
setSafeMode(FSConstants.SafeModeAction action)
Enter, leave or get safe mode. |
NamenodeCommand |
startCheckpoint(NamenodeRegistration registration)
A request to the active name-node to start a checkpoint. |
void |
stop()
Stop all NameNode threads and wait for all to finish. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected InetSocketAddress getRpcServerAddress(org.apache.hadoop.conf.Configuration conf) throws IOException
getRpcServerAddress
in class NameNode
IOException
protected InetSocketAddress getServiceRpcServerAddress(org.apache.hadoop.conf.Configuration conf) throws IOException
NameNode
getServiceRpcServerAddress
in class NameNode
IOException
protected void setRpcServerAddress(org.apache.hadoop.conf.Configuration conf)
setRpcServerAddress
in class NameNode
protected void setRpcServiceServerAddress(org.apache.hadoop.conf.Configuration conf)
NameNode
setRpcServiceServerAddress
in class NameNode
protected InetSocketAddress getHttpServerAddress(org.apache.hadoop.conf.Configuration conf)
getHttpServerAddress
in class NameNode
protected void setHttpServerAddress(org.apache.hadoop.conf.Configuration conf)
setHttpServerAddress
in class NameNode
protected void loadNamesystem(org.apache.hadoop.conf.Configuration conf) throws IOException
loadNamesystem
in class NameNode
IOException
protected void initialize(org.apache.hadoop.conf.Configuration conf) throws IOException
NameNode
initialize
in class NameNode
conf
- the configuration
IOException
public void stop()
NameNode
stop
in class NameNode
public boolean setSafeMode(FSConstants.SafeModeAction action) throws IOException
ClientProtocol
Safe mode is a name node state when it
Safe mode is entered automatically at name node startup.
Safe mode can also be entered manually using
setSafeMode(SafeModeAction.SAFEMODE_GET)
.
At startup the name node accepts data node reports collecting information about block locations. In order to leave safe mode it needs to collect a configurable percentage called threshold of blocks, which satisfy the minimal replication condition. The minimal replication condition is that each block must have at least dfs.namenode.replication.min replicas. When the threshold is reached the name node extends safe mode for a configurable amount of time to let the remaining data nodes to check in before it will start replicating missing blocks. Then the name node leaves safe mode.
If safe mode is turned on manually using
setSafeMode(SafeModeAction.SAFEMODE_ENTER)
then the name node stays in safe mode until it is manually turned off
using setSafeMode(SafeModeAction.SAFEMODE_LEAVE)
.
Current state of the name node can be verified using
setSafeMode(SafeModeAction.SAFEMODE_GET)
setSafeMode
in interface ClientProtocol
setSafeMode
in class NameNode
action
- IOException
public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size) throws IOException
NamenodeProtocol
datanode
whose total size equals size
.
getBlocks
in interface NamenodeProtocol
getBlocks
in class NameNode
datanode
- a data nodesize
- requested size
IOException
Balancer
public NamenodeRegistration register(NamenodeRegistration registration) throws IOException
NamenodeProtocol
register
in interface NamenodeProtocol
register
in class NameNode
NamenodeRegistration
of the node,
which this node has just registered with.
IOException
public NamenodeCommand startCheckpoint(NamenodeRegistration registration) throws IOException
NamenodeProtocol
startCheckpoint
in interface NamenodeProtocol
startCheckpoint
in class NameNode
registration
- the requesting node
CheckpointCommand
if checkpoint is allowed.
IOException
CheckpointCommand
,
NamenodeCommand
,
NamenodeProtocol.ACT_SHUTDOWN
public void endCheckpoint(NamenodeRegistration registration, CheckpointSignature sig) throws IOException
NamenodeProtocol
endCheckpoint
in interface NamenodeProtocol
endCheckpoint
in class NameNode
registration
- the requesting nodesig
- CheckpointSignature
which identifies the checkpoint.
IOException
public void journal(NamenodeRegistration nnReg, int jAction, int length, byte[] args) throws IOException
NamenodeProtocol
EditLogBackupOutputStream
in order to synchronize meta-data
changes with the backup namespace image.
journal
in interface NamenodeProtocol
journal
in class NameNode
nnReg
- active node registrationjAction
- journal actionlength
- length of the byte arrayargs
- byte array containing serialized journal records
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |