hdfs复制文件_如何更改HDFS中某些文件的复制数量?

hdfs复制文件

The HDFS has a configuration in hdfs-site.xml to set the global replication number of blocks with the “dfs.replication” property.

HDFS在hdfs-site.xml中进行配置,以使用“ dfs.replication”属性设置块的全局复制数。

However, there are some “hot” files that are access by many nodes. How to increase the number of blocks for these certain files in HDFS?

但是,有些“热” 文件可供许多节点访问。 如何增加HDFS中这些特定文件的块数?

You can the replication number of certain file to 10:

您可以将某些文件的复制号设置为10:

hdfs dfs -setrep -w 10 /path/to/file

You can also recursively set the files under a directory by:

您还可以通过以下方式递归设置目录下的文件:

hdfs dfs -setrep -R -w 10 /path/to/dir/
Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。


setrep

setrep

Usage: hdfs dfs -setrep [-R] [-w] <numReplicas> <path>

Changes the replication factor of a file. If path is a directory then the command recursively changes the replication factor of all files under the directory tree rooted at path.

更改文件的复制因子。 如果path是目录,则该命令以递归方式更改以root为根的目录树下所有文件的复制因子。

Options:

选项:

The -w flag requests that the command wait for the replication to complete. This can potentially take a very long time.
The -R flag is accepted for backwards compatibility. It has no effect.

-w标志请求命令等待复制完成。 这可能会花费很长时间。
接受-R标志是为了向后兼容。 没有作用。

Example:

例:

hdfs dfs -setrep -w 3 /user/hadoop/dir1

Exit Code:

退出代码:

Returns 0 on success and -1 on error.

成功返回0, 错误返回-1。

翻译自: https://www.systutorials.com/how-to-change-number-of-replications-of-certain-files-in-hdfs/

hdfs复制文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值