hadoop

it2023-07-24  79

首先停止hdfs集群,在主节点机器上执行以下命令 cd /export/servers/hadoop-2.6.0-cdh5.14.0 sbin/stop-dfs.sh 修改主节点机器上的hdfs-site.xml当中的配置文件 cd /export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop vim hdfs-site.xml 改: <property> <name>dfs.permissions</name> <value>true</value> </property> 修改完成之后配置文件发送到其他机器上面去 scp hdfs-site.xml 其他节点主机名:$PWD 重启hdfs集群 cd /export/servers/hadoop-2.6.0-cdh5.14.0 sbin/start-dfs.sh 随意上传一些文件到我们Hadoop集群当中准备测试使用 cd /export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop hdfs dfs -mkdir /config hdfs dfs -put *.xml /config hdfs dfs -chmod 600 /config/core-site.xml 使用代码准备下载文件 FileSystem fileSystem = FileSystem.get(new URI("hdfs://节点IP:8020"), new Configuration(),"root"); fileSystem.copyToLocalFile(new Path("/config/core-site.xml"),new Path("file:///windows路径")); fileSystem.close();
最新回复(0)