hdfs 复制因子 修改
Is it possible to set the replication factor for specific directory in HDFS to be one that is different from the default replication factor? This should set the existing files’ replication factors but also new files created in the specific directory.
是否可以将HDFS中特定目录的复制因子设置为与默认复制因子不同的复制因子? 这应设置现有文件的复制因子,还应设置在特定目录中创建的新文件。
This can simplify the administration. We can set the replication factor of /tmp/ to 2 and all new files and sub directories’ replication factors are 2 by default.
这样可以简化管理。 我们可以将/ tmp /的复制因子设置为2,默认情况下,所有新文件和子目录的复制因子为2。
There is a feature request but the feature is not yet available: https://issues.apache.org/jira/browse/HDFS-199
有一个功能请求,但该功能尚不可用: https : //issues.apache.org/jira/browse/HDFS-199
So, if all files in a dir like “/tmp/” are set to 2 replicas while the default is 3, the new files created in /tmp/ will still have 3 replicas.
因此,如果目录中的所有文件(如“ / tmp /”)均设置为2个副本,而默认值为3,则在/ tmp /中创建的新文件仍将具有3个副本。
To achieve the similar effect, you may need a daemon script to set the replication factors continuously like
为了达到类似的效果,您可能需要一个守护程序脚本来连续设置复制因子,例如
while true; do
hdfs dfs -setrep -w 2 /tmp/
sleep 30
done
翻译自: https://www.systutorials.com/how-to-set-replication-factors-for-hdfs-directories/
hdfs 复制因子 修改