1、报错如下
File /hello.txt could only be replicated to 0 nodes instead of minReplication (=1). There are 1 datanode(s) running and 1 node(s) are excluded in this operation.
报错 有一个数据节点运行,但是不能被选中,数据节点启动用的局域网
打开hdfs页面
2、节点名为 localhost,在客户端需要使用localhost连接
如下
this.uri = new URI("hdfs://localhost:8020");
3、使用这种方式还需要配置,读取hostname作为连接
configuration.set("dfs.client.use.datanode.hostname","true");
整体代码截图
4、编辑hosts文件
vi /etc/hosts
添加内容如下
5、hive报错
Caused by: java.io.IOException: Exceeded MAX_FAILED_UNIQUE_FETCHES; bailing-out.
at org.apache.hadoop.mapreduce.task.reduce.ShuffleSchedulerImpl.checkReducerHealth(ShuffleSchedulerImpl.java:392)
at org.apache.hadoop.mapreduce.task.reduce.ShuffleSchedulerImpl.copyFailed(ShuffleSchedulerImpl.java:307)
at org.apache.hadoop.mapreduce.task.reduce.Fetcher.copyFromHost(Fetcher.java:366)
at org.apache.hadoop.mapreduce.task.reduce.Fetcher.run(Fetcher.java:198)
在安装的hadoop的/etc/hadoop文件首写打开hdfs-site.xml文件如下:
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/app/tmp</value>
</property>
</configuration>
我们需要拷贝/home/hadoop/app/tmp,接下来把这个路径添加到yarn-site.xml并且在后面追加/nm-local-dir,具体配置文件如下:
<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.local-dirs</name>
<value>/home/hadoop/app/tmp/nm-local-dir</value>
</property>
</configuration>
6、生产上面开启垃圾桶
-- core-default.xml 分钟为单位 fs.trash.interval多久清理一次 fs.trash.checkpoint.interval 多久归档一次 要小于
--等于fs.trash.interval
<property>
<name>fs.trash.interval</name>
<value>60</value>
</property>
<property>
<name>fs.trash.checkpoint.interval</name>
<value>60</value>
</property>
情况回收站
hadoop fs -rmr /user/hadoop/.stash
7、查询磁盘空间占用情况
df -h
查看某个文件夹下面文件占用情况
du -sh /*