@Deprecated @InterfaceAudience.LimitedPrivate(value="Tools") @InterfaceStability.Evolving public class HBaseFsck extends org.apache.hadoop.conf.Configured implements Closeable
Region consistency checks verify that hbase:meta, region deployment on region servers and the state of data in HDFS (.regioninfo files) all are in accordance.
Table integrity checks verify that all possible row keys resolve to exactly one region of a table. This means there are no individual degenerate or backwards regions; no holes between regions; and that there are no overlapping regions.
The general repair strategy works in two phases:
For table integrity repairs, the tables' region directories are scanned for .regioninfo files. Each table's integrity is then verified. If there are any orphan regions (regions with no .regioninfo files) or holes, new regions are fabricated. Backwards regions are sidelined as well as empty degenerate (endkey==startkey) regions. If there are any overlapping regions, a new region is created and all data is merged into the new region.
Table integrity repairs deal solely with HDFS and could potentially be done offline -- the hbase region servers or master do not need to be running. This phase can eventually be used to completely reconstruct the hbase:meta table in an offline fashion.
Region consistency requires three conditions -- 1) valid .regioninfo file present in an HDFS region dir, 2) valid row with .regioninfo data in META, and 3) a region is deployed only at the regionserver that was assigned to with proper state in the master.
Region consistency repairs require hbase to be online so that hbck can contact the HBase master and region servers. The hbck#connect() method must first be called successfully. Much of the region consistency information is transient and less risky to repair.
If hbck is run from the command line, there are a handful of arguments that
can be used to limit the kinds of repairs hbck will do. See the code in
printUsageAndExit() for more details.
| 限定符和类型 | 字段和说明 |
|---|---|
static long |
DEFAULT_SLEEP_BEFORE_RERUN
已过时。
|
static long |
DEFAULT_TIME_LAG
已过时。
|
protected ExecutorService |
executor
已过时。
|
static String |
HBCK_LOCK_FILE
已过时。
Here is where hbase-1.x used to default the lock for hbck1.
|
| 构造器和说明 |
|---|
HBaseFsck(org.apache.hadoop.conf.Configuration conf)
已过时。
Constructor
|
HBaseFsck(org.apache.hadoop.conf.Configuration conf,
ExecutorService exec)
已过时。
Constructor
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.FSDataOutputStream> |
checkAndMarkRunningHbck(org.apache.hadoop.conf.Configuration conf,
RetryCounter retryCounter)
已过时。
This method maintains a lock using a file.
|
void |
checkRegionBoundaries()
已过时。
|
void |
cleanReplicationBarrier()
已过时。
|
void |
close()
已过时。
|
void |
connect()
已过时。
To repair region consistency, one must call connect() in order to repair
online state.
|
protected HFileCorruptionChecker |
createHFileCorruptionChecker(boolean sidelineCorruptHFiles)
已过时。
|
static RetryCounterFactory |
createLockRetryCounterFactory(org.apache.hadoop.conf.Configuration conf)
已过时。
|
static void |
debugLsr(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p)
已过时。
ls -r for debugging purposes
|
static void |
debugLsr(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p,
HbckErrorReporter errors)
已过时。
ls -r for debugging purposes
|
HBaseFsck |
exec(ExecutorService exec,
String[] args)
已过时。
|
void |
fixEmptyMetaCells()
已过时。
To fix the empty REGIONINFO_QUALIFIER rows from hbase:meta
|
void |
fixOrphanTables()
已过时。
To fix orphan table by creating a .tableinfo file under tableDir
1. if TableInfo is cached, to recover the .tableinfo accordingly 2. else create a default .tableinfo file with following items 2.1 the correct tablename 2.2 the correct colfamily list 2.3 the default properties for both TableDescriptor and ColumnFamilyDescriptor |
HbckErrorReporter |
getErrors()
已过时。
|
HFileCorruptionChecker |
getHFilecorruptionChecker()
已过时。
|
int |
getMaxMerge()
已过时。
|
int |
getMaxOverlapsToSideline()
已过时。
|
int |
getRetCode()
已过时。
|
static org.apache.hadoop.fs.Path |
getTmpDir(org.apache.hadoop.conf.Configuration conf)
已过时。
|
void |
includeTable(TableName table)
已过时。
|
boolean |
isExclusive()
已过时。
Only one instance of hbck can modify HBase at a time.
|
static byte[] |
keyOnly(byte[] b)
已过时。
|
void |
loadHdfsRegionDirs()
已过时。
Scan HDFS for all regions, recording their information into
regionInfoMap
|
static void |
main(String[] args)
已过时。
Main program
|
int |
mergeRegionDirs(org.apache.hadoop.fs.Path targetRegionDir,
HbckRegionInfo contained)
已过时。
Merge hdfs data by moving from contained HbckRegionInfo into targetRegionDir.
|
void |
offlineHdfsIntegrityRepair()
已过时。
This repair method analyzes hbase data in hdfs and repairs it to satisfy
the table integrity rules.
|
int |
onlineConsistencyRepair()
已过时。
This repair method requires the cluster to be online since it contacts
region servers and the masters.
|
int |
onlineHbck()
已过时。
Contacts the master and prints out cluster-wide information
|
protected HBaseFsck |
printUsageAndExit()
已过时。
|
void |
setCheckHdfs(boolean checking)
已过时。
|
void |
setCleanReplicationBarrier(boolean shouldClean)
已过时。
|
void |
setCleanReplicationBarrierTable(String cleanReplicationBarrierTable)
已过时。
|
static void |
setDisplayFullReport()
已过时。
Display the full report from fsck.
|
void |
setFixAssignments(boolean shouldFix)
已过时。
Fix inconsistencies found by fsck.
|
void |
setFixEmptyMetaCells(boolean shouldFix)
已过时。
|
void |
setFixHdfsHoles(boolean shouldFix)
已过时。
|
void |
setFixHdfsOrphans(boolean shouldFix)
已过时。
|
void |
setFixHdfsOverlaps(boolean shouldFix)
已过时。
|
void |
setFixHFileLinks(boolean shouldFix)
已过时。
|
void |
setFixMeta(boolean shouldFix)
已过时。
|
void |
setFixReferenceFiles(boolean shouldFix)
已过时。
|
void |
setFixReplication(boolean shouldFix)
已过时。
Set replication fix mode.
|
void |
setFixSplitParents(boolean shouldFix)
已过时。
|
void |
setFixTableOrphans(boolean shouldFix)
已过时。
|
void |
setFixVersionFile(boolean shouldFix)
已过时。
|
static void |
setForceExclusive()
已过时。
Set exclusive mode.
|
void |
setHFileCorruptionChecker(HFileCorruptionChecker hfcc)
已过时。
|
void |
setIgnorePreCheckPermission(boolean ignorePreCheckPermission)
已过时。
|
void |
setMaxMerge(int mm)
已过时。
|
void |
setMaxOverlapsToSideline(int mo)
已过时。
|
void |
setRemoveParents(boolean shouldFix)
已过时。
|
void |
setRetCode(int code)
已过时。
|
void |
setSidelineBigOverlaps(boolean sbo)
已过时。
|
void |
setSidelineDir(String sidelineDir)
已过时。
|
void |
setTimeLag(long seconds)
已过时。
We are interested in only those tables that have not changed their state in
hbase:meta during the last few seconds specified by hbase.admin.fsck.timelag
|
static boolean |
shouldDisplayFullReport()
已过时。
|
boolean |
shouldFixVersionFile()
已过时。
|
boolean |
shouldIgnorePreCheckPermission()
已过时。
|
boolean |
shouldRerun()
已过时。
|
boolean |
shouldSidelineBigOverlaps()
已过时。
|
public static final long DEFAULT_TIME_LAG
public static final long DEFAULT_SLEEP_BEFORE_RERUN
public static final String HBCK_LOCK_FILE
protected ExecutorService executor
public HBaseFsck(org.apache.hadoop.conf.Configuration conf)
throws IOException,
ClassNotFoundException
conf - Configuration objectMasterNotRunningException - if the master is not runningZooKeeperConnectionException - if unable to connect to ZooKeeperIOExceptionClassNotFoundExceptionpublic HBaseFsck(org.apache.hadoop.conf.Configuration conf,
ExecutorService exec)
throws MasterNotRunningException,
ZooKeeperConnectionException,
IOException,
ClassNotFoundException
conf - Configuration objectMasterNotRunningException - if the master is not runningZooKeeperConnectionException - if unable to connect to ZooKeeperIOExceptionClassNotFoundExceptionpublic static RetryCounterFactory createLockRetryCounterFactory(org.apache.hadoop.conf.Configuration conf)
public static org.apache.hadoop.fs.Path getTmpDir(org.apache.hadoop.conf.Configuration conf)
throws IOException
IOExceptionpublic static Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.FSDataOutputStream> checkAndMarkRunningHbck(org.apache.hadoop.conf.Configuration conf, RetryCounter retryCounter) throws IOException
IOException - if IO failure occurspublic void connect()
throws IOException
IOExceptionpublic void offlineHdfsIntegrityRepair()
throws IOException,
InterruptedException
public int onlineConsistencyRepair()
throws IOException,
org.apache.zookeeper.KeeperException,
InterruptedException
IOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic int onlineHbck()
throws IOException,
org.apache.zookeeper.KeeperException,
InterruptedException,
ReplicationException
IOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionReplicationExceptionpublic static byte[] keyOnly(byte[] b)
public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionpublic void checkRegionBoundaries()
public HbckErrorReporter getErrors()
public void fixEmptyMetaCells()
throws IOException
IOExceptionpublic void fixOrphanTables()
throws IOException
TableDescriptor and ColumnFamilyDescriptorIOExceptionpublic void loadHdfsRegionDirs()
throws IOException,
InterruptedException
public int mergeRegionDirs(org.apache.hadoop.fs.Path targetRegionDir,
HbckRegionInfo contained)
throws IOException
IOExceptionpublic static void setDisplayFullReport()
public static boolean shouldDisplayFullReport()
public static void setForceExclusive()
public boolean isExclusive()
public void setFixReplication(boolean shouldFix)
public void setCleanReplicationBarrier(boolean shouldClean)
public boolean shouldRerun()
public void setFixAssignments(boolean shouldFix)
public void setFixMeta(boolean shouldFix)
public void setFixEmptyMetaCells(boolean shouldFix)
public void setCheckHdfs(boolean checking)
public void setFixHdfsHoles(boolean shouldFix)
public void setFixTableOrphans(boolean shouldFix)
public void setFixHdfsOverlaps(boolean shouldFix)
public void setFixHdfsOrphans(boolean shouldFix)
public void setFixVersionFile(boolean shouldFix)
public boolean shouldFixVersionFile()
public void setSidelineBigOverlaps(boolean sbo)
public boolean shouldSidelineBigOverlaps()
public void setFixSplitParents(boolean shouldFix)
public void setRemoveParents(boolean shouldFix)
public void setFixReferenceFiles(boolean shouldFix)
public void setFixHFileLinks(boolean shouldFix)
public boolean shouldIgnorePreCheckPermission()
public void setIgnorePreCheckPermission(boolean ignorePreCheckPermission)
public void setMaxMerge(int mm)
mm - maximum number of regions to merge into a single region.public int getMaxMerge()
public void setMaxOverlapsToSideline(int mo)
public int getMaxOverlapsToSideline()
public void includeTable(TableName table)
public void setTimeLag(long seconds)
seconds - - the time in secondspublic void setSidelineDir(String sidelineDir)
sidelineDir - - HDFS path to sideline dataprotected HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException
IOExceptionpublic HFileCorruptionChecker getHFilecorruptionChecker()
public void setHFileCorruptionChecker(HFileCorruptionChecker hfcc)
public void setRetCode(int code)
public int getRetCode()
protected HBaseFsck printUsageAndExit()
public static void main(String[] args) throws Exception
args - Exceptionpublic HBaseFsck exec(ExecutorService exec, String[] args) throws org.apache.zookeeper.KeeperException, IOException, InterruptedException, ReplicationException
org.apache.zookeeper.KeeperExceptionIOExceptionInterruptedExceptionReplicationExceptionpublic void setCleanReplicationBarrierTable(String cleanReplicationBarrierTable)
public void cleanReplicationBarrier()
throws IOException
IOExceptionpublic static void debugLsr(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p)
throws IOException
IOExceptionpublic static void debugLsr(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p,
HbckErrorReporter errors)
throws IOException
IOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.