Class JournalNode
java.lang.Object
org.apache.hadoop.hdfs.qjournal.server.JournalNode
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,JournalNodeMXBean,org.apache.hadoop.util.Tool
@Private
public class JournalNode
extends Object
implements org.apache.hadoop.util.Tool, org.apache.hadoop.conf.Configurable, JournalNodeMXBean
The JournalNode is a daemon which allows namenodes using
the QuorumJournalManager to log and retrieve edits stored
remotely. It is a thin wrapper around a local edit log
directory with the addition of facilities to participate
in the quorum protocol.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncanRollBack(String journalId, StorageInfo storage, StorageInfo prevStorage, int targetLayoutVersion, String nameServiceId) voiddiscardSegments(String journalId, long startTxId, String nameServiceId) voiddoFinalize(String journalId, String nameServiceId) voiddoPreUpgrade(String journalId) voiddoRollback(String journalId, String nameServiceId) voiddoUpgrade(String journalId, StorageInfo sInfo) Get list of the clusters of JournalNode's journals as one JournalNode may support multiple clusters.org.apache.hadoop.conf.ConfigurationgetConf()Get host and port of JournalNode.static InetSocketAddressgetHttpAddress(org.apache.hadoop.conf.Configuration conf) protected InetSocketAddressgetHttpServerBindAddress(org.apache.hadoop.conf.Configuration configuration) longGet the start time of the JournalNode.getJournal(String jid) getJournalCTime(String journalId, String nameServiceId) Get status information (e.g., whether formatted) of JournalNode's journals.getJournalSyncer(String jid) booleangetOrCreateJournal(String jid) getOrCreateJournal(String jid, String nameServiceId) Get the list of the storage infos of JournalNode's journals.Gets the version of Hadoop.booleanstatic voidintvoidsetConf(org.apache.hadoop.conf.Configuration conf) voidstart()Start listening for edits via RPC.voidstop(int rc) Stop the daemon with the given status codevoidstopAndJoin(int rc)
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
JournalNode
public JournalNode()
-
-
Method Details
-
getJournalSyncer
-
getJournalSyncerStatus
-
getOrCreateJournal
- Throws:
IOException
-
getOrCreateJournal
- Throws:
IOException
-
setConf
public void setConf(org.apache.hadoop.conf.Configuration conf) - Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
getConf
public org.apache.hadoop.conf.Configuration getConf()- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
run
- Specified by:
runin interfaceorg.apache.hadoop.util.Tool- Throws:
Exception
-
start
Start listening for edits via RPC.- Throws:
IOException
-
isStarted
public boolean isStarted() -
getBoundIpcAddress
- Returns:
- the address the IPC server is bound to
-
getHttpServerURI
-
stop
public void stop(int rc) Stop the daemon with the given status code- Parameters:
rc- the status code with which to exit (non-zero should indicate an error)
-
stopAndJoin
- Throws:
InterruptedException
-
getJournalsStatus
Description copied from interface:JournalNodeMXBeanGet status information (e.g., whether formatted) of JournalNode's journals.- Specified by:
getJournalsStatusin interfaceJournalNodeMXBean- Returns:
- A string presenting status for each journal
-
getHostAndPort
Description copied from interface:JournalNodeMXBeanGet host and port of JournalNode.- Specified by:
getHostAndPortin interfaceJournalNodeMXBean- Returns:
- colon separated host and port.
-
getClusterIds
Description copied from interface:JournalNodeMXBeanGet list of the clusters of JournalNode's journals as one JournalNode may support multiple clusters.- Specified by:
getClusterIdsin interfaceJournalNodeMXBean- Returns:
- list of clusters.
-
getVersion
Description copied from interface:JournalNodeMXBeanGets the version of Hadoop.- Specified by:
getVersionin interfaceJournalNodeMXBean- Returns:
- the version of Hadoop.
-
getJNStartedTimeInMillis
public long getJNStartedTimeInMillis()Description copied from interface:JournalNodeMXBeanGet the start time of the JournalNode.- Specified by:
getJNStartedTimeInMillisin interfaceJournalNodeMXBean- Returns:
- the start time of the JournalNode.
-
getStorageInfos
Description copied from interface:JournalNodeMXBeanGet the list of the storage infos of JournalNode's journals. Storage infos include layout version, namespace id, cluster id and creation time of the File system state.- Specified by:
getStorageInfosin interfaceJournalNodeMXBean- Returns:
- the list of storage infos associated with journals.
-
main
- Throws:
Exception
-
doPreUpgrade
- Throws:
IOException
-
doUpgrade
- Throws:
IOException
-
doFinalize
- Throws:
IOException
-
canRollBack
public Boolean canRollBack(String journalId, StorageInfo storage, StorageInfo prevStorage, int targetLayoutVersion, String nameServiceId) throws IOException - Throws:
IOException
-
doRollback
- Throws:
IOException
-
discardSegments
public void discardSegments(String journalId, long startTxId, String nameServiceId) throws IOException - Throws:
IOException
-
getJournalCTime
- Throws:
IOException
-
getJournal
-
getHttpAddress
-
getHttpServerBindAddress
protected InetSocketAddress getHttpServerBindAddress(org.apache.hadoop.conf.Configuration configuration) -
getRpcServer
-
getBoundHttpAddress
- Returns:
- the actual JournalNode HTTP/HTTPS address.
-
getHttpAddress
- Returns:
- JournalNode HTTP address
-
getHttpsAddress
- Returns:
- JournalNode HTTPS address
-