Skip to content

Instantly share code, notes, and snippets.

@asears
Created September 23, 2016 01:03
Show Gist options
  • Select an option

  • Save asears/86ba5a710754ec72bd2ed035909a9eb0 to your computer and use it in GitHub Desktop.

Select an option

Save asears/86ba5a710754ec72bd2ed035909a9eb0 to your computer and use it in GitHub Desktop.
// http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.3/bk_hadoop-ha/content/hbase-replication-internals.html
// ping / firewall to both clusters
// ssh to both clusters
// keytabs in both clusters
kadmin: addprinc -e "<enc_type_list>" krbtgt/ONE.COM@TWO.COM
kadmin: addprinc -e "<enc_type_list>" krbtgt/TWO.COM@ONE.COM
addprinc -maxrenewlife 4days
-Dzookeeper.security.auth_to_local=RULE:[2:\$1@\$0](.*@\\QONE.COM\\E$)s/@\\QONE.COM\\E$//DEFAULT
// core-site.xml
hadoop.security.auth_to_local=
RULE:[2:$1@$0](.*@\QONE.COM\E$)s/@\QONE.COM\E$//
DEFAULT
// hbase-env
HBASE_MANAGES_ZK=false
// hbase-site (client/server on master)
hbase.replication=true
replication.sleep.before.failover=30000
// hbase-site
hbase.security.authentication=kerberos
hbase.rpc.engine=org.apache.hadoop.hbase.ipc.SecureRpcEngine
replication.source.maxretriesmultiplier=300
replication.source.sleepforretries=1
// region servers in case ACLs req'd
hbase.replication.rpc.codec=org.apache.hadoop.hbase.codec.KeyValueCodecWithTags
// restart hbase
// Create tables on both servers
cd %HBASE_HOME%\bin
hbase shell
create 'Contacts', 'Personal', 'Office'
add_peer '1', 'zookeeper0.contoso-hbase-us.d4.internal.cloudapp.net,zookeeper1.contoso-hbase-us.d4.internal.cloudapp.net,zookeeper2.contoso-hbase-us.d4.internal.cloudapp.net:2181:/hbase'
disable 'Contacts'
alter 'Contacts', {NAME => 'Personal', REPLICATION_SCOPE => '1'}
alter 'Contacts', {NAME => 'Office', REPLICATION_SCOPE => '1'}
enable 'Contacts'
describe 'Contacts'
wasbs://hbasecontacts@hditutorialdata.blob.core.windows.net/contacts.txt
hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns="HBASE_ROW_KEY,Personal:Name, Personal:HomePhone, Office:Address" -Dimporttsv.bulk.output=/tmpOutput Contacts wasbs://hbasecontacts@hditutorialdata.blob.core.windows.net/contacts.txt
hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles /tmpOutput Contacts
// on master & slave cluster
create ‘reptable1’, { NAME => ‘cf1’, REPLICATION_SCOPE => 1}
disable ‘reptable1’
alter ‘reptable1’, NAME => ‘cf1’, REPLICATION_SCOPE => ‘1’
enable ‘reptable1’
add_peer ‘1’, ‘l-master1:2181:/hbase’
start_replication
-- cluster1
put ‘reptable1’, ‘row1’, ‘cf1:v1’, ‘foo’
-- cluster2
scan ‘ reptable1’
-- verify replication
hadoop jar $HBASE_HOME/hbase-0.92.1.jar verifyrep 1 reptable1
-- disable replication
remove_peer ‘1’
-- commands
add_peer, append_peer_tableCFs, disable_peer, enable_peer, list_peers, list_replicated_tables, remove_peer, remove_peer_tableCFs, set_peer_tableCFs, show_peer_tableCFs
status 'replication'
status 'replication', 'source'
status 'replication', 'sink'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment