Output from a mapreduce job can be compressed by setting the below two properties in mapred-site.xml configurations.
mapreduce.output.compress property to true
mapred.output.compression.codec property to the classname of the compression codec we want to use Alternatively we can set these properties at job level as well with the help of static methods on FileOutputFormat class.
FileOutputFormat.setCompressOutput(job, true);
FileOutputFormat.setOutputCompressorClass(job, GzipCodec.class);