0

Distcp Java API を使用して、ある Hadoop クラスターから別のクラスターにデータをコピーしようとしています。

ただし、次の例外が発生します。

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.util.StringUtils.toLowerCase(Ljava/lang/String;)Ljava/lang/String;
at org.apache.hadoop.tools.util.DistCpUtils.getStrategy(DistCpUtils.java:126)
at org.apache.hadoop.tools.DistCp.createJob(DistCp.java:235)
at org.apache.hadoop.tools.DistCp.createAndSubmitJob(DistCp.java:174)
at org.apache.hadoop.tools.DistCp.execute(DistCp.java:153)
at com.monitor.BackupUtil.doBackup(BackupUtil.java:72)
at com.monitor.BackupUtil.main(BackupUtil.java:45)

次のコードを使用しています。

    public void doBackup() throws Exception {

    System.out.println("Beginning Distcp");
    DistCpOptions options = new DistCpOptions(
            new Path(prop.getProperty("sourceClusterDirectory") + "/" + prop.getProperty("tablename")
                    + "/distcp.txt"),
            new Path(prop.getProperty("targetCluster") + prop.getProperty("targetClusterDirectory")));

    System.out.println("Disctp between--->" + prop.getProperty("sourceClusterDirectory")+ "/distcp.txt" + "AND" + prop.getProperty("targetCluster")
            + prop.getProperty("targetClusterDirectory"));
    DistCp distcp = new DistCp(new Configuration(), options);
    Job job = distcp.execute();

    job.waitForCompletion(true);

    System.out.println("DistCp Completed Successfully");


}

私は Hadoop 2.7.1 を使用しており、distcp の依存関係は次のとおりです。

<dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-distcp</artifactId>
        <version>2.7.1</version>
</dependency>
4

0 に答える 0