Có thể, HBase của CopyTable MapReduce job hiện nó bằng cách sử dụng TableMapReduceUtil.initTableReducerJob()
cho phép bạn thiết lập một quorumAddress thay thế trong trường hợp bạn cần phải viết các cụm từ xa:
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 - cụm Distant viết đến; mặc định là null cho đầu ra cho cụm được chỉ định trong tệp hbase-site.xml. Đặt chuỗi này vào bộ sưu tập của người quản lý động vật của cụm từ xa thay thế khi bạn sẽ có giảm bớt ghi một cụm không phải là mặc định; ví dụ. sao chép các bảng giữa các cụm, nguồn sẽ là được chỉ định bởi hbase-site.xml và tham số này sẽ có toàn bộ địa chỉ của cụm từ xa. Các định dạng để vượt qua là đặc biệt. Vượt qua :: chẳng hạn như máy chủ, máy chủ2, máy chủ3: 2181:/hbase.
Một lựa chọn khác là thực hiện giảm tốc tùy chỉnh của riêng bạn để ghi vào bảng điều khiển từ xa thay vì viết với bối cảnh. Tương tự như vậy:
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();
}
}
}
Nguồn
2015-04-15 08:51:36
Bạn có thể sử dụng tia lửa cho công việc kiểu này. – Tinku