Hadoop3.2.4纠删码基础操作(二)

耀灵1年前技术文章757


1、纠删码基础操作

纠删码策略是与具体的路径(path)相关联的。也就是说,如果我们要使用纠删码,则要给一个具体的路径设置纠删码策略,后续,所有往此目录下存储的文件,都会执行此策略。

1.首先我们在HDFS中建立一个目录。

1.png

2.使用命令获取该目录的纠删码策略,提示未指定,说明新建目录不会被默认增加纠删码策略属性。

[root@hd2 hadoop]# hdfs ec -getPolicy -path /ec_xor

2.png

3.我们先启用XOR-2-1-1024k策略。

[root@hd2 hadoop]# hdfs ec -enablePolicy -policy XOR-2-1-1024k
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.4/share/hadoop/common/lib/slf4j-reload4j-1.7.35.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-tez-0.10.2-bin/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
Erasure coding policy XOR-2-1-1024k is enabled

3.png



4.给目录设置纠删码策略

[root@hd2 hadoop]# hdfs ec -setPolicy -path /ec_xor -policy XOR-2-1-1024k
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.4/share/hadoop/common/lib/slf4j-reload4j-1.7.35.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-tez-0.10.2-bin/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
Set XOR-2-1-1024k erasure coding policy on /ec_xor
[root@hd2 hadoop]#

4.png

[root@hd2 hadoop]# hdfs ec -getPolicy -path /ec_xor

5.png

5.这里再测试一下给目录设置另外一些没启用的纠删码策略

[root@hd2 hadoop]# hdfs ec -setPolicy -path /ec_xor -policy RS-10-4-1024k
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.4/share/hadoop/common/lib/slf4j-reload4j-1.7.35.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-tez-0.10.2-bin/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
RemoteException: Policy 'RS-10-4-1024k' does not match any enabled erasure coding policies: [RS-3-2-1024k, XOR-2-1-1024k]. An erasure coding policy can be enabled by enableErasureCodingPolicy API.

6.png

报错,说明在使用某个纠删码策略是,需要先启用。

6.我们启用策略RS-6-3-1024k,然后再给/ec_xor目录set策略。同时往这个目录写入数据。

[root@hd2 hadoop]# hdfs ec -enablePolicy -policy RS-6-3-1024k
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.4/share/hadoop/common/lib/slf4j-reload4j-1.7.35.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-tez-0.10.2-bin/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
Erasure coding policy RS-6-3-1024k is enabled

7.png

[root@hd2 hadoop]# hdfs ec -setPolicy -path /ec_xor -policy RS-6-3-1024k
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.4/share/hadoop/common/lib/slf4j-reload4j-1.7.35.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-tez-0.10.2-bin/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
Set RS-6-3-1024k erasure coding policy on /ec_xor

8.png

[root@hd2 mnt]# hadoop fs -put ec_test.txt /ec_xor
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-3.2.4/share/hadoop/common/lib/slf4j-reload4j-1.7.35.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-tez-0.10.2-bin/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
put: File /ec_xor/ec_test.txt._COPYING_ could only be written to 3 of the 6 required nodes for RS-6-3-1024k. There are 3 datanode(s) running and 3 node(s) are excluded in this operation.
[root@hd2 mnt]#

9.png

发现启用纠删码策略,设置目录策略都可以成功,但是在往目录丢数据的时候会报错,这是因为RS(6,3)策略需要6份原始数据,3份校验校验,至少需要9台DataNode,但是测试环境只有3个数据节点。所以接下来会基于XOR-2-1-1024k策略来进行实操,因为XOR(2,1)只需要2份原始数据,1份校验数据,3台DataNode可以进行操作。


相关文章

Ldap高可用部署

Ldap配置高可用两个节点上均执行mkdir /data/ldapcd /data/ldap1.1. 添加mod_syncprov.ldif文件vi mod_syncprov.ldif 内容如下:ob...

阿里云ES跨账号数据迁移(reindex)

阿里云ES跨账号数据迁移(reindex)

1、背景与前置条件总的来说,阿里云es集群间数据迁移,有三中方式,logstash、reindex、镜像备份恢复,分别使用不同的场景,本文档主要讨论reindex方式进行账号下,ES跨集群迁移时,使用...

 大数据集群监控配置操作指导(四)Spark监控使用jmx

大数据集群监控配置操作指导(四)Spark监控使用jmx

graphite_exporter方式Graphite 来收集度量标准,Grafana 则用于构建仪表板,首先,需要配置 Spark 以将 metrics 报告到 Graphite。prometheu...

使用helm在k8s集群部署rancher

使用helm在k8s集群部署rancher由于我们的k8s版本是1.22,所以我们直接安装latest版本的rancher。不同版本的rancher helm仓库可以看下面链接https://docs...

mysql双主更改为主从架构分析

mysql双主更改为主从架构分析

客户需求客户业务运行的在mysql双主架构上,因为客户经常误操作触发双写,导致数据不一致,对业务的稳定运行造成加大的影响。客户现有数据库架构图解决方案基于客户业务和底层数据库架构实际情况,云掣科技提供...

MySQL 使用开源审计插件

MySQL 使用开源审计插件

前言MySQL 只有企业版有审计插件,开源社区版没有审计插件。企业要通过等保需要开通审计,这里记录使用 MariaDB 开源审计插件,让 MySQL 社区版拥有审计功能。1. 审计插件下载审计插件是包...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。