[hadoop@hadoop1 ~]$ hadoop fs -setfattr -n name -v value /xattr
2020-03-10 10:52:16,636 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
-setfattr: An XAttr name must be prefixed with user/trusted/security/system/raw, followed by a '.'
設置屬性必須要有前綴。
給/xattr目錄設置一個k-v屬性。
設置屬性:
[hadoop@hadoop1 ~]$ hadoop fs -setfattr -n user.xattr_test_key -v xattr_test_value /xattr
查看/xattr的屬性:
[hadoop@hadoop1 ~]$ hadoop fs -getfattr -n user.xattr_test_key /xattr
2020-03-10 11:05:07,500 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
# file: /xattr
user.xattr_test_key="xattr_test_value"
新建子目錄再查看:
[hadoop@hadoop1 ~]$ hadoop fs -getfattr -n user.xattr_test_key /xattr/a
2020-03-10 11:43:51,824 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
# file: /xattr/a
getfattr: At least one of the attributes provided was not found.
顯示子目錄沒有發現有這個屬性的。