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.PeerRegionServerListenerNested classes/interfaces inherited from interface org.apache.hadoop.hbase.replication.ReplicationEndpoint
ReplicationEndpoint.Context, ReplicationEndpoint.ReplicateContextNested 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
FieldsModifier and TypeFieldDescriptionprivate Abortableprivate org.apache.hadoop.fs.Pathprivate org.apache.hadoop.conf.Configurationprivate ClusterConnectionprivate static final longprivate booleanprivate booleanprivate ThreadPoolExecutorprivate org.apache.hadoop.fs.Pathprivate booleanprivate longprivate org.apache.hadoop.conf.Configurationprivate static final org.slf4j.Loggerprivate intprivate longprivate intprivate MetricsSourceprivate booleanstatic final StringDrop edits for CFs that been deleted from the replication source and targetstatic final StringDrop edits for tables that been deleted from the replication source and targetprivate booleanprivate Stringprivate intprivate ReplicationSinkManagerprivate longprivate intFields inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
ctx, REPLICATION_WALENTRYFILTER_CONFIG_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcreateBatches(List<WAL.Entry> entries) Divide the entries into multiple batches, so that we can replicate each batch in a thread pool concurrently.protected ConnectioncreateConnection(org.apache.hadoop.conf.Configuration conf) createParallelBatches(List<WAL.Entry> entries) protected ReplicationSinkManagercreateReplicator(List<WAL.Entry> entries, int batchIndex, int timeout) createSerialBatches(List<WAL.Entry> entries) private voidprotected voiddoStop()filterNotExistColumnFamilyEdits(List<List<WAL.Entry>> oldEntryList) filterNotExistTableEdits(List<List<WAL.Entry>> oldEntryList) private intvoidinit(ReplicationEndpoint.Context context) Initialize the replication endpoint with the given context.static booleanCheck if there's anNoSuchColumnFamilyExceptionin the caused by stacktrace.protected booleanstatic booleanCheck if there's anTableNotFoundExceptionin the caused by stacktrace.private Stringprivate longparallelReplicate(CompletionService<Integer> pool, ReplicationEndpoint.ReplicateContext replicateContext, List<List<WAL.Entry>> batches) private voidbooleanreplicate(ReplicationEndpoint.ReplicateContext replicateContext) Do the shipping logicprotected intreplicateEntries(List<WAL.Entry> entries, int batchIndex, int timeout) private intserialReplicateRegionEntries(List<WAL.Entry> entries, int batchIndex, int timeout) private booleansleepForRetries(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, stopMethods inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
canReplicateToSameCluster, getNamespaceTableCfWALEntryFilter, getScopeWALEntryFilter, getWALEntryfilter, isStarting, peerConfigUpdatedMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:ReplicationEndpointInitialize the replication endpoint with the given context.- Specified by:
initin interfaceReplicationEndpoint- Overrides:
initin 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
sleepMultiplieris <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 anTableNotFoundExceptionin the caused by stacktrace. -
isNoSuchColumnFamilyException
Check if there's anNoSuchColumnFamilyExceptionin 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:
doStopin 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
-