Es ist möglich, HBase des CopyTable MapReduce job tut es durch TableMapReduceUtil.initTableReducerJob()
mit dem Sie eine alternative quorumAddress setzen, falls Sie noch Remote-Cluster schreiben müssen:
public static void initTableReducerJob(String table, Class<? extends TableReducer> reducer, org.apache.hadoop.mapreduce.Job job, Class partitioner, String quorumAddress, String serverClass, String serverImpl)
quorumAddress - Distant Cluster zu schreiben zu; Der Standardwert ist null für Ausgabe an den Cluster, der in hbase-site.xml angegeben ist. Setzen Sie diese Zeichenfolge auf das Zookeeper-Ensemble eines alternativen fernen Clusters, wenn Sie einen anderen Cluster als den Standardwert reduzieren möchten; z.B. Beim Kopieren von Tabellen zwischen Clustern würde die Quelle von hbase-site.xml angegeben und dieser Parameter hätte die Ensembleadresse des fernen Clusters. Das zu übergebende Format ist besonders. Pass :: wie Server, Server2, Server3: 2181:/Hbase.
Eine weitere Option ist Ihre eigenen Minderer zu implementieren, um die entfernte Tabelle zu schreiben, anstatt auf den Kontext des Schreibens. Ähnliches:
public static class MyReducer extends Reducer<Text, Result, Text, Text> {
protected Table remoteTable;
protected Connection connection;
@Override
protected void setup(Context context) throws IOException, InterruptedException {
super.setup(context);
// Clone configuration and provide a new quorum address for the remote cluster
Configuration config = HBaseConfiguration.create(context.getConfiguration());
config.set("hbase.zookeeper.quorum","quorum1,quorum2,quorum3");
connection = ConnectionFactory.createConnection(config); // HBase 0.99+
//connection = HConnectionManager.createConnection(config); // HBase <0.99
remoteTable = connection.getTable("myTable".getBytes());
remoteTable.setAutoFlush(false);
remoteTable.setWriteBufferSize(1024L*1024L*10L); // 10MB buffer
}
public void reduce(Text boardKey, Iterable<Result> results, Context context) throws IOException, InterruptedException {
/* Write puts to remoteTable */
}
@Override
protected void cleanup(Context context) throws IOException, InterruptedException {
super.cleanup(context);
if (remoteTable!=null) {
remoteTable.flushCommits();
remoteTable.close();
}
if(connection!=null) {
connection.close();
}
}
}
Sie können Funke für diesen Job verwenden. – Tinku