bitterfox opened a new pull request #3582:
URL: https://github.com/apache/hbase/pull/3582


   https://issues.apache.org/jira/browse/HBASE-26196
   
   Usecase:
   ```
           TableName tableName = TableName.valueOf("table");
           Configuration conf = job.getConfiguration();
   
           // assume cluster B is secure
           Configuration clusterB = HBaseConfiguration.createClusterConf(
                   conf,  
"hbase-b-1.example.com,hbase-b-2.example.com,hbase-b-3.example.com:2181:/hbase-b");
           clusterB.set(User.HBASE_SECURITY_CONF_KEY, "kerberos");
           // configure others too like MASTER_KRB_PRINCIPAL, 
REGIONSERVER_KRB_PRINCIPAL and so on
   
           // hack. TableMapReduceUtil.initCredentialsForCluster create 
UserProvider using job's configuration
           // Thus if User.HBASE_SECURITY_CONF_KEY is simple, token isn't 
obtained
           conf.set(User.HBASE_SECURITY_CONF_KEY, "kerberos");
   
           TableMapReduceUtil.initCredentialsForCluster(job, clusterB);
   
           // assume cluster A isn't secure
           conf.set(HConstants.ZOOKEEPER_QUORUM, 
"hbase-a-1.example.com,hbase-a-2.example.com,hbase-a-3.example.com");
           conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, 2181);
           conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/hbase-a");
           conf.set(User.HBASE_SECURITY_CONF_KEY, "simple");
   
           TableMapReduceUtil.initTableMapperJob(tableName, scanner, 
Mapper.class, ImmutableBytesWritable.class, Put.class, job);
   
           try (Connection con = ConnectionFactory.createConnection(clusterB);
                Table table = con.getTable(tableName);
                RegionLocator regionLocator = con.getRegionLocator(tableName)) {
               HFileOutputFormat2.configureIncrementalLoad(job, table, 
regionLocator);
               conf.set(HFileOutputFormat2.REMOTE_CLUSTER_CONF_PREFIX + 
User.HBASE_SECURITY_CONF_KEY, "kerberos");
           }
   
   
           return job.waitForCompletion(true) ? 0 : 1;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to