使用WebHDFS复制文件

时间:2016-04-06 08:10:54

标签: hadoop hdfs webhdfs

有没有办法将文件从hdfs://old复制到hdfs://new$check_faqs = " SELECT faq_title, faq_url, faq_content, chapter_id FROM faqs WHERE faq_content LIKE '%". $search ."%' AND faq_status != 'deleted' "; $query_faqs = mysqli_query($con, $check_faqs); if (mysqli_num_rows($query_faqs) !== 0) { $faqs = array(); while($row = mysqli_fetch_assoc($query_faqs)) { $chapter_info = array(); $query_chapter = mysqli_query($con, "SELECT chapter_title, chapter_url FROM faqs_chapters WHERE chapter_id = '". $row["chapter_id"] ."'"); $chapter = mysqli_fetch_assoc($query_chapter); array_push($chapter_info, $chapter["chapter_title"]); array_push($chapter_info, $chapter["chapter_url"]); array_push($row, $chapter_info); $faqs[] = $row; } $count_faqs = mysqli_num_rows($query_faqs); $output = json_encode(array('type'=>'success', 'faqsCount' => $count_faqs, 'faqs' => $faqs)); die($output); } ,而无需先下载文件然后重新上传?

1 个答案:

答案 0 :(得分:0)

不了解WebHDFS,但这可以通过hadoop distcp实现。 该命令看起来像这样:

hadoop distcp hdfs://old_nn:8020/old/location/path.file hdfs://new_nn:8020/new/location/path.file