@InterfaceAudience.Public @InterfaceStability.Evolving public class ExportSnapshot extends org.apache.hadoop.conf.Configured implements org.apache.hadoop.util.Tool
Modifier and Type | Class and Description |
---|---|
static class |
ExportSnapshot.Counter |
private static class |
ExportSnapshot.ExportMapper |
private static class |
ExportSnapshot.ExportSnapshotInputFormat |
Modifier and Type | Field and Description |
---|---|
private static String |
CONF_BANDWIDTH_MB |
private static String |
CONF_BUFFER_SIZE |
private static String |
CONF_CHECKSUM_VERIFY |
static String |
CONF_DEST_PREFIX
Configuration prefix for overrides for the destination filesystem
|
private static String |
CONF_FILES_GROUP |
private static String |
CONF_FILES_MODE |
private static String |
CONF_FILES_USER |
private static String |
CONF_INPUT_ROOT |
private static String |
CONF_MAP_GROUP |
private static String |
CONF_NUM_SPLITS |
private static String |
CONF_OUTPUT_ROOT |
protected static String |
CONF_SKIP_TMP |
private static String |
CONF_SNAPSHOT_DIR |
private static String |
CONF_SNAPSHOT_NAME |
static String |
CONF_SOURCE_PREFIX
Configuration prefix for overrides for the source filesystem
|
(package private) static String |
CONF_TEST_FAILURE |
(package private) static String |
CONF_TEST_RETRY |
private static String |
INPUT_FOLDER_PREFIX |
private static org.apache.commons.logging.Log |
LOG |
private static String |
MR_NUM_MAPS |
static String |
NAME |
Constructor and Description |
---|
ExportSnapshot() |
Modifier and Type | Method and Description |
---|---|
(package private) static List<List<Pair<org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotFileInfo,Long>>> |
getBalancedSplits(List<Pair<org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotFileInfo,Long>> files,
int ngroups)
Given a list of file paths and sizes, create around ngroups in as balanced a way as possible.
|
private static List<Pair<org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotFileInfo,Long>> |
getSnapshotFiles(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path snapshotDir)
Extract the list of files (HFiles/WALs) to copy using Map-Reduce.
|
(package private) static int |
innerMain(org.apache.hadoop.conf.Configuration conf,
String[] args)
The guts of the
main(java.lang.String[]) method. |
static void |
main(String[] args) |
private void |
printUsageAndExit() |
int |
run(String[] args)
Execute the export snapshot by copying the snapshot metadata, hfiles and wals.
|
private void |
runCopyJob(org.apache.hadoop.fs.Path inputRoot,
org.apache.hadoop.fs.Path outputRoot,
String snapshotName,
org.apache.hadoop.fs.Path snapshotDir,
boolean verifyChecksum,
String filesUser,
String filesGroup,
int filesMode,
int mappers,
int bandwidthMB)
Run Map-Reduce Job to perform the files copy.
|
private void |
setOwner(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
String user,
String group,
boolean recursive)
Set path ownership.
|
private void |
setPermission(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
short filesMode,
boolean recursive)
Set path permission.
|
private void |
verifySnapshot(org.apache.hadoop.conf.Configuration baseConf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootDir,
org.apache.hadoop.fs.Path snapshotDir) |
public static final String NAME
public static final String CONF_SOURCE_PREFIX
public static final String CONF_DEST_PREFIX
private static final org.apache.commons.logging.Log LOG
private static final String MR_NUM_MAPS
private static final String CONF_NUM_SPLITS
private static final String CONF_SNAPSHOT_NAME
private static final String CONF_SNAPSHOT_DIR
private static final String CONF_FILES_USER
private static final String CONF_FILES_GROUP
private static final String CONF_FILES_MODE
private static final String CONF_CHECKSUM_VERIFY
private static final String CONF_OUTPUT_ROOT
private static final String CONF_INPUT_ROOT
private static final String CONF_BUFFER_SIZE
private static final String CONF_MAP_GROUP
private static final String CONF_BANDWIDTH_MB
protected static final String CONF_SKIP_TMP
static final String CONF_TEST_FAILURE
static final String CONF_TEST_RETRY
private static final String INPUT_FOLDER_PREFIX
private static List<Pair<org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotFileInfo,Long>> getSnapshotFiles(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path snapshotDir) throws IOException
IOException
static List<List<Pair<org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotFileInfo,Long>>> getBalancedSplits(List<Pair<org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotFileInfo,Long>> files, int ngroups)
The algorithm used is pretty straightforward; the file list is sorted by size, and then each group fetch the bigger file available, iterating through groups alternating the direction.
private void runCopyJob(org.apache.hadoop.fs.Path inputRoot, org.apache.hadoop.fs.Path outputRoot, String snapshotName, org.apache.hadoop.fs.Path snapshotDir, boolean verifyChecksum, String filesUser, String filesGroup, int filesMode, int mappers, int bandwidthMB) throws IOException, InterruptedException, ClassNotFoundException
private void verifySnapshot(org.apache.hadoop.conf.Configuration baseConf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path snapshotDir) throws IOException
IOException
private void setOwner(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, String user, String group, boolean recursive) throws IOException
IOException
private void setPermission(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, short filesMode, boolean recursive) throws IOException
IOException
public int run(String[] args) throws IOException
run
in interface org.apache.hadoop.util.Tool
IOException
private void printUsageAndExit()
static int innerMain(org.apache.hadoop.conf.Configuration conf, String[] args) throws Exception
main(java.lang.String[])
method.
Call this method to avoid the main(String[])
System.exit.args
- Exception
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.