备考Cloudera认证:如何获取Sqoop导入的压缩编解码器信息?
Hey there! I totally get the struggle of memorizing those fully qualified codec class names for Cloudera exams—they’re easy to mix up, especially when you can’t just look them up on the fly. Let’s break down how you can find this info right in your Cloudera Quickstart VM, no external tools needed:
The core-site.xml configuration file is where Hadoop lists all globally registered compression codecs. You can quickly extract this info with a simple command:
cat /etc/hadoop/conf/core-site.xml | grep -A 5 -B 5 hadoop.io.compression.codecs
This will pull up the <property> block for hadoop.io.compression.codecs, which includes a comma-separated list of full class names—you’ll definitely see org.apache.hadoop.io.compress.SnappyCodec here alongside others like Gzip and Bzip2.
Hadoop has native commands that directly list supported codecs, perfect for quick checks during practice sessions:
- Run this to see native compression support and their corresponding Java classes:
hadoop checknative -a - Or use the CompressionCodecFactory class to print all registered codecs:
hadoop org.apache.hadoop.io.compress.CompressionCodecFactory
Both commands will output the full class names you need, no internet required.
Your Cloudera Quickstart VM includes offline Sqoop docs right on the machine. Head to the Sqoop installation directory (usually /usr/lib/sqoop), then navigate to the docs folder. Open the HTML files there and search for terms like "compression" or "codec"—you’ll find official lists of supported codecs with their full class names straight from Cloudera’s docs.
Since exams tend to focus on the most commonly used codecs, a quick trick can help lock them in:
- All Hadoop-native codecs live under the
org.apache.hadoop.io.compress.*package:- Snappy:
org.apache.hadoop.io.compress.SnappyCodec - Gzip:
org.apache.hadoop.io.compress.GzipCodec - Bzip2:
org.apache.hadoop.io.compress.BZip2Codec
- Snappy:
- The exception is LZO, which uses a third-party package:
com.hadoop.compression.lzo.LzopCodec
Sticking to this pattern means you only need to remember the package structure plus the codec name, which is way easier than memorizing the full string every time.
内容的提问来源于stack exchange,提问作者Ravi

