HBASE-19591 Cleanup the usage of ReplicationAdmin from hbase-shell
This commit is contained in:
parent
001bce54e7
commit
7501e64426
|
@ -19,21 +19,19 @@
|
||||||
|
|
||||||
include Java
|
include Java
|
||||||
|
|
||||||
java_import org.apache.hadoop.hbase.client.replication.ReplicationAdmin
|
|
||||||
java_import org.apache.hadoop.hbase.client.replication.ReplicationPeerConfigUtil
|
java_import org.apache.hadoop.hbase.client.replication.ReplicationPeerConfigUtil
|
||||||
java_import org.apache.hadoop.hbase.replication.ReplicationPeerConfig
|
java_import org.apache.hadoop.hbase.replication.ReplicationPeerConfig
|
||||||
java_import org.apache.hadoop.hbase.util.Bytes
|
java_import org.apache.hadoop.hbase.util.Bytes
|
||||||
java_import org.apache.hadoop.hbase.zookeeper.ZKConfig
|
java_import org.apache.hadoop.hbase.zookeeper.ZKConfig
|
||||||
java_import org.apache.hadoop.hbase.TableName
|
java_import org.apache.hadoop.hbase.TableName
|
||||||
|
|
||||||
# Wrapper for org.apache.hadoop.hbase.client.replication.ReplicationAdmin
|
# Used for replication administrative operations.
|
||||||
|
|
||||||
module Hbase
|
module Hbase
|
||||||
class RepAdmin
|
class RepAdmin
|
||||||
include HBaseConstants
|
include HBaseConstants
|
||||||
|
|
||||||
def initialize(configuration)
|
def initialize(configuration)
|
||||||
@replication_admin = ReplicationAdmin.new(configuration)
|
|
||||||
@configuration = configuration
|
@configuration = configuration
|
||||||
@admin = ConnectionFactory.createConnection(configuration).getAdmin
|
@admin = ConnectionFactory.createConnection(configuration).getAdmin
|
||||||
end
|
end
|
||||||
|
@ -272,10 +270,10 @@ module Hbase
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_peer_replicate_all(id, replicate_all)
|
def set_peer_replicate_all(id, replicate_all)
|
||||||
rpc = @replication_admin.getPeerConfig(id)
|
rpc = get_peer_config(id)
|
||||||
return if rpc.nil?
|
return if rpc.nil?
|
||||||
rpc.setReplicateAllUserTables(replicate_all)
|
rpc.setReplicateAllUserTables(replicate_all)
|
||||||
@replication_admin.updatePeerConfig(id, rpc)
|
@admin.updateReplicationPeerConfig(id, rpc)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set exclude namespaces config for the specified peer
|
# Set exclude namespaces config for the specified peer
|
||||||
|
|
Loading…
Reference in New Issue