我正在MapReduce中構建一個日誌分析程序。我正在使用MaxMind GeoIP數據。現在我想將GeoIP數據放入分佈式緩存中。我在eclipse中開發我的應用程序。這是我在做什麼Hadoop 1.0.4分佈式緩存錯誤
Job job = new Job();
DistributedCache.addCacheFile(new URI(args[3]), job.getConfiguration());
哪裏args [3]將有路徑。
在這裏,我用它
protected void setup(Context context) {
try {
//String dbfile = "GeoIP//GeoIPCountry.dat";
org.apache.hadoop.conf.Configuration conf = context.getConfiguration();
Path[] dbfile = DistributedCache.getLocalCacheFiles(conf);
// GEOIP_MEMORY_CACHE - load database into memory, faster
// performance but uses more memory, Increase the JVM heap Size
cl = new LookupService(dbfile.toString(), LookupService.GEOIP_MEMORY_CACHE);
} catch (Exception e) {
System.err.println("Error opening GeoIP data file.");
System.err.println(e);
System.exit(2);
}
}
但在運行我收到以下錯誤
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method addCacheFile(URI, Configuration) in the type DistributedCache is not applicable for the arguments (URI, Configuration)
我無法弄清楚什麼是錯的。請幫助
當您將文件添加到緩存時,可以在部分中顯示導入嗎? –