Package org.apache.bookkeeper.bookie
Class BookieShell
- java.lang.Object
-
- org.apache.bookkeeper.bookie.BookieShell
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
BookieShell.AutoRecoveryCmd
Command for administration of autorecovery.(package private) class
BookieShell.BookieFormatCmd
Formats the local data present in current bookie server.(package private) class
BookieShell.BookieInfoCmd
(package private) class
BookieShell.BookieSanityTestCmd
Command to run a bookie sanity test.(package private) class
BookieShell.CheckDbLedgersIndexCmd
Rebuild DbLedgerStorage ledgers index.(package private) class
BookieShell.ClusterInfoCmd
static interface
BookieShell.Command
BookieShell command.(package private) class
BookieShell.ConvertToDbStorageCmd
Convert bookie indexes from InterleavedStorage to DbLedgerStorage format.(package private) class
BookieShell.ConvertToInterleavedStorageCmd
Convert bookie indexes from DbLedgerStorage to InterleavedStorage format.(package private) class
BookieShell.DecommissionBookieCmd
Command to trigger AuditTask by resetting lostBookieRecoveryDelay and then make sure the ledgers stored in the bookie are properly replicated and Cookie of the decommissioned bookie should be deleted from metadata server.(package private) class
BookieShell.DeleteLedgerCmd
Command to delete a given ledger.(package private) class
BookieShell.EndpointInfoCmd
Command to retrieve remote bookie endpoint information.(package private) class
BookieShell.ForceAuditorChecksCmd
(package private) class
BookieShell.HelpCmd
Command to print help message.(package private) class
BookieShell.InitBookieCmd
Initializes bookie, by making sure that the journalDir, ledgerDirs and indexDirs are empty and there is no registered Bookie with this BookieId.(package private) class
BookieShell.InitNewCluster
Initializes new cluster by creating required znodes for the cluster.(package private) class
BookieShell.LastMarkCmd
Command to print last log mark.(package private) class
BookieShell.LedgerCmd
Ledger Command Handles ledger related operations.(package private) class
BookieShell.LedgerMetadataCmd
Print the metadata for a ledger.(package private) class
BookieShell.ListActiveLedgersCmd
List active ledgers on entry log file.(package private) class
BookieShell.ListBookiesCmd
List available bookies.(package private) class
BookieShell.ListDiskFilesCmd
(package private) class
BookieShell.ListLedgersCmd
Command to list all ledgers in the cluster.(package private) class
BookieShell.ListUnderreplicatedCmd
Command for listing underreplicated ledgers.(package private) class
BookieShell.LocalConsistencyCheck
Check local storage for inconsistencies.(package private) class
BookieShell.LostBookieRecoveryDelayCmd
Setter and Getter for LostBookieRecoveryDelay value (in seconds) in metadata store.(package private) class
BookieShell.MetaFormatCmd
Format the bookkeeper metadata present in zookeeper.(package private) class
BookieShell.MyCommand
(package private) class
BookieShell.NukeExistingCluster
Nuke bookkeeper metadata of existing cluster in zookeeper.(package private) class
BookieShell.QueryAutoRecoveryStatusCmd
Command to query autorecovery status.(package private) class
BookieShell.ReadJournalCmd
Command to read journal files.(package private) class
BookieShell.ReadLedgerEntriesCmd
Command for reading ledger entries.(package private) class
BookieShell.ReadLogCmd
Command to read entry log files.(package private) class
BookieShell.ReadLogMetadataCmd
Command to print metadata of entrylog.(package private) class
BookieShell.RebuildDbLedgerLocationsIndexCmd
Rebuild DbLedgerStorage locations index.(package private) class
BookieShell.RebuildDbLedgersIndexCmd
Rebuild DbLedgerStorage ledgers index.(package private) class
BookieShell.RecoverCmd
Recover command for ledger data recovery for failed bookie.(package private) class
BookieShell.RegenerateInterleavedStorageIndexFile
Regenerate an index file for interleaved storage.(package private) class
BookieShell.SimpleTestCmd
Simple test to create a ledger and write to it.(package private) class
BookieShell.TriggerAuditCmd
Command to trigger AuditTask by resetting lostBookieRecoveryDelay to its current value.(package private) class
BookieShell.UpdateBookieInLedgerCmd
Update bookie into ledger command.(package private) class
BookieShell.UpdateCookieCmd
Update cookie command.(package private) class
BookieShell.UpdateLedgerCmd
Update ledger command.static interface
BookieShell.UpdateLedgerNotifier
A facility for reporting update ledger progress.(package private) class
BookieShell.WhatIsInstanceId
Prints the instanceid of the cluster.(package private) class
BookieShell.WhoIsAuditorCmd
Print which node has the auditor lock.
-
Field Summary
Fields Modifier and Type Field Description (package private) ServerConfiguration
bkConf
(package private) static java.lang.String
CMD_ACTIVE_LEDGERS_ON_ENTRY_LOG_FILE
(package private) static java.lang.String
CMD_AUTORECOVERY
(package private) static java.lang.String
CMD_BOOKIEFORMAT
(package private) static java.lang.String
CMD_BOOKIEINFO
(package private) static java.lang.String
CMD_BOOKIESANITYTEST
(package private) static java.lang.String
CMD_CHECK_DB_LEDGERS_INDEX
(package private) static java.lang.String
CMD_CLUSTERINFO
(package private) static java.lang.String
CMD_CONVERT_TO_DB_STORAGE
(package private) static java.lang.String
CMD_CONVERT_TO_INTERLEAVED_STORAGE
(package private) static java.lang.String
CMD_CREATE_COOKIE
(package private) static java.lang.String
CMD_DECOMMISSIONBOOKIE
(package private) static java.lang.String
CMD_DELETE_COOKIE
(package private) static java.lang.String
CMD_DELETELEDGER
(package private) static java.lang.String
CMD_ENDPOINTINFO
(package private) static java.lang.String
CMD_FORCEAUDITCHECKS
(package private) static java.lang.String
CMD_GENERATE_COOKIE
(package private) static java.lang.String
CMD_GET_COOKIE
(package private) static java.lang.String
CMD_HELP
(package private) static java.lang.String
CMD_INITBOOKIE
(package private) static java.lang.String
CMD_INITNEWCLUSTER
(package private) static java.lang.String
CMD_LASTMARK
(package private) static java.lang.String
CMD_LEDGER
(package private) static java.lang.String
CMD_LEDGERMETADATA
(package private) static java.lang.String
CMD_LISTBOOKIES
(package private) static java.lang.String
CMD_LISTFILESONDISC
(package private) static java.lang.String
CMD_LISTLEDGERS
(package private) static java.lang.String
CMD_LISTUNDERREPLICATED
(package private) static java.lang.String
CMD_LOCALCONSISTENCYCHECK
(package private) static java.lang.String
CMD_LOSTBOOKIERECOVERYDELAY
(package private) static java.lang.String
CMD_METAFORMAT
(package private) static java.lang.String
CMD_NUKEEXISTINGCLUSTER
(package private) static java.lang.String
CMD_QUERY_AUTORECOVERY_STATUS
(package private) static java.lang.String
CMD_READ_LEDGER_ENTRIES
(package private) static java.lang.String
CMD_READJOURNAL
(package private) static java.lang.String
CMD_READLOG
(package private) static java.lang.String
CMD_READLOGMETADATA
(package private) static java.lang.String
CMD_REBUILD_DB_LEDGER_LOCATIONS_INDEX
(package private) static java.lang.String
CMD_REBUILD_DB_LEDGERS_INDEX
(package private) static java.lang.String
CMD_RECOVER
(package private) static java.lang.String
CMD_REGENERATE_INTERLEAVED_STORAGE_INDEX_FILE
(package private) static java.lang.String
CMD_SIMPLETEST
(package private) static java.lang.String
CMD_TRIGGERAUDIT
(package private) static java.lang.String
CMD_UPDATE_BOOKIE_IN_LEDGER
(package private) static java.lang.String
CMD_UPDATE_COOKIE
(package private) static java.lang.String
CMD_UPDATECOOKIE
(package private) static java.lang.String
CMD_UPDATELEDGER
(package private) static java.lang.String
CMD_WHATISINSTANCEID
(package private) static java.lang.String
CMD_WHOISAUDITOR
(package private) java.util.Map<java.lang.String,BookieShell.Command>
commands
(package private) static java.lang.String
CONF_OPT
(package private) int
entriesPerPage
(package private) static java.lang.String
ENTRY_FORMATTER_OPT
(package private) EntryFormatter
entryFormatter
(package private) EntryLogger
entryLogger
(package private) java.io.File[]
indexDirectories
(package private) java.io.File[]
journalDirectories
(package private) java.util.List<Journal>
journals
(package private) java.io.File[]
ledgerDirectories
(package private) static java.lang.String
LEDGERID_FORMATTER_OPT
(package private) LedgerIdFormatter
ledgerIdFormatter
(package private) static int
LIST_BATCH_SIZE
(package private) static org.slf4j.Logger
LOG
(package private) int
pageSize
-
Constructor Summary
Constructors Constructor Description BookieShell()
BookieShell(LedgerIdFormatter ledgeridFormatter, EntryFormatter entryFormatter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
execute(java.lang.String... args)
static java.util.List<java.io.File>
listFilesAndSort(java.io.File[] folderNames, java.lang.String... extensions)
Returns the sorted list of the files in the given folders with the given file extensions.static void
main(java.lang.String[] argv)
protected void
printEntryLogMetadata(long logId)
(package private) void
printErrorLine(java.lang.String s)
(package private) void
printInfoLine(java.lang.String s)
(package private) void
printLedgerMetadata(long ledgerId, LedgerMetadata md, boolean printMeta)
int
run(java.lang.String[] args)
Exectue the command with given arguments.void
setConf(org.apache.commons.configuration.CompositeConfiguration conf)
Passe a configuration object to the tool.
-
-
-
Field Detail
-
LOG
static final org.slf4j.Logger LOG
-
CONF_OPT
static final java.lang.String CONF_OPT
- See Also:
- Constant Field Values
-
ENTRY_FORMATTER_OPT
static final java.lang.String ENTRY_FORMATTER_OPT
- See Also:
- Constant Field Values
-
LEDGERID_FORMATTER_OPT
static final java.lang.String LEDGERID_FORMATTER_OPT
- See Also:
- Constant Field Values
-
CMD_METAFORMAT
static final java.lang.String CMD_METAFORMAT
- See Also:
- Constant Field Values
-
CMD_INITBOOKIE
static final java.lang.String CMD_INITBOOKIE
- See Also:
- Constant Field Values
-
CMD_INITNEWCLUSTER
static final java.lang.String CMD_INITNEWCLUSTER
- See Also:
- Constant Field Values
-
CMD_NUKEEXISTINGCLUSTER
static final java.lang.String CMD_NUKEEXISTINGCLUSTER
- See Also:
- Constant Field Values
-
CMD_BOOKIEFORMAT
static final java.lang.String CMD_BOOKIEFORMAT
- See Also:
- Constant Field Values
-
CMD_RECOVER
static final java.lang.String CMD_RECOVER
- See Also:
- Constant Field Values
-
CMD_LEDGER
static final java.lang.String CMD_LEDGER
- See Also:
- Constant Field Values
-
CMD_READ_LEDGER_ENTRIES
static final java.lang.String CMD_READ_LEDGER_ENTRIES
- See Also:
- Constant Field Values
-
CMD_LISTLEDGERS
static final java.lang.String CMD_LISTLEDGERS
- See Also:
- Constant Field Values
-
CMD_LEDGERMETADATA
static final java.lang.String CMD_LEDGERMETADATA
- See Also:
- Constant Field Values
-
CMD_LISTUNDERREPLICATED
static final java.lang.String CMD_LISTUNDERREPLICATED
- See Also:
- Constant Field Values
-
CMD_WHOISAUDITOR
static final java.lang.String CMD_WHOISAUDITOR
- See Also:
- Constant Field Values
-
CMD_WHATISINSTANCEID
static final java.lang.String CMD_WHATISINSTANCEID
- See Also:
- Constant Field Values
-
CMD_SIMPLETEST
static final java.lang.String CMD_SIMPLETEST
- See Also:
- Constant Field Values
-
CMD_BOOKIESANITYTEST
static final java.lang.String CMD_BOOKIESANITYTEST
- See Also:
- Constant Field Values
-
CMD_READLOG
static final java.lang.String CMD_READLOG
- See Also:
- Constant Field Values
-
CMD_READLOGMETADATA
static final java.lang.String CMD_READLOGMETADATA
- See Also:
- Constant Field Values
-
CMD_READJOURNAL
static final java.lang.String CMD_READJOURNAL
- See Also:
- Constant Field Values
-
CMD_LASTMARK
static final java.lang.String CMD_LASTMARK
- See Also:
- Constant Field Values
-
CMD_AUTORECOVERY
static final java.lang.String CMD_AUTORECOVERY
- See Also:
- Constant Field Values
-
CMD_LISTBOOKIES
static final java.lang.String CMD_LISTBOOKIES
- See Also:
- Constant Field Values
-
CMD_LISTFILESONDISC
static final java.lang.String CMD_LISTFILESONDISC
- See Also:
- Constant Field Values
-
CMD_UPDATECOOKIE
static final java.lang.String CMD_UPDATECOOKIE
- See Also:
- Constant Field Values
-
CMD_UPDATELEDGER
static final java.lang.String CMD_UPDATELEDGER
- See Also:
- Constant Field Values
-
CMD_UPDATE_BOOKIE_IN_LEDGER
static final java.lang.String CMD_UPDATE_BOOKIE_IN_LEDGER
- See Also:
- Constant Field Values
-
CMD_DELETELEDGER
static final java.lang.String CMD_DELETELEDGER
- See Also:
- Constant Field Values
-
CMD_BOOKIEINFO
static final java.lang.String CMD_BOOKIEINFO
- See Also:
- Constant Field Values
-
CMD_CLUSTERINFO
static final java.lang.String CMD_CLUSTERINFO
- See Also:
- Constant Field Values
-
CMD_ACTIVE_LEDGERS_ON_ENTRY_LOG_FILE
static final java.lang.String CMD_ACTIVE_LEDGERS_ON_ENTRY_LOG_FILE
- See Also:
- Constant Field Values
-
CMD_DECOMMISSIONBOOKIE
static final java.lang.String CMD_DECOMMISSIONBOOKIE
- See Also:
- Constant Field Values
-
CMD_ENDPOINTINFO
static final java.lang.String CMD_ENDPOINTINFO
- See Also:
- Constant Field Values
-
CMD_LOSTBOOKIERECOVERYDELAY
static final java.lang.String CMD_LOSTBOOKIERECOVERYDELAY
- See Also:
- Constant Field Values
-
CMD_TRIGGERAUDIT
static final java.lang.String CMD_TRIGGERAUDIT
- See Also:
- Constant Field Values
-
CMD_FORCEAUDITCHECKS
static final java.lang.String CMD_FORCEAUDITCHECKS
- See Also:
- Constant Field Values
-
CMD_CONVERT_TO_DB_STORAGE
static final java.lang.String CMD_CONVERT_TO_DB_STORAGE
- See Also:
- Constant Field Values
-
CMD_CONVERT_TO_INTERLEAVED_STORAGE
static final java.lang.String CMD_CONVERT_TO_INTERLEAVED_STORAGE
- See Also:
- Constant Field Values
-
CMD_REBUILD_DB_LEDGER_LOCATIONS_INDEX
static final java.lang.String CMD_REBUILD_DB_LEDGER_LOCATIONS_INDEX
- See Also:
- Constant Field Values
-
CMD_REBUILD_DB_LEDGERS_INDEX
static final java.lang.String CMD_REBUILD_DB_LEDGERS_INDEX
- See Also:
- Constant Field Values
-
CMD_CHECK_DB_LEDGERS_INDEX
static final java.lang.String CMD_CHECK_DB_LEDGERS_INDEX
- See Also:
- Constant Field Values
-
CMD_REGENERATE_INTERLEAVED_STORAGE_INDEX_FILE
static final java.lang.String CMD_REGENERATE_INTERLEAVED_STORAGE_INDEX_FILE
- See Also:
- Constant Field Values
-
CMD_QUERY_AUTORECOVERY_STATUS
static final java.lang.String CMD_QUERY_AUTORECOVERY_STATUS
- See Also:
- Constant Field Values
-
CMD_CREATE_COOKIE
static final java.lang.String CMD_CREATE_COOKIE
- See Also:
- Constant Field Values
-
CMD_DELETE_COOKIE
static final java.lang.String CMD_DELETE_COOKIE
- See Also:
- Constant Field Values
-
CMD_UPDATE_COOKIE
static final java.lang.String CMD_UPDATE_COOKIE
- See Also:
- Constant Field Values
-
CMD_GET_COOKIE
static final java.lang.String CMD_GET_COOKIE
- See Also:
- Constant Field Values
-
CMD_GENERATE_COOKIE
static final java.lang.String CMD_GENERATE_COOKIE
- See Also:
- Constant Field Values
-
CMD_HELP
static final java.lang.String CMD_HELP
- See Also:
- Constant Field Values
-
CMD_LOCALCONSISTENCYCHECK
static final java.lang.String CMD_LOCALCONSISTENCYCHECK
- See Also:
- Constant Field Values
-
bkConf
final ServerConfiguration bkConf
-
indexDirectories
java.io.File[] indexDirectories
-
ledgerDirectories
java.io.File[] ledgerDirectories
-
journalDirectories
java.io.File[] journalDirectories
-
entryLogger
EntryLogger entryLogger
-
journals
java.util.List<Journal> journals
-
entryFormatter
EntryFormatter entryFormatter
-
ledgerIdFormatter
LedgerIdFormatter ledgerIdFormatter
-
pageSize
int pageSize
-
entriesPerPage
int entriesPerPage
-
LIST_BATCH_SIZE
static final int LIST_BATCH_SIZE
- See Also:
- Constant Field Values
-
commands
final java.util.Map<java.lang.String,BookieShell.Command> commands
-
-
Constructor Detail
-
BookieShell
public BookieShell()
-
BookieShell
public BookieShell(LedgerIdFormatter ledgeridFormatter, EntryFormatter entryFormatter)
-
-
Method Detail
-
printInfoLine
void printInfoLine(java.lang.String s)
-
printErrorLine
void printErrorLine(java.lang.String s)
-
printLedgerMetadata
void printLedgerMetadata(long ledgerId, LedgerMetadata md, boolean printMeta)
-
setConf
public void setConf(org.apache.commons.configuration.CompositeConfiguration conf) throws java.lang.Exception
Description copied from interface:Tool
Passe a configuration object to the tool.
-
execute
public int execute(java.lang.String... args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
run
public int run(java.lang.String[] args) throws java.lang.Exception
Description copied from interface:Tool
Exectue the command with given arguments.
-
listFilesAndSort
public static java.util.List<java.io.File> listFilesAndSort(java.io.File[] folderNames, java.lang.String... extensions)
Returns the sorted list of the files in the given folders with the given file extensions. Sorting is done on the basis of CreationTime if the CreationTime is not available or if they are equal then sorting is done by LastModifiedTime- Parameters:
folderNames
- - array of folders which we need to look recursively for files with given extensionsextensions
- - the file extensions, which we are interested in- Returns:
- sorted list of files
-
main
public static void main(java.lang.String[] argv)
-
printEntryLogMetadata
protected void printEntryLogMetadata(long logId) throws java.io.IOException
- Throws:
java.io.IOException
-
-