设为首页 收藏本站
查看: 699|回复: 0

[经验分享] Hadoop读书笔记2 - Hadoop I/O

[复制链接]

尚未签到

发表于 2018-10-31 11:42:53 | 显示全部楼层 |阅读模式
  Chapter 4 Hadoop I/O
1) Integrity
HDFS transparently checksums all data written to it and by default verifies checksums when reading data.The default is 512 bytes, and because a CRC-32 checksum is 4 bytes long, the storage overhead is less than 1%. Datanodes are responsible for verifying the data they receive before storing the data and its checksum. Each datanode keeps a persistent log of checksum verifications. Each datanode runs a DataBlockScanner in a background thread that periodically verifies all the blocks stored on the datanode.
  FileSystem fs = new RawLocalFileSystem();// don't checksum
FileSystem checksummedFs = new ChecksumFileSystem(rawFs);//do checksum
  2) Compression
File compression brings two major benefits: it reduces the space needed to store files,and it speeds up data transfer across the network or to or from disk.A codec is the implementation of a compression-decompression algorithm.
To compress data being written to an output stream, use the createOutput Stream(OutputStream out)method to create a CompressionOutputStreamto which you write your uncompressed data to have it written in compressed form to the underlying stream. Conversely, to decompress data being read from an input stream, call createInputStream(InputStream in)to obtain a CompressionInputStream, which allows you to read uncompressed data from the underlying stream.
For performance, it is preferable to use a native library for compression and decompression.
  If you are using a native library and you are doing a lot of compression or decompression in your application, consider using CodecPool, which allows you to reuse compressors and decompressors, thereby amortizing the cost of creating these objects.
  When considering how to compress data that will be processed by MapReduce, it is important to understand whether the compression format supports splitting.
  3) Serialization
Serializationis the process of turning structured objects into a byte stream for transmission over a network or for writing to persistent storage. Deserializationis the reverse process of turning a byte stream back into a series of structured objects.
Serialization appears in two quite distinct areas of distributed data processing: for interprocess communication and for persistent storage.
  Hadoop uses its own serialization format, Writables, which is certainly compact and fast, but not so easy to extend or use from languages other than Java.
  4) Serialization Frameworks
Although most MapReduce programs use Writablekey and value types, this isn’t mandated by the MapReduce API.
  Apache Avro is a language-neutral data serialization system. The project was created to address the major downside of Hadoop Writables: lack of language portability. Having a data format that can be processed by many languages (currently C, C++, C#, Java, PHP, Python, and Ruby) makes it easier to share datasets with a wider audience than one tied to a single language.


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-628930-1-1.html 上篇帖子: Hadoop读书笔记1-Meet Hadoop & Hadoop Filesystem 下篇帖子: Hadoop PriviledgedActionException: Failed to set permissions 解决办法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表