Class HBaseInterClusterReplicationEndpoint
java.lang.Object
org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
org.apache.hadoop.hbase.replication.HBaseReplicationEndpoint
org.apache.hadoop.hbase.replication.regionserver.HBaseInterClusterReplicationEndpoint
- All Implemented Interfaces:
Abortable
,ReplicationEndpoint
,ReplicationPeerConfigListener
,org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service
A
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.replication.HBaseReplicationEndpoint
HBaseReplicationEndpoint.PeerRegionServerListener
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.replication.ReplicationEndpoint
ReplicationEndpoint.Context, ReplicationEndpoint.ReplicateContext
Nested classes/interfaces inherited from interface org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service
org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service.Listener, org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service.State
-
Field Summary
Modifier and TypeFieldDescriptionprivate Abortable
private org.apache.hadoop.fs.Path
private org.apache.hadoop.conf.Configuration
private ClusterConnection
private static final long
private boolean
private boolean
private ThreadPoolExecutor
private org.apache.hadoop.fs.Path
private boolean
private long
private org.apache.hadoop.conf.Configuration
private static final org.slf4j.Logger
private int
private long
private int
private MetricsSource
private boolean
static final String
Drop edits for CFs that been deleted from the replication source and targetstatic final String
Drop edits for tables that been deleted from the replication source and targetprivate boolean
private String
private int
private ReplicationSinkManager
private long
private int
Fields inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
ctx, REPLICATION_WALENTRYFILTER_CONFIG_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
createBatches
(List<WAL.Entry> entries) Divide the entries into multiple batches, so that we can replicate each batch in a thread pool concurrently.protected Connection
createConnection
(org.apache.hadoop.conf.Configuration conf) createParallelBatches
(List<WAL.Entry> entries) protected ReplicationSinkManager
createReplicator
(List<WAL.Entry> entries, int batchIndex, int timeout) createSerialBatches
(List<WAL.Entry> entries) private void
protected void
doStop()
filterNotExistColumnFamilyEdits
(List<List<WAL.Entry>> oldEntryList) filterNotExistTableEdits
(List<List<WAL.Entry>> oldEntryList) private int
void
init
(ReplicationEndpoint.Context context) Initialize the replication endpoint with the given context.static boolean
Check if there's anNoSuchColumnFamilyException
in the caused by stacktrace.protected boolean
static boolean
Check if there's anTableNotFoundException
in the caused by stacktrace.private String
private long
parallelReplicate
(CompletionService<Integer> pool, ReplicationEndpoint.ReplicateContext replicateContext, List<List<WAL.Entry>> batches) private void
boolean
replicate
(ReplicationEndpoint.ReplicateContext replicateContext) Do the shipping logicprotected int
replicateEntries
(List<WAL.Entry> entries, int batchIndex, int timeout) private int
serialReplicateRegionEntries
(List<WAL.Entry> entries, int batchIndex, int timeout) private boolean
sleepForRetries
(String msg, int sleepMultiplier) Do the sleeping logicMethods inherited from class org.apache.hadoop.hbase.replication.HBaseReplicationEndpoint
abort, disconnect, doStart, fetchSlavesAddresses, getLastRegionServerUpdate, getPeerUUID, getRegionServers, getZkw, isAborted, reconnect, setRegionServers, start, stop
Methods inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
canReplicateToSameCluster, getNamespaceTableCfWALEntryFilter, getScopeWALEntryFilter, getWALEntryfilter, isStarting, peerConfigUpdated
Methods inherited from class org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.replication.ReplicationEndpoint
awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning
-
Field Details
-
LOG
-
DEFAULT_MAX_TERMINATION_WAIT_MULTIPLIER
- See Also:
-
REPLICATION_DROP_ON_DELETED_TABLE_KEY
Drop edits for tables that been deleted from the replication source and target- See Also:
-
REPLICATION_DROP_ON_DELETED_COLUMN_FAMILY_KEY
Drop edits for CFs that been deleted from the replication source and target- See Also:
-
conn
-
localConf
-
conf
-
sleepForRetries
-
maxRetriesMultiplier
-
socketTimeoutMultiplier
-
maxTerminationWait
-
replicationRpcLimit
-
metrics
-
replicationSinkMgr
-
peersSelected
-
replicationClusterId
-
exec
-
maxThreads
-
baseNamespaceDir
-
hfileArchiveDir
-
replicationBulkLoadDataEnabled
-
abortable
-
dropOnDeletedTables
-
dropOnDeletedColumnFamilies
-
isSerial
-
lastSinkFetchTime
-
-
Constructor Details
-
HBaseInterClusterReplicationEndpoint
public HBaseInterClusterReplicationEndpoint()
-
-
Method Details
-
createConnection
- Throws:
IOException
-
createReplicationSinkManager
-
init
Description copied from interface:ReplicationEndpoint
Initialize the replication endpoint with the given context.- Specified by:
init
in interfaceReplicationEndpoint
- Overrides:
init
in classBaseReplicationEndpoint
- Parameters:
context
- replication context- Throws:
IOException
- error occur when initialize the endpoint.
-
decorateConf
-
connectToPeers
-
sleepForRetries
Do the sleeping logic- Parameters:
msg
- Why we sleepsleepMultiplier
- by how many times the default sleeping time is augmented- Returns:
- True if
sleepMultiplier
is <maxRetriesMultiplier
-
getEstimatedEntrySize
-
createParallelBatches
-
createSerialBatches
-
createBatches
Divide the entries into multiple batches, so that we can replicate each batch in a thread pool concurrently. Note that, for serial replication, we need to make sure that entries from the same region to be replicated serially, so entries from the same region consist of a batch, and we will divide a batch into several batches by replicationRpcLimit in method serialReplicateRegionEntries() -
isTableNotFoundException
Check if there's anTableNotFoundException
in the caused by stacktrace. -
isNoSuchColumnFamilyException
Check if there's anNoSuchColumnFamilyException
in the caused by stacktrace. -
filterNotExistTableEdits
-
filterNotExistColumnFamilyEdits
-
reconnectToPeerCluster
-
parallelReplicate
private long parallelReplicate(CompletionService<Integer> pool, ReplicationEndpoint.ReplicateContext replicateContext, List<List<WAL.Entry>> batches) throws IOException - Throws:
IOException
-
replicate
Do the shipping logic- Parameters:
replicateContext
- a context where WAL entries and other parameters can be obtained.
-
isPeerEnabled
-
doStop
- Overrides:
doStop
in classHBaseReplicationEndpoint
-
replicateEntries
protected int replicateEntries(List<WAL.Entry> entries, int batchIndex, int timeout) throws IOException - Throws:
IOException
-
serialReplicateRegionEntries
private int serialReplicateRegionEntries(List<WAL.Entry> entries, int batchIndex, int timeout) throws IOException - Throws:
IOException
-
createReplicator
-
logPeerId
-