2016-01-18 68 views
0

我正在使用Accumulo表作爲輸入並將數據存儲在Accumulo中的另一個表中運行map reduce作業。這是運行方法運行mapreduce作業時無法連接到Zookeeper

public int run(String[] args) throws Exception { 

     Opts opts = new Opts(); 
     opts.parseArgs(PivotTable.class.getName(), args); 

     Configuration conf = getConf(); 

     conf.set("formula", opts.formula); 

     Job job = Job.getInstance(conf); 

     job.setJobName("Pivot Table Generation"); 
     job.setJarByClass(PivotTable.class); 

     job.setOutputKeyClass(Text.class); 
     job.setOutputValueClass(Text.class); 

     job.setMapperClass(PivotTableMapper.class); 
     job.setCombinerClass(PivotTableCombiber.class); 
     job.setReducerClass(PivotTableReducer.class); 

     AccumuloInputFormat.setInputTableName(job, opts.dataTable); 

     BatchWriterConfig bwConfig = new BatchWriterConfig(); 

     AccumuloOutputFormat.setBatchWriterOptions(job, bwConfig); 
     AccumuloOutputFormat.setDefaultTableName(job, opts.pivotTable); 
     AccumuloOutputFormat.setCreateTables(job, true); 

     job.setInputFormatClass(AccumuloInputFormat.class); 
     job.setOutputFormatClass(AccumuloOutputFormat.class); 

     opts.setAccumuloConfigs(job); 

     return job.waitForCompletion(true) ? 0 : 1; 
    } 

但問題是,當我運行作業時,我得到一個異常,說它無法連接到zookeeper。

Error: java.lang.RuntimeException: Failed to connect to zookeeper (zookeeper.1:22181) within 2x zookeeper timeout period 30000 
     at org.apache.accumulo.fate.zookeeper.ZooSession.connect(ZooSession.java:124) 
     at org.apache.accumulo.fate.zookeeper.ZooSession.getSession(ZooSession.java:164) 
     at org.apache.accumulo.fate.zookeeper.ZooReader.getSession(ZooReader.java:43) 
     at org.apache.accumulo.fate.zookeeper.ZooReader.getZooKeeper(ZooReader.java:47) 
     at org.apache.accumulo.fate.zookeeper.ZooCache.getZooKeeper(ZooCache.java:59) 
     at org.apache.accumulo.fate.zookeeper.ZooCache.retry(ZooCache.java:159) 
     at org.apache.accumulo.fate.zookeeper.ZooCache.get(ZooCache.java:289) 
     at org.apache.accumulo.fate.zookeeper.ZooCache.get(ZooCache.java:238) 
     at org.apache.accumulo.core.client.ZooKeeperInstance.getInstanceID(ZooKeeperInstance.java:169) 
     at org.apache.accumulo.core.client.ZooKeeperInstance.<init>(ZooKeeperInstance.java:159) 
     at org.apache.accumulo.core.client.ZooKeeperInstance.<init>(ZooKeeperInstance.java:140) 
     at org.apache.accumulo.core.client.mapreduce.RangeInputSplit.getInstance(RangeInputSplit.java:364) 
     at org.apache.accumulo.core.client.mapreduce.AbstractInputFormat$AbstractRecordReader.initialize(AbstractInputFormat.java:495) 
     at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.initialize(MapTask.java:548) 
     at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:786) 
     at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) 
     at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at javax.security.auth.Subject.doAs(Subject.java:422) 
     at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) 
     at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158) 

我檢查了看zookeeper是否啓動並且正在運行。我運行了telnet來查看端口是否啓動並且啓動了。

我使用$ ACCUMULO_HOME/bin/tool.sh來運行作業。任何幫助,將不勝感激。

回答

1

這是我的hadoop從屬主機文件的問題。主機名映射不正確。

相關問題