यह संभव है, HBase के CopyTable MapReduce jobTableMapReduceUtil.initTableReducerJob()
जो आप के मामले में एक विकल्प के quorumAddress सेट करने के लिए दूरदराज के समूहों को लिखने की ज़रूरत की अनुमति देता है का उपयोग करके यह करता है:
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 - दूर स्थित समूह लिखने के लिए सेवा मेरे; hbase-site.xml में निर्दिष्ट क्लस्टर में आउटपुट के लिए डिफ़ॉल्ट शून्य है। पर एक वैकल्पिक रिमोट क्लस्टर के ज़ूकीपर को इकट्ठा करने के लिए स्ट्रिंग करें, तो डिफ़ॉल्ट के अलावा अन्य क्लस्टर लिखना कम होगा; जैसे क्लस्टर्स के बीच तालिकाओं की प्रतिलिपि बनाना, स्रोत होगा hbase-site.xml द्वारा निर्दिष्ट और इस पैरा में रिमोट क्लस्टर के पते होगा। पास करने के लिए प्रारूप विशेष है। पास :: जैसे सर्वर, सर्वर 2, सर्वर 3: 2181:/hbase।
एक अन्य विकल्प के बजाय संदर्भ के लिए लिख के दूरदराज के मेज पर लिखने के लिए अपने स्वयं के कस्टम कम करने को लागू करने की है। इसके साथ कुछ:
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();
}
}
}
स्रोत
2015-04-15 08:51:36
आप इस प्रकार के नौकरी के लिए स्पार्क का उपयोग कर सकते हैं। – Tinku