How to change it? What will happen after it is changed?
For example, I change from 2 to 3. Will HDFS automatically re-replicate the data chunks?
First, the replication factor is client decided.
Second, the replication factor is per-file configuration.
Hence, the configuration only changes the client and takes effect for new files.
For existing files, you need to manually re-set the replication factor: