Class IntegrationTestLoadCommonCrawl
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,org.apache.hadoop.util.Tool
Run like:
./bin/hbase org.apache.hadoop.hbase.test.IntegrationTestLoadCommonCrawl \
-Dfs.s3n.awsAccessKeyId=<AWS access key> \
-Dfs.s3n.awsSecretAccessKey=<AWS secret key> \
/path/to/test-CC-MAIN-2021-10-warc.paths.gz \
/path/to/tmp/warc-loader-output
Access to the Common Crawl dataset in S3 is made available to anyone by Amazon AWS, but Hadoop's S3N filesystem still requires valid access credentials to initialize.
The input path can either specify a directory or a file. The file may optionally be compressed with gzip. If a directory, the loader expects the directory to contain one or more WARC files from the Common Crawl dataset. If a file, the loader expects a list of Hadoop S3N URIs which point to S3 locations for one or more WARC files from the Common Crawl dataset, one URI per line. Lines should be terminated with the UNIX line terminator.
Included in hbase-it/src/test/resources/CC-MAIN-2021-10-warc.paths.gz is a list of all WARC files comprising the Q1 2021 crawl archive. There are 64,000 WARC files in this data set, each containing ~1GB of gzipped data. The WARC files contain several record types, such as metadata, request, and response, but we only load the response record types. If the HBase table schema does not specify compression (by default) there is roughly a 10x expansion. Loading the full crawl archive results in a table approximately 640 TB in size.
The loader can optionally drive read load during ingest by incrementing counters for each URL discovered in content. Add -DIntegrationTestLoadCommonCrawl.increments=true to the command line to enable.
You can also split the Loader and Verify stages:
Load with:
./bin/hbase 'org.apache.hadoop.hbase.test.IntegrationTestLoadCommonCrawl$Loader' \
-files /path/to/hadoop-aws.jar \
-Dfs.s3n.awsAccessKeyId=<AWS access key> \
-Dfs.s3n.awsSecretAccessKey=<AWS secret key> \
/path/to/test-CC-MAIN-2021-10-warc.paths.gz \
/path/to/tmp/warc-loader-output
Note: The hadoop-aws jar will be needed at runtime to instantiate the S3N filesystem. Use the -files ToolRunner argument to add it.
Verify with:
./bin/hbase 'org.apache.hadoop.hbase.test.IntegrationTestLoadCommonCrawl$Verify' \
/path/to/tmp/warc-loader-output
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classstatic classstatic classstatic classNested classes/interfaces inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
org.apache.hadoop.hbase.util.AbstractHBaseTool.OptionsOrderComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[](package private) static final byte[](package private) static final byte[](package private) static final byte[](package private) static final byte[]private static final AtomicLong(package private) static final byte[](package private) static final byte[](package private) static final boolean(package private) static final String(package private) static final String(package private) static final int(package private) static final byte[](package private) static final byte[]private static final org.slf4j.Logger(package private) static final intprotected org.apache.hadoop.fs.Path(package private) static final byte[](package private) static final byte[]private static final int(package private) static final String(package private) static final byte[](package private) static final byte[](package private) static final Patternprotected org.apache.hadoop.fs.PathFields inherited from class org.apache.hadoop.hbase.IntegrationTestBase
CHAOS_MONKEY_PROPS, monkey, MONKEY_LONG_OPT, monkeyProps, monkeyToUse, NO_CLUSTER_CLEANUP_LONG_OPT, noClusterCleanUp, utilFields inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
cmdLineArgs, conf, EXIT_FAILURE, EXIT_SUCCESS, LONG_HELP_OPTION, options, SHORT_HELP_OPTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate static Collection<String>extractUrls(byte[] content) Provides the name of the CFs that are protected from random Chaos monkey activity (alter)private static longorg.apache.hadoop.hbase.TableNameProvides the name of the table that is protected from random Chaos monkey activity(package private) static org.apache.hadoop.hbase.TableNamegetTablename(org.apache.hadoop.conf.Configuration c) static voidprotected voidprocessOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) private static byte[]rowKeyFromTargetURI(String targetUri) intprotected intrunLoader(org.apache.hadoop.fs.Path warcFileInputDir, org.apache.hadoop.fs.Path outputDir) intprotected intrunVerify(org.apache.hadoop.fs.Path inputDir) voidMethods inherited from class org.apache.hadoop.hbase.IntegrationTestBase
addOptions, cleanUp, cleanUpMonkey, cleanUpMonkey, doWork, getConf, getDefaultMonkeyFactory, getTestingUtil, loadMonkeyProperties, processBaseOptions, setUp, setUpMonkey, startMonkeyMethods inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTool
addOption, addOptNoArg, addOptNoArg, addOptWithArg, addOptWithArg, addRequiredOption, addRequiredOptWithArg, addRequiredOptWithArg, doStaticMain, getOptionAsDouble, getOptionAsInt, getOptionAsInt, getOptionAsLong, getOptionAsLong, newParser, parseArgs, parseInt, parseLong, printUsage, printUsage, processOldArgs, setConf
-
Field Details
-
LOG
-
TABLE_NAME_KEY
- See Also:
-
DEFAULT_TABLE_NAME
- See Also:
-
INCREMENTS_NAME_KEY
- See Also:
-
DEFAULT_INCREMENTS
- See Also:
-
MAX_INFLIGHT
- See Also:
-
INFLIGHT_PAUSE_MS
- See Also:
-
CONTENT_FAMILY_NAME
-
INFO_FAMILY_NAME
-
URL_FAMILY_NAME
-
SEP
-
CONTENT_QUALIFIER
-
CONTENT_LENGTH_QUALIFIER
-
CONTENT_TYPE_QUALIFIER
-
CRC_QUALIFIER
-
DATE_QUALIFIER
-
IP_ADDRESS_QUALIFIER
-
TARGET_URI_QUALIFIER
-
REF_QUALIFIER
-
warcFileInputDir
-
outputDir
-
args
-
counter
-
shift
- See Also:
-
URL_PATTERN
-
-
Constructor Details
-
IntegrationTestLoadCommonCrawl
public IntegrationTestLoadCommonCrawl()
-
-
Method Details
-
runLoader
protected int runLoader(org.apache.hadoop.fs.Path warcFileInputDir, org.apache.hadoop.fs.Path outputDir) throws Exception - Throws:
Exception
-
runVerify
- Throws:
Exception
-
run
- Specified by:
runin interfaceorg.apache.hadoop.util.Tool- Overrides:
runin classorg.apache.hadoop.hbase.util.AbstractHBaseTool
-
processOptions
- Overrides:
processOptionsin classIntegrationTestBase
-
setUpCluster
- Specified by:
setUpClusterin classIntegrationTestBase- Throws:
Exception
-
cleanUpCluster
- Overrides:
cleanUpClusterin classIntegrationTestBase- Throws:
Exception
-
getTablename
-
getTablename
Description copied from class:IntegrationTestBaseProvides the name of the table that is protected from random Chaos monkey activity- Specified by:
getTablenamein classIntegrationTestBase- Returns:
- table to not delete.
-
getColumnFamilies
Description copied from class:IntegrationTestBaseProvides the name of the CFs that are protected from random Chaos monkey activity (alter)- Specified by:
getColumnFamiliesin classIntegrationTestBase- Returns:
- set of cf names to protect.
-
runTestFromCommandLine
- Specified by:
runTestFromCommandLinein classIntegrationTestBase- Throws:
Exception
-
main
- Throws:
Exception
-
getSequence
-
rowKeyFromTargetURI
private static byte[] rowKeyFromTargetURI(String targetUri) throws IOException, URISyntaxException, IllegalArgumentException -
extractUrls
-