zoukankan      html  css  js  c++  java
  • Azure HDInsight HBase DR解决方案

      Sat, Feb 28 2015 3:07 AM 

    Apache HBase是目前非常流行的NoSQL数据库,通过HDFS+Zookeep+Master+Region Server的架构避免了单点故障具有很高的可靠性。在Azure HDInsight中的HBase也提供了相应的功能,通过Azure Storage来代替HDFS并提供了3个zookeeper及在多个workernode上的region server,并提供每月99.9%的SLA。但是对于一些更苛刻的场景,用户还需要DR的方案来保证业务的连续性。Apache HBase自身提供了Replication的功能,这种功能类似于MySQL里面的Master-Salve部署模式,我们可以部署2套Apache HBase Cluster来实现DR的要求。在Azure的数据中心设计时,我们也考虑到DR的情况,在每一个区域我们都提供了2个互为灾备的数据中心,在中国我们有北部和东部2个数据中心来做数据中心间的灾备,这样我们就可以利用Azure的资源来设计HBase的灾备解决方案了。

    首先在设计Azure HDInsight HBase灾备的前提是网络层面的互通。Azure是一种多租户的环境,每隔客户之间的网络是相互隔离的,即便是一个客户的订阅下,北部数据中心和东部数据中心的网络也是不能互通的。为了达到这种互通的效果,我们需要借助Azure Virtual Network以及Site-to-Site VPN技术将2个数据中心的网络层进行互联,具体可以参考 https://msdn.microsoft.com/library/azure/dn133795.aspx

    其次我们还需要处理名称解析的问题。处于安全考虑Azure默认提供的DNS只能解析一个云服务内的名称解析,对于这种跨Azure数据中心的名称解析,我们可以通过自己搭建DNS并在虚拟网络里设定DNS的方法来处理,将2个Cluster里面的服务器通过手工的方法注册到DNS之中。

    最后的步骤就是创建HBase Cluster了。由于需要在部署Hbase的时候指定虚拟网络并修改hbase-site.xml,所以我们需要通过Powershell脚本的方式来创建。下面的示例脚本可以帮我们在2个数据中心中创建我们需要的2个cluster

    #default storage account name for HDInsight cluster

    $storageAccountName01="Your storage account name in China North"

    $storageAccountName02="Your storage account name in China East"

    #default storage container name for HDInsight cluster, the container is used to save the hadoop system files and samples

    $containerName01="Your cluster storage account container name in China North"

    $containerName02="Your cluster storage account container name in China East"

    #get storage primary access key

    $storageAccountKey01=Get-AzureStorageKey $storageAccountName01| %{$_.Primary}

    $storageAccountKey02=Get-AzureStorageKey $storageAccountName02| %{$_.Primary}

    #define cluster name

    $clusterName01="Your cluster Name in China North"

    $clusterName02="Your cluster name in China East"

    #define cluster location

    $location01="China North"

    $location02="China East"

    #define cluster node count

    $clusterNodes=1

    #define hadoop cluster username and password

    $clusterUserName="your admin name"

    $clusterPassword="your admin password”

    $password=ConvertTo-SecureString $clusterPassword -AsPlainText -Force

    $cred=New-Object System.Management.Automation.PSCredential($clusterUserName,$password)

    #define Chine HDInsight endpoint

    $MCEndpoint="core.chinacloudapi.cn"

    $VNetName01="Your vnet name in China North"

    $SubnetName01="Your subnet name in China North"

    $VNetName02=" Your vnet name in China East"

    $SubnetName02=" Your subnet name in China East"

    $vnetID01=(Get-AzureVNetSite -VNetName $VNetName01).Id

    $vnetID02=(Get-AzureVNetSite -VNetName $VNetName02).Id

    $HBaseConfig=New-Object Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightHBaseConfiguration

    $HBaseConfig.Configuration=@{"hbase.replication"="true"}

    #create cluster, you should remove Verbose and Debug parameter if you doesn't need detail information.

    $confighbdrbj01 = New-AzureHDInsightClusterConfig -ClusterSizeInNodes $clusterNodes -ClusterType HBase| Set-AzureHDInsightDefaultStorage -StorageAccountName "$storageAccountName01.blob.core.chinacloudapi.cn" -StorageAccountKey $storageAccountKey01 -StorageContainerName $containerName01| Add-AzureHDInsightConfigValues -HBase $HBaseConfig

    $confighbdrbj01.VirtualNetworkId=$vnetID01

    $confighbdrbj01.SubnetName=$SubnetName01

    $confighbdrsh01 = New-AzureHDInsightClusterConfig -ClusterSizeInNodes $clusterNodes -ClusterType HBase| Set-AzureHDInsightDefaultStorage -StorageAccountName "$storageAccountName02.blob.core.chinacloudapi.cn" -StorageAccountKey $storageAccountKey02 -StorageContainerName $containerName02| Add-AzureHDInsightConfigValues-HBase $HBaseConfig

    $confighbdrsh01.VirtualNetworkId=$vnetID02

    $confighbdrsh01.SubnetName=$SubnetName02

    New-AzureHDInsightCluster -Name $clusterName01 -Config $confighbdrbj01 -Location $location01 -Credential $cred -EndPoint $MCEndpoint -Verbose -Debug 

    New-AzureHDInsightCluster -Name $clusterName02 -Config $confighbdrsh01 -Location $location02 -Credential $cred -EndPoint $MCEndpoint -Verbose -Debug

    剩下的步骤就是在HBase里面配置Peer和table了,具体步骤可以参考http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/replication/package-summary.html

    在Master cluster中添加peer,Zookeeper Quorum是指Slave Cluster的Zookeeper Qourum,可以通过http://azure.microsoft.com/en-us/documentation/articles/hdinsight-hbase-provision-vnet
    里面提供的方法来获取,或者直接开启RDP登陆查看hbase-site.xml

    add_peer '1','{ZookeeperQuorum}:2181:/hbase'

    create ‘sampletable’,'cf1',{NAME=>'cf1',REPLICATION_SCOPE=>'1'}

    然后再Slave cluster里面创建相同的table,这样就可以完成了。

    Wei & Yiyu

    如果你有任何疑问,欢迎访问MSDN社区,由专家来为您解答Windows Azure各种技术问题,或者拨打世纪互联客户服务热线400-089-0365/010-84563652咨询各类服务信息

    本文转载自: http://blogs.msdn.com/b/cciccat/archive/2015/02/28/azure-hdinsight-hbase-dr.aspx 


    
  • 相关阅读:
    换个角度看Salesforce之基础配置学习笔记(二)
    换个角度看Salesforce之基础配置学习笔记(一)
    C# LINQ学习笔记
    Oracle使用总结
    UML图及Visio 2010使用总结
    常见的DOS命令
    ansible笔记
    jsoncpp1.9.4源码解析
    fabric链码
    fabric数据结构
  • 原文地址:https://www.cnblogs.com/new0801/p/6176147.html
Copyright © 2011-2022 走看看