Class ReplicationPeerConfigUtil
java.lang.Object
org.apache.hadoop.hbase.client.replication.ReplicationPeerConfigUtil
Helper for TableCFs Operations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ReplicationPeerConfigappendExcludeTableCFsToReplicationPeerConfig(Map<TableName, List<String>> excludeTableCfs, ReplicationPeerConfig peerConfig) static ReplicationPeerConfigappendTableCFsToReplicationPeerConfig(Map<TableName, List<String>> tableCfs, ReplicationPeerConfig peerConfig) static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[]Convert string to TableCFs Object.static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[]convert(Map<TableName, ? extends Collection<String>> tableCfs) convert map to TableCFs Objectstatic org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeerconvert(ReplicationPeerConfig peerConfig) static ReplicationPeerConfigconvert(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeer peer) static Stringconvert(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] tableCFs) Convert TableCFs Object to String.convert2Map(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] tableCFs) Convert tableCFs Object to Map.static StringconvertToString(Map<TableName, ? extends Collection<String>> tableCfs) static StringconvertToString(Set<String> namespaces) copyTableCFsMap(Map<TableName, List<String>> preTableCfs) static org.apache.hadoop.conf.ConfigurationgetPeerClusterConfiguration(org.apache.hadoop.conf.Configuration conf, ReplicationPeerConfig peerConfig) Returns the configuration needed to talk to the remote slave cluster.static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCFgetTableCF(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] tableCFs, String table) Get TableCF in TableCFs, if not exist, return null.static ReplicationPeerConfigparsePeerFrom(byte[] bytes) Parse the serialized representation of a peer configuration.static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[]parseTableCFs(byte[] bytes) Parse bytes into TableCFs.parseTableCFsFromConfig(String tableCFsConfig) Convert tableCFs string into Map.static ReplicationPeerConfigremoveExcludeTableCFsFromReplicationPeerConfig(Map<TableName, List<String>> excludeTableCfs, ReplicationPeerConfig peerConfig, String id) static ReplicationPeerConfigremoveTableCFsFromReplicationPeerConfig(Map<TableName, List<String>> tableCfs, ReplicationPeerConfig peerConfig, String id) static byte[]toByteArray(ReplicationPeerConfig peerConfig) Returns Serialized protobuf ofpeerConfigwith pb magic prefix prepended suitable for use as content of a this.peersZNode; i.e.static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeerDescriptionstatic ReplicationPeerDescriptiontoReplicationPeerDescription(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeerDescription desc) static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.SyncReplicationStatestatic SyncReplicationStatetoSyncReplicationState(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.SyncReplicationState state) static ReplicationPeerConfigupdateReplicationBasePeerConfigs(org.apache.hadoop.conf.Configuration conf, ReplicationPeerConfig receivedPeerConfig) Helper method to add/removev base peer configs from Configuration to ReplicationPeerConfig This merges the user supplied peer configurationReplicationPeerConfigwith peer configs provided as property hbase.replication.peer.base.configs in hbase configuration.
-
Field Details
-
LOG
-
HBASE_REPLICATION_PEER_BASE_CONFIG
- See Also:
-
-
Constructor Details
-
ReplicationPeerConfigUtil
private ReplicationPeerConfigUtil()
-
-
Method Details
-
convertToString
-
convert
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] convert(Map<TableName, ? extends Collection<String>> tableCfs) convert map to TableCFs Object -
convertToString
-
convert
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] convert(String tableCFsConfig) Convert string to TableCFs Object. This is only for read TableCFs information from TableCF node. Input String Format: ns1.table1:cf1,cf2;ns2.table2:cfA,cfB;ns3.table3. -
convert
public static String convert(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] tableCFs) Convert TableCFs Object to String. Output String Format: ns1.table1:cf1,cf2;ns2.table2:cfA,cfB;table3 -
getTableCF
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF getTableCF(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] tableCFs, String table) Get TableCF in TableCFs, if not exist, return null. -
parseTableCFs
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] parseTableCFs(byte[] bytes) throws IOException Parse bytes into TableCFs. It is used for backward compatibility. Old format bytes have no PB_MAGIC Header- Throws:
IOException
-
parseTableCFsFromConfig
Convert tableCFs string into Map. -
convert2Map
public static Map<TableName,List<String>> convert2Map(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.TableCF[] tableCFs) Convert tableCFs Object to Map. -
parsePeerFrom
Parse the serialized representation of a peer configuration.- Parameters:
bytes- Content of a peer znode.- Returns:
- ClusterKey parsed from the passed bytes.
- Throws:
DeserializationException- deserialization exception
-
convert
public static ReplicationPeerConfig convert(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeer peer) -
convert
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeer convert(ReplicationPeerConfig peerConfig) -
toByteArray
Returns Serialized protobuf ofpeerConfigwith pb magic prefix prepended suitable for use as content of a this.peersZNode; i.e. the content of PEER_ID znode under /hbase/replication/peers/PEER_ID -
toReplicationPeerDescription
public static ReplicationPeerDescription toReplicationPeerDescription(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeerDescription desc) -
toProtoReplicationPeerDescription
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationPeerDescription toProtoReplicationPeerDescription(ReplicationPeerDescription desc) -
toSyncReplicationState
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.SyncReplicationState toSyncReplicationState(SyncReplicationState state) -
toSyncReplicationState
public static SyncReplicationState toSyncReplicationState(org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.SyncReplicationState state) -
appendTableCFsToReplicationPeerConfig
public static ReplicationPeerConfig appendTableCFsToReplicationPeerConfig(Map<TableName, List<String>> tableCfs, ReplicationPeerConfig peerConfig) -
updateReplicationBasePeerConfigs
public static ReplicationPeerConfig updateReplicationBasePeerConfigs(org.apache.hadoop.conf.Configuration conf, ReplicationPeerConfig receivedPeerConfig) Helper method to add/removev base peer configs from Configuration to ReplicationPeerConfig This merges the user supplied peer configurationReplicationPeerConfigwith peer configs provided as property hbase.replication.peer.base.configs in hbase configuration. Expected format for this hbase configuration is "k1=v1;k2=v2,v2_1;k3=""". If value is empty, it will remove the existing key-value from peer config.- Parameters:
conf- Configuration- Returns:
- ReplicationPeerConfig containing updated configs.
-
appendExcludeTableCFsToReplicationPeerConfig
public static ReplicationPeerConfig appendExcludeTableCFsToReplicationPeerConfig(Map<TableName, List<String>> excludeTableCfs, ReplicationPeerConfig peerConfig) throws ReplicationException- Throws:
ReplicationException
-
mergeTableCFs
-
copyTableCFsMap
-
removeTableCFsFromReplicationPeerConfig
public static ReplicationPeerConfig removeTableCFsFromReplicationPeerConfig(Map<TableName, List<String>> tableCfs, ReplicationPeerConfig peerConfig, String id) throws ReplicationException- Throws:
ReplicationException
-
removeExcludeTableCFsFromReplicationPeerConfig
public static ReplicationPeerConfig removeExcludeTableCFsFromReplicationPeerConfig(Map<TableName, List<String>> excludeTableCfs, ReplicationPeerConfig peerConfig, String id) throws ReplicationException- Throws:
ReplicationException
-
getPeerClusterConfiguration
public static org.apache.hadoop.conf.Configuration getPeerClusterConfiguration(org.apache.hadoop.conf.Configuration conf, ReplicationPeerConfig peerConfig) throws IOException Returns the configuration needed to talk to the remote slave cluster.- Parameters:
conf- the base configurationpeerConfig- the peer config of replication peer- Returns:
- the configuration for the peer cluster, null if it was unable to get the configuration
- Throws:
IOException- when create peer cluster configuration failed
-