Created 10-26-2015 05:24 PM
According to the Apache and our own documentation, I would use the hdfs dfsadmin -setStoragePolicy and -getStoragePolicy commands to configure and use HDFS storage types and policies. However, on my HDP 2.3.0 cluster, installed using Ambari 2.1.1, the hdfs dfsadmin command does not have the -getStoragePolicy and -setStoragPolicy commands. So I do I configure storage types and policies?
Created 10-26-2015 05:28 PM
I think the command has changed, its not hdfs dfsadmin anymore
Try this:
Set a storage policy to a file or a directory.
hdfs storagepolicies -setStoragePolicy -path <path> -policy <policy>
Get the storage policy of a file or a directory.
hdfs storagepolicies -getStoragePolicy -path <path>
Created 10-26-2015 05:28 PM
I think the command has changed, its not hdfs dfsadmin anymore
Try this:
Set a storage policy to a file or a directory.
hdfs storagepolicies -setStoragePolicy -path <path> -policy <policy>
Get the storage policy of a file or a directory.
hdfs storagepolicies -getStoragePolicy -path <path>
Created on 06-16-2016 10:21 AM - edited 08-19-2019 05:55 AM
Following steps working for me:
#mkdir /hadoop/hdfs/data1 /hadoop/hdfs/data2 /hadoop/hdfs/data3
#chown hdfs:hadoop /hadoop/hdfs/data1 /hadoop/hdfs/data2 /hadoop/hdfs/data3
(**We are using the configuration for test purpose only, so no disks are mounted.)
Restart hdfs hdfs service.
Restart all other afftected services.
Create a directory /cold
# su hdfs
[hdfs@hdp-qa2-n1 ~]$ hadoop fs -mkdir /cold
Set COLD storage policy on /cold
[hdfs@hdp-qa2-n1 ~]$ hdfs storagepolicies -setStoragePolicy -path /cold -policy COLD
Set storage policy COLD on /cold
5. Run get storage policy:
[hdfs@hdp-qa2-n1 ~]$ hdfs storagepolicies -getStoragePolicy -path /cold
The storage policy of /cold:
BlockStoragePolicy{COLD:2, storageTypes=[ARCHIVE], creationFallbacks=[], replicationFallbacks=[]}