@InterfaceAudience.Private public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoint
ReplicationEndpoint
implementation for replicating to another HBase cluster.
For the slave cluster it selects a random number of peers
using a replication ratio. For example, if replication ration = 0.1
and slave cluster has 100 region servers, 10 will be selected.
A stream is considered down when we cannot contact a region server on the peer cluster for more than 55 seconds by default.
Modifier and Type | Class and Description |
---|---|
protected class |
HBaseInterClusterReplicationEndpoint.Replicator |
HBaseReplicationEndpoint.PeerRegionServerListener
ReplicationEndpoint.Context, ReplicationEndpoint.ReplicateContext
Modifier and Type | Field and Description |
---|---|
private Abortable |
abortable |
private org.apache.hadoop.fs.Path |
baseNamespaceDir |
private org.apache.hadoop.conf.Configuration |
conf |
private ClusterConnection |
conn |
private static long |
DEFAULT_MAX_TERMINATION_WAIT_MULTIPLIER |
private boolean |
dropOnDeletedTables |
private ThreadPoolExecutor |
exec |
private org.apache.hadoop.fs.Path |
hfileArchiveDir |
private org.apache.hadoop.conf.Configuration |
localConf |
private static org.slf4j.Logger |
LOG |
private int |
maxRetriesMultiplier |
private long |
maxTerminationWait |
private int |
maxThreads |
private MetricsSource |
metrics |
private boolean |
peersSelected |
private boolean |
replicationBulkLoadDataEnabled |
private String |
replicationClusterId |
private int |
replicationRpcLimit |
private ReplicationSinkManager |
replicationSinkMgr |
private long |
sleepForRetries |
private int |
socketTimeoutMultiplier |
ctx, REPLICATION_WALENTRYFILTER_CONFIG_KEY
Constructor and Description |
---|
HBaseInterClusterReplicationEndpoint() |
Modifier and Type | Method and Description |
---|---|
private void |
connectToPeers() |
private List<List<WAL.Entry>> |
createBatches(List<WAL.Entry> entries) |
protected HBaseInterClusterReplicationEndpoint.Replicator |
createReplicator(List<WAL.Entry> entries,
int ordinal) |
private void |
decorateConf() |
protected void |
doStop() |
private List<List<WAL.Entry>> |
filterBatches(List<List<WAL.Entry>> oldEntryList,
TableName table) |
void |
init(ReplicationEndpoint.Context context)
Initialize the replication endpoint with the given context.
|
protected boolean |
isPeerEnabled() |
private TableName |
parseTable(String msg) |
private void |
reconnectToPeerCluster() |
boolean |
replicate(ReplicationEndpoint.ReplicateContext replicateContext)
Do the shipping logic
|
protected boolean |
sleepForRetries(String msg,
int sleepMultiplier)
Do the sleeping logic
|
abort, disconnect, doStart, fetchSlavesAddresses, getLastRegionServerUpdate, getPeerUUID, getRegionServers, getZkw, isAborted, reconnect, setRegionServers, start, stop
canReplicateToSameCluster, getNamespaceTableCfWALEntryFilter, getScopeWALEntryFilter, getWALEntryfilter, isStarting, peerConfigUpdated
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning
private static final org.slf4j.Logger LOG
private static final long DEFAULT_MAX_TERMINATION_WAIT_MULTIPLIER
private ClusterConnection conn
private org.apache.hadoop.conf.Configuration localConf
private org.apache.hadoop.conf.Configuration conf
private long sleepForRetries
private int maxRetriesMultiplier
private int socketTimeoutMultiplier
private long maxTerminationWait
private int replicationRpcLimit
private MetricsSource metrics
private ReplicationSinkManager replicationSinkMgr
private boolean peersSelected
private String replicationClusterId
private ThreadPoolExecutor exec
private int maxThreads
private org.apache.hadoop.fs.Path baseNamespaceDir
private org.apache.hadoop.fs.Path hfileArchiveDir
private boolean replicationBulkLoadDataEnabled
private boolean dropOnDeletedTables
public HBaseInterClusterReplicationEndpoint()
public void init(ReplicationEndpoint.Context context) throws IOException
ReplicationEndpoint
init
in interface ReplicationEndpoint
init
in class BaseReplicationEndpoint
context
- replication contextIOException
private void decorateConf()
private void connectToPeers()
protected boolean sleepForRetries(String msg, int sleepMultiplier)
msg
- Why we sleepsleepMultiplier
- by how many times the default sleeping time is augmentedsleepMultiplier
is < maxRetriesMultiplier
private TableName parseTable(String msg)
private List<List<WAL.Entry>> filterBatches(List<List<WAL.Entry>> oldEntryList, TableName table)
private void reconnectToPeerCluster()
public boolean replicate(ReplicationEndpoint.ReplicateContext replicateContext)
replicateContext
- a context where WAL entries and other
parameters can be obtained.protected boolean isPeerEnabled()
protected void doStop()
doStop
in class HBaseReplicationEndpoint
protected HBaseInterClusterReplicationEndpoint.Replicator createReplicator(List<WAL.Entry> entries, int ordinal)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.