The replication factor of a file in HDFS can be changed usin code example
Example 1: change replication factor hadoop cluster command
hdfs dfs –setrep –w 3 /user/hdfs/file.txt
Example 2: change replication factor hadoop cluster command
-D dfs.replication=1