Class SecondaryNameNode
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode
- All Implemented Interfaces:
Runnable,SecondaryNameNodeInfoMXBean,VersionInfoMXBean
@Private
public class SecondaryNameNode
extends Object
implements Runnable, SecondaryNameNodeInfoMXBean
The Secondary NameNode is a helper to the primary NameNode.
The Secondary is responsible for supporting periodic checkpoints
of the HDFS metadata. The current design allows only one Secondary
NameNode per HDFs cluster.
The Secondary NameNode is a daemon that periodically wakes
up (determined by the schedule specified in the configuration),
triggers a periodic checkpoint and then goes back to sleep.
The Secondary NameNode uses the NamenodeProtocol to talk to the
primary NameNode.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSecondaryNameNode(org.apache.hadoop.conf.Configuration conf) Create a connection to the primary namenode.SecondaryNameNode(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.CommandLineOpts commandLineOpts) -
Method Summary
Modifier and TypeMethodDescriptionbooleanCreate a new checkpointvoiddoWork()String[]String[]Gets the host and port colon separated.static InetSocketAddressgetHttpAddress(org.apache.hadoop.conf.Configuration conf) longlonglongbooleanGets if security is enabled.static voidmain() has some simple utility methods.voidrun()voidshutdown()Shut down this instance of the secondary namenode.voidvoidStart the web server.toString()
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
SecondaryNameNode
Create a connection to the primary namenode.- Throws:
IOException
-
SecondaryNameNode
public SecondaryNameNode(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.CommandLineOpts commandLineOpts) throws IOException - Throws:
IOException
-
-
Method Details
-
toString
-
getFSNamesystem
-
getHttpAddress
-
shutdown
public void shutdown()Shut down this instance of the secondary namenode. Returns only after shutdown is complete. -
run
public void run() -
doWork
public void doWork() -
startInfoServer
Start the web server.- Throws:
IOException
-
doCheckpoint
Create a new checkpoint- Returns:
- if the image is fetched from primary or not
- Throws:
IOException
-
main
main() has some simple utility methods.- Parameters:
argv- Command line parameters.- Throws:
Exception- if the filesystem does not exist.
-
startCheckpointThread
public void startCheckpointThread() -
getHostAndPort
Description copied from interface:SecondaryNameNodeInfoMXBeanGets the host and port colon separated.- Specified by:
getHostAndPortin interfaceSecondaryNameNodeInfoMXBean
-
isSecurityEnabled
public boolean isSecurityEnabled()Description copied from interface:SecondaryNameNodeInfoMXBeanGets if security is enabled.- Specified by:
isSecurityEnabledin interfaceSecondaryNameNodeInfoMXBean- Returns:
- true, if security is enabled.
-
getStartTime
public long getStartTime()- Specified by:
getStartTimein interfaceSecondaryNameNodeInfoMXBean- Returns:
- the timestamp of when the SNN starts
-
getLastCheckpointTime
public long getLastCheckpointTime()- Specified by:
getLastCheckpointTimein interfaceSecondaryNameNodeInfoMXBean- Returns:
- the timestamp of the last checkpoint
-
getLastCheckpointDeltaMs
public long getLastCheckpointDeltaMs()- Specified by:
getLastCheckpointDeltaMsin interfaceSecondaryNameNodeInfoMXBean- Returns:
- the number of msec since the last checkpoint, or -1 if no checkpoint has been done yet.
-
getCheckpointDirectories
- Specified by:
getCheckpointDirectoriesin interfaceSecondaryNameNodeInfoMXBean- Returns:
- the directories that store the checkpoint images
-
getCheckpointEditlogDirectories
- Specified by:
getCheckpointEditlogDirectoriesin interfaceSecondaryNameNodeInfoMXBean- Returns:
- the directories that store the edit logs
-
getCompileInfo
- Specified by:
getCompileInfoin interfaceVersionInfoMXBean- Returns:
- the compilation information which contains date, user and branch
-
getSoftwareVersion
- Specified by:
getSoftwareVersionin interfaceVersionInfoMXBean- Returns:
- the software version
-