Apache HBase: BulkLoad Replication in CDH 6.3 and CDP-DC 7.0
find ./ -name 'hbase-site.xml' -print0 | xargs -0 grep 'hbase.replication.bulkload.enabled'
- Copy over to replication peer:
It is important to copy the configuration files to the correct path defined by the two configuration parameters:scp core-site.xml hdfs-site.xml hbase-site.xml root@sink.cluster.com:/opt/cloudera/fs_conf/source/
hbase.replication.conf.dir/hbase.replication.cluster.id
For example: /opt/cloudera/fs_conf/source/ - Repeat step 8 for every RegionServer.
- Ensure that the correct file permissions are set to the HBase user.
For example:chown -R hbase:hbase /opt/cloudera/fs_conf/source - Click Save Changes.
- Click the Stale Service Restart icon that is next to the service to invoke the cluster restart wizard to restart Stale Services.
- Add the peer to the source cluster as you would in the case of normal replication.
- For example, in the HBase shell:
add_peer '1', CLUSTER_KEY => 'cluster-sink-1.company.com:2181:/hbase'
- For example, in the HBase shell:
- Enable replication on a table or a column family basis:
- Table:
enable_table_replication 'IntegrationTestBulkLoad' - Column family:
disable ‘IntegrationTestBulkLoad’
alter‘IntegrationTestBulkLoad’, {NAME => ‘D’, REPLICATION_SCOPE => '1'}
enable ‘IntegrationTestBulkLoad’
- Table:
You should be all set now.
If HBase encounters a BulkLoad entry for the associated tables in the WAL, it will initiate the bulk load replication by reading the configuration of the source cluster. There will be some info level logs like:
- “Loading source cluster FS client conf for cluster replicationClusterId”
- “Loading source cluster replicationClusterId file system configurations from xml files under directory hbase.replication.conf.dir”
If there were no errors with the configuration files and connection, HBase copies over the HFile from the source cluster’s FS to local FS and you can see that in the FileSystem log.
There will be no information trace of this in the HBase logs unless the HFile has been archived (“Failed to copy hfile from sourceHFilePath to localHFilePath. Trying to copy from hfile archive directory.”).
If the HFile has been archived, HBase will look into the archive directory. If it’s also a miss, there will be an error log ("Failed to copy hfile from sourceHFilePath to localHFilePath. Hence ignoring this hfile from replication.”) and the bulkload replication for this HFile will be skipped.
Configurations
- Name: hbase.replication.bulkload.enabled
Type: Boolean
Default: false
Description: Enable replication for bulk loaded data. - Name: hbase.replication.cluster.id
Type: String
Default: -
Description:Mandatory if replication for bulk loaded data is enabled. This is a unique ID to identify the source HBase cluster. It has to be defined in source cluster. - Name: hbase.replication.conf.dir
Type: String
Default: HBase configuration directory (HBASE_CONF_DIR)
Description: Represents the directory where all the active FS cluster's client configurations are defined in their respective subfolders. This configuration has to be defined in peer cluster. - Name: hbase.replication.source.fs.conf.provider
Type: String
Default: org.apache.hadoop.hbase.replication.regionserver.DefaultSourceFSConfigurationProvider
Description: Represents the class which provides the source cluster file system configuration to peer cluster. This configuration has to be defined in peer cluster. Leave as is unless you want to implement custom configuration provider.

