1、在hdfs-site.xml文件配置多目录添加如下配置
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///hd1/dfs/data1,file:///hd2/dfs/data2,file:///hd3/dfs/data3</value>
</property>
2、保证每个目录数据均衡
(1)开启数据均衡命令
sbin/start-balancer.sh -threshould 10
参数10,表示集群中各个节点的磁盘空间利用率相差不超过10%。
(2)停止均衡器
sbin/stop-balancer.sh