您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

在 Azure 虚拟网络中设置 Apache HBase 群集复制Set up Apache HBase cluster replication in Azure virtual networks

了解如何在 Azure 中的一个虚拟网络内部或者在两个虚拟网络之间设置 Apache HBase 复制。Learn how to set up Apache HBase replication within a virtual network, or between two virtual networks in Azure.

群集复制使用源推送方法。Cluster replication uses a source-push methodology. HBase 群集可以是一个源或一个目标,也可以同时充当这两个角色。An HBase cluster can be a source or a destination, or it can fulfill both roles at once. 复制是异步的。Replication is asynchronous. 复制的目标是保持最终一致性。The goal of replication is eventual consistency. 在启用复制的情况下,当源接收到对列系列的编辑时,该编辑将传播到所有目标群集。When the source receives an edit to a column family when replication is enabled, the edit is propagated to all destination clusters. 当数据从一个群集复制到另一个群集,会跟踪源群集和所有已使用数据的群集,防止复制循环。When data is replicated from one cluster to another, the source cluster and all clusters that have already consumed the data are tracked, to prevent replication loops.

在本文中,您将源-目标复制设置。In this article, you set up a source-destination replication. 对于其他群集拓扑,请参阅 Apache HBase 参考指南For other cluster topologies, see the Apache HBase reference guide.

下面是单个虚拟网络的 HBase 复制用例:The following are HBase replication usage cases for a single virtual network:

  • 负载均衡。Load balancing. 例如,可以在目标群集上运行扫描或 MapReduce 作业,在源群集上引入数据。For example, you can run scans or MapReduce jobs on the destination cluster, and ingest data on the source cluster.
  • 添加高可用性。Adding high availability.
  • 在不同的 HBase 群集之间迁移数据。Migrating data from one HBase cluster to another.
  • 将 Azure HDInsight 群集从一个版本升级到另一个版本。Upgrading an Azure HDInsight cluster from one version to another.

下面是两个虚拟网络的 HBase 复制用例:The following are HBase replication usage cases for two virtual networks:

  • 设置灾难恢复。Setting up disaster recovery.
  • 对应用程序进行负载均衡和分区。Load balancing and partitioning the application.
  • 添加高可用性。Adding high availability.

可以使用 GitHub 中的脚本操作脚本复制群集。You can replicate clusters by using script action scripts from GitHub.

必备组件Prerequisites

开始阅读本文之前,必须具有 Azure 订阅。Before you begin this article, you must have an Azure subscription. 请参阅获取 Azure 免费试用版See Get an Azure free trial.

设置环境Set up the environments

有三个配置选项:You have three configuration options:

  • 两个 Apache HBase 群集位于一个 Azure 虚拟网络中。Two Apache HBase clusters in one Azure virtual network.
  • 两个 Apache HBase 群集位于同一区域中的两个不同虚拟网络中。Two Apache HBase clusters in two different virtual networks in the same region.
  • 两个 Apache HBase 群集位于两个不同区域中的两个不同虚拟网络中(异地复制)。Two Apache HBase clusters in two different virtual networks in two different regions (geo-replication).

本文介绍异地复制方案。This article covers the geo-replication scenario.

为了帮助设置环境,我们创建了一些 Azure 资源管理器模板To help you set up the environments, we have created some Azure Resource Manager templates. 如果想要使用其他方法设置环境,请参阅:If you prefer to set up the environments by using other methods, see:

在两个不同的区域中设置两个虚拟网络Set up two virtual networks in two different regions

若要使用模板在两个不同区域创建两个虚拟网络并在 VNet 之间创建 VPN 连接,请选择下面的“部署到 Azure”按钮 。To use a template that creates two virtual networks in two different regions and the VPN connection between the VNets, select the following Deploy to Azure button. 模板定义存储在公共 blob 存储中。The template definition is stored in a public blob storage.

Deploy to Azure

模板中的某些硬编码值:Some of the hard-coded values in the template:

VNet 1VNet 1

属性Property Value
LocationLocation 美国西部West US
VNet 名称VNet name <ClusterNamePrevix>-vnet1<ClusterNamePrevix>-vnet1
地址空间前缀Address space prefix 10.1.0.0/1610.1.0.0/16
子网名称Subnet name 子网 1subnet 1
子网前缀Subnet prefix 10.1.0.0/2410.1.0.0/24
子网(网关)名称Subnet (gateway) name GatewaySubnet(不能更改)GatewaySubnet (can't be changed)
子网(网关)前缀Subnet (gateway) prefix 10.1.255.0/2710.1.255.0/27
网关名称Gateway name vnet1gwvnet1gw
网关类型Gateway type VpnVpn
网关 VPN 类型Gateway VPN type RouteBasedRouteBased
网关 SKUGateway SKU 基本Basic
网关 IPGateway IP vnet1gwipvnet1gwip

VNet 2VNet 2

属性Property Value
LocationLocation East USEast US
VNet 名称VNet name <ClusterNamePrevix>-vnet2<ClusterNamePrevix>-vnet2
地址空间前缀Address space prefix 10.2.0.0/1610.2.0.0/16
子网名称Subnet name 子网 1subnet 1
子网前缀Subnet prefix 10.2.0.0/2410.2.0.0/24
子网(网关)名称Subnet (gateway) name GatewaySubnet(不能更改)GatewaySubnet (can't be changed)
子网(网关)前缀Subnet (gateway) prefix 10.2.255.0/2710.2.255.0/27
网关名称Gateway name vnet2gwvnet2gw
网关类型Gateway type VpnVpn
网关 VPN 类型Gateway VPN type RouteBasedRouteBased
网关 SKUGateway SKU 基本Basic
网关 IPGateway IP vnet1gwipvnet1gwip

设置 DNSSetup DNS

在上一部分,模板在两个虚拟网络的每一个中创建 Ubuntu 虚拟机。In the last section, the template creates an Ubuntu virtual machine in each of the two virtual networks. 在此部分,请先在两个 DNS 虚拟机上安装 Bind,然后在两个虚拟机上配置 DNS 转发。In this section, you install Bind on the two DNS virtual machines, and then configure the DNS forwarding on the two virtual machines.

若要安装 Bind,需找到两个 DNS 虚拟机的公共 IP 地址。To install Bind, yon need to find the public IP address of the two DNS virtual machines.

  1. 打开 Azure 门户Open the Azure portal.
  2. 打开 DNS 虚拟机,方法是选择“资源组”> [资源组名称] > [vnet1DNS] 。Open the DNS virtual machine by selecting Resources groups > [resource group name] > [vnet1DNS]. 资源组名称是在上一过程中创建的。The resource group name is the one you create in the last procedure. 默认的 DNS 虚拟机名称为 vnet1DNSvnet2NDSThe default DNS virtual machine names are vnet1DNS and vnet2NDS.
  3. 选择“属性”,打开虚拟网络的属性页。 Select Properties to open the properties page of the virtual network.
  4. 记下“公共 IP 地址”,并验证“专用 IP 地址” 。Write down the Public IP address, and also verify the Private IP address. vnet1DNS 的专用 IP 地址应该是 10.1.0.4,vnet2DNS 的专用 IP 地址应该是 10.2.0.4The private IP address shall be 10.1.0.4 for vnet1DNS and 10.2.0.4 for vnet2DNS.
  5. 将两个虚拟网络的 DNS 服务器更改为使用默认(Azure 提供的)DNS 服务器以允许对下载包进行入站和出站访问,从而可以按以下步骤安装 Bind。Change the DNS Servers for both virtual networks to use Default (Azure-Provided) DNS servers to allow inbound and outbound access to download packages to install Bind in the following steps.

若要安装 Bind,请执行以下过程:To install Bind, use the following procedure:

  1. 使用 SSH 连接到 DNS 虚拟机的公共 IP 地址 。Use SSH to connect to the public IP address of the DNS virtual machine. 以下示例将在 40.68.254.142 连接到虚拟机:The following example connects to a virtual machine at 40.68.254.142:

    ssh sshuser@40.68.254.142
    

    sshuser 替换为创建 DNS 虚拟机时指定的 SSH 用户帐户。Replace sshuser with the SSH user account you specified when creating the DNS virtual machine.

    备注

    可通过多种方法获取 ssh 实用工具。There are a variety of ways to obtain the ssh utility. 在 Linux、Unix 和 macOS 上,操作系统会附带此实用工具。On Linux, Unix, and macOS, it is provided as part of the operating system. 如果使用的是 Windows,请考虑以下选项之一:If you are using Windows, consider one of the following options:

  2. 若要安装 Bind,请从 SSH 会话中使用以下命令:To install Bind, use the following commands from the SSH session:

    sudo apt-get update -y
    sudo apt-get install bind9 -y
    
  3. 配置 Bind 以将名称解析请求转发到本地 DNS 服务器。Configure Bind to forward name resolution requests to your on premises DNS server. 为此,请使用以下文本作为 /etc/bind/named.conf.options 文件的内容:To do so, use the following text as the contents of the /etc/bind/named.conf.options file:

    acl goodclients {
        10.1.0.0/16; # Replace with the IP address range of the virtual network 1
        10.2.0.0/16; # Replace with the IP address range of the virtual network 2
        localhost;
        localhost;
    };
    
    options {
        directory "/var/cache/bind";
        recursion yes;
        allow-query { goodclients; };
    
        forwarders {
            168.63.129.16; #This is the Azure DNS server
        };
    
        dnssec-validation auto;
    
        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
    };
    

    重要

    goodclients 节中的值替换为两个虚拟网络的 IP 地址范围。Replace the values in the goodclients section with the IP address range of the two virtual networks. 本部分定义此 DNS 服务器从其中接受请求的地址。This section defines the addresses that this DNS server accepts requests from.

    若要编辑此文件,请使用以下命令:To edit this file, use the following command:

    sudo nano /etc/bind/named.conf.options
    

    若要保存文件,请使用 Ctrl+X、Ctrl+Y,然后按 Enter 。To save the file, use Ctrl+X, Y, and then Enter.

  4. 在 SSH 会话中,请使用以下命令:From the SSH session, use the following command:

    hostname -f
    

    此命令会返回类似于以下文本的值:This command returns a value similar to the following text:

     vnet1DNS.icb0d0thtw0ebifqt0g1jycdxd.ex.internal.cloudapp.net
    

    icb0d0thtw0ebifqt0g1jycdxd.ex.internal.cloudapp.net 文本是该虚拟网络的 DNS 后缀 。The icb0d0thtw0ebifqt0g1jycdxd.ex.internal.cloudapp.net text is the DNS suffix for this virtual network. 请保存该值,因为稍后会使用它。Save this value, as it is used later.

    还必须从其他 DNS 服务器中找出 DNS 后缀。You must also find out the DNS suffix from the other DNS server. 因为下一步骤需要用到。You need it in the next step.

  5. 若要配置 Bind 以在虚拟网络中解析资源的 DNS 名称,请使用以下文本作为 /etc/bind/named.conf.local 文件的内容:To configure Bind to resolve DNS names for resources within the virtual network, use the following text as the contents of the /etc/bind/named.conf.local file:

    // Replace the following with the DNS suffix for your virtual network
    zone "v5ant3az2hbe1edzthhvwwkcse.bx.internal.cloudapp.net" {
            type forward;
            forwarders {10.2.0.4;}; # The Azure recursive resolver
    };
    

    重要

    必须将 v5ant3az2hbe1edzthhvwwkcse.bx.internal.cloudapp.net 替换为另一个虚拟网络的 DNS 后缀。You must replace the v5ant3az2hbe1edzthhvwwkcse.bx.internal.cloudapp.net with the DNS suffix of the other virtual network. 转发器 IP 是另一虚拟网络中 DNS 服务器的专用 IP 地址。And the forwarder IP is the private IP address of the DNS server in the other virtual network.

    若要编辑此文件,请使用以下命令:To edit this file, use the following command:

    sudo nano /etc/bind/named.conf.local
    

    若要保存文件,请使用 Ctrl+X、Ctrl+Y,然后按 Enter 。To save the file, use Ctrl+X, Y, and then Enter.

  6. 若要启动 Bind,请使用以下命令:To start Bind, use the following command:

    sudo service bind9 restart
    
  7. 若要验证绑定是否可以解析另一虚拟网络中的资源名称,请使用以下命令:To verify that bind can resolve the names of resources in the other virtual network, use the following commands:

    sudo apt install dnsutils
    nslookup vnet2dns.v5ant3az2hbe1edzthhvwwkcse.bx.internal.cloudapp.net
    

    重要

    vnet2dns.v5ant3az2hbe1edzthhvwwkcse.bx.internal.cloudapp.net 替换为另一网络中 DNS 虚拟机的完全限定的域名 (FQDN)。Replace vnet2dns.v5ant3az2hbe1edzthhvwwkcse.bx.internal.cloudapp.net with the fully qualified domain name (FQDN) of the DNS virtual machine in the other network.

    10.2.0.4 替换为另一虚拟网络中自定义 DNS 服务器的内部 IP 地址 。Replace 10.2.0.4 with the internal IP address of your custom DNS server in the other virtual network.

    显示的响应如下文所示:The response appears similar to the following text:

    Server:         10.2.0.4
    Address:        10.2.0.4#53
    
    Non-authoritative answer:
    Name:   vnet2dns.v5ant3az2hbe1edzthhvwwkcse.bx.internal.cloudapp.net
    Address: 10.2.0.4
    

    到目前为止,如果不指定 DNS 服务器 IP 地址,则无法查找另一网络中的 IP 地址。Until now, you cannot look up the IP address from the other network without specified DNS server IP address.

配置虚拟网络以使用自定义 DNS 服务器Configure the virtual network to use the custom DNS server

若要配置虚拟网络以使用自定义 DNS 服务器,而不是 Azure 递归解析程序,请使用以下步骤:To configure the virtual network to use the custom DNS server instead of the Azure recursive resolver, use the following steps:

  1. Azure 门户中,选择“虚拟网络”,然后选择“DNS 服务器” 。In the Azure portal, select the virtual network, and then select DNS Servers.

  2. 选择“自定义”,然后输入自定义 DNS 服务器的内部 IP 地址 。Select Custom, and enter the internal IP address of the custom DNS server. 最后,选择“保存” 。Finally, select Save.

  3. 打开 vnet1 中的 DNS 服务器虚拟机,然后单击“重启”。 Open the DNS server virtual machine in vnet1, and click Restart. 必须重启虚拟网络中的所有虚拟机才能使 DNS 配置生效。You must restart all the virtual machines in the virtual network to make the DNS configuration to take effect.

  4. 重复这些步骤即可为 vnet2 配置自定义 DNS 服务器。Repeat steps configure the custom DNS server for vnet2.

若要测试 DNS 配置,可以使用 SSH 连接到这两个 DNS 虚拟机,然后使用其主机名称 ping 另一虚拟网络的 DNS 服务器。To test the DNS configuration, you can connect to the two DNS virtual machines using SSH, and ping the DNS server of the other virtual network by using its host name. 如果不起作用,请使用以下命令来检查 DNS 状态:If it doesn't work, use the following command to check DNS status:

sudo service bind9 status

创建 Apache HBase 群集Create Apache HBase clusters

使用以下配置在这两个虚拟网络的每一个中创建 Apache HBase 群集:Create an Apache HBase cluster in each of the two virtual networks with the following configuration:

  • 资源组名称:使用的资源组名称与创建虚拟网络时所用的相同。Resource group name: use the same resource group name as you created the virtual networks.
  • 群集类型:HBaseCluster type: HBase
  • 版本:HBase 1.1.2 (HDI 3.6)Version: HBase 1.1.2 (HDI 3.6)
  • 位置:使用与虚拟网络相同的位置。Location: Use the same location as the virtual network. 默认情况下,vnet1 为“美国西部”, vnet2 为“美国东部”。 By default, vnet1 is West US, and vnet2 is East US.
  • 存储:为群集创建新的存储帐户。Storage: Create a new storage account for the cluster.
  • 虚拟网络(在门户的“高级设置”中):选择在上一过程中创建的 vnet1。Virtual network (from Advanced settings on the portal): Select vnet1 you created in the last procedure.
  • 子网:模板中所用的默认名称为 subnet1Subnet: The default name used in the template is subnet1.

若要确保正确配置环境,必须能够在两个群集之间 ping 头节点的 FQDN。To ensure the environment is configured correctly, you must be able to ping the headnode's FQDN between the two clusters.

加载测试数据Load test data

复制群集时,必须指定要复制的表。When you replicate a cluster, you must specify the tables that you want to replicate. 在本节中,要将一些数据载入源群集。In this section, you load some data into the source cluster. 在下一部分,会在两个群集之间启用复制。In the next section, you will enable replication between the two clusters.

若要创建一个“联系人”表并在其中插入一些数据,请按照 Apache HBase 教程 :开始在 HDInsight 中使用 Apache HBase 中的说明进行操作。To create a Contacts table and insert some data in the table, follow the instructions at Apache HBase tutorial: Get started using Apache HBase in HDInsight.

启用复制Enable replication

以下步骤说明如何从 Azure 门户调用脚本操作脚本。The following steps describe how to call the script action script from the Azure portal. 有关使用 Azure PowerShell 和 Azure 经典 CLI 运行脚本操作的信息,请参阅使用脚本操作自定义 HDInsight 群集For information about running a script action by using Azure PowerShell and the Azure Classic CLI, see Customize HDInsight clusters by using script action.

从 Azure 门户启用 HBase 复制To enable HBase replication from the Azure portal

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 打开源 HBase 群集。Open the source HBase cluster.

  3. 在群集菜单中,选择“脚本操作”。 In the cluster menu, select Script Actions.

  4. 在页面顶部,选择“提交新项”。 At the top of the page, select Submit New.

  5. 选择或输入以下信息:Select or enter the following information:

    1. 名称:输入“启用复制” 。Name: Enter Enable replication.

    2. Bash 脚本 URL:输入 https://raw.githubusercontent.com/Azure/hbase-utils/master/replication/hdi_enable_replication.shBash Script URL: Enter https://raw.githubusercontent.com/Azure/hbase-utils/master/replication/hdi_enable_replication.sh.

    3. :确保已选定。Head: Ensure this is selected. 清除其他节点类型。Clear the other node types.

    4. 参数:以下示例参数将对所有现有表启用复制,并将源群集中的所有数据复制到目标群集:Parameters: The following sample parameters enable replication for all existing tables, and then copy all data from the source cluster to the destination cluster:

      -m hn1 -s <source hbase cluster name> -d <destination hbase cluster name> -sp <source cluster Ambari password> -dp <destination cluster Ambari password> -copydata
      

      备注

      对源和目标群集 DNS 名称使用主机名而不是 FQDN。Use hostname instead of FQDN for both the source and destination cluster DNS name.

  6. 选择“创建” 。Select Create. 该脚本可能会运行一段时间,尤其是在使用 -copydata 参数的情况下。The script can take a while to run, especially when you use the -copydata argument.

必需参数:Required arguments:

名称Name 描述Description
-s、--src-cluster-s, --src-cluster 指定源 HBase 群集的 DNS 名称。Specifies the DNS name of the source HBase cluster. 例如:-s hbsrccluster、--src-cluster=hbsrcclusterFor example: -s hbsrccluster, --src-cluster=hbsrccluster
-d、--dst-cluster-d, --dst-cluster 指定目标(副本)HBase 群集的 DNS 名称。Specifies the DNS name of the destination (replica) HBase cluster. 例如:-s dsthbcluster、--src-cluster=dsthbclusterFor example: -s dsthbcluster, --src-cluster=dsthbcluster
-sp、--src-ambari-password-sp, --src-ambari-password 指定源 HBase 群集的 Ambari 管理员密码。Specifies the admin password for Ambari on the source HBase cluster.
-dp、--dst-ambari-password-dp, --dst-ambari-password 指定目标 HBase 群集的 Ambari 管理员密码。Specifies the admin password for Ambari on the destination HBase cluster.

可选参数:Optional arguments:

名称Name 描述Description
-su、--src-ambari-user-su, --src-ambari-user 指定源 HBase 群集的 Ambari 管理员用户名。Specifies the admin user name for Ambari on the source HBase cluster. 默认值为 adminThe default value is admin.
-du、--dst-ambari-user-du, --dst-ambari-user 指定目标 HBase 群集的 Ambari 管理员用户名。Specifies the admin user name for Ambari on the destination HBase cluster. 默认值为 adminThe default value is admin.
-t、--table-list-t, --table-list 指定要复制的表。Specifies the tables to be replicated. 例如:--table-list="table1;table2;table3"。For example: --table-list="table1;table2;table3". 如果不指定表,将复制所有现有的 HBase 表。If you don't specify tables, all existing HBase tables are replicated.
-m、--machine-m, --machine 指定要在其中运行脚本操作的头节点。Specifies the head node where the script action runs. 值为 hn0hn1,并且应当根据活动的头节点进行选择。The value is either hn0 or hn1 and should be chosen based on which is the active head node. 在 HDInsight 门户或 Azure PowerShell 中以脚本操作的形式运行 $0 脚本时,可使用此选项。Use this option when you're running the $0 script as a script action from the HDInsight portal or Azure PowerShell.
-cp、-copydata-cp, -copydata 在启用复制的情况下,允许迁移表中的现有数据。Enables the migration of existing data on the tables where replication is enabled.
-rpm、-replicate-phoenix-meta-rpm, -replicate-phoenix-meta 针对 Phoenix 系统表启用复制。Enables replication on Phoenix system tables.

请谨慎使用此选项。Use this option with caution. 建议在使用此脚本之前,在副本群集上重新创建 Phoenix 表。We recommend that you re-create Phoenix tables on replica clusters before you use this script.
-h、--help-h, --help 显示用法信息。Displays usage information.

脚本print_usage() 节中提供了详细的参数说明。The print_usage() section of the script has a detailed explanation of parameters.

成功部署脚本操作后,可以使用 SSH 连接到目标 HBase 群集,并验证是否已复制数据。After the script action is successfully deployed, you can use SSH to connect to the destination HBase cluster, and then verify that the data has been replicated.

复制方案Replication scenarios

以下列表显示了一些普通用例及其参数设置:The following list shows you some general usage cases and their parameter settings:

  • 针对两个群集之间的所有表启用复制Enable replication on all tables between the two clusters. 此方案不需要复制或迁移表中的现有数据,也不使用 Phoenix 表。This scenario does not require copying or migrating existing data in the tables, and it does not use Phoenix tables. 使用以下参数:Use the following parameters:

      -m hn1 -s <source hbase cluster name> -d <destination hbase cluster name> -sp <source cluster Ambari password> -dp <destination cluster Ambari password>  
    
  • 针对特定的表启用复制Enable replication on specific tables. 若要针对 table1、table2 和 table3 启用复制,请使用以下参数:To enable replication on table1, table2, and table3, use the following parameters:

      -m hn1 -s <source hbase cluster name> -d <destination hbase cluster name> -sp <source cluster Ambari password> -dp <destination cluster Ambari password> -t "table1;table2;table3"
    
  • 针对特定的表启用复制并复制现有数据Enable replication on specific tables, and copy the existing data. 若要针对 table1、table2 和 table3 启用复制,请使用以下参数:To enable replication on table1, table2, and table3, use the following parameters:

      -m hn1 -s <source hbase cluster name> -d <destination hbase cluster name> -sp <source cluster Ambari password> -dp <destination cluster Ambari password> -t "table1;table2;table3" -copydata
    
  • 针对所有表启用复制,并将 Phoenix 元数据从源复制到目标Enable replication on all tables, and replicate Phoenix metadata from source to destination. Phoenix 元数据复制并不完善,Phoenix metadata replication is not perfect. 请谨慎使用。Use it with caution. 使用以下参数:Use the following parameters:

      -m hn1 -s <source hbase cluster name> -d <destination hbase cluster name> -sp <source cluster Ambari password> -dp <destination cluster Ambari password> -t "table1;table2;table3" -replicate-phoenix-meta
    

复制并迁移数据Copy and migrate data

启用复制后,可以使用两个单独的脚本操作脚本来复制或迁移数据:There are two separate script action scripts available for copying or migrating data after replication is enabled:

可以遵循启用复制中所述的相同过程来调用脚本操作。You can follow the same procedure that's described in Enable replication to call the script action. 使用以下参数:Use the following parameters:

-m hn1 -t <table1:start_timestamp:end_timestamp;table2:start_timestamp:end_timestamp;...> -p <replication_peer> [-everythingTillNow]

脚本print_usage() 节中提供了详细的参数说明。The print_usage() section of the script has a detailed description of parameters.

方案Scenarios

  • 复制特定表(test1、test2 和 test3)中到目前(当前时间戳)为止编辑的所有行Copy specific tables (test1, test2, and test3) for all rows edited until now (current time stamp):

      -m hn1 -t "test1::;test2::;test3::" -p "zk5-hbrpl2;zk1-hbrpl2;zk5-hbrpl2:2181:/hbase-unsecure" -everythingTillNow
    

    或:Or:

      -m hn1 -t "test1::;test2::;test3::" --replication-peer="zk5-hbrpl2;zk1-hbrpl2;zk5-hbrpl2:2181:/hbase-unsecure" -everythingTillNow
    
  • 复制指定时间范围内的特定表Copy specific tables with a specified time range:

      -m hn1 -t "table1:0:452256397;table2:14141444:452256397" -p "zk5-hbrpl2;zk1-hbrpl2;zk5-hbrpl2:2181:/hbase-unsecure"
    

禁用复制Disable replication

若要禁用复制,可以使用 GitHub 中的另一个脚本操作脚本。To disable replication, use another script action script from GitHub. 可以遵循启用复制中所述的相同过程来调用脚本操作。You can follow the same procedure that's described in Enable replication to call the script action. 使用以下参数:Use the following parameters:

-m hn1 -s <source hbase cluster name> -sp <source cluster Ambari password> <-all|-t "table1;table2;...">  

脚本print_usage() 节中提供了详细的参数说明。The print_usage() section of the script has a detailed explanation of parameters.

方案Scenarios

  • 对所有表禁用复制Disable replication on all tables:

      -m hn1 -s <source hbase cluster name> -sp Mypassword\!789 -all
    

    or

      --src-cluster=<source hbase cluster name> --dst-cluster=<destination hbase cluster name> --src-ambari-user=<source cluster Ambari user name> --src-ambari-password=<source cluster Ambari password>
    
  • 对指定的表(table1、table2 和 table3)禁用复制Disable replication on specified tables (table1, table2, and table3):

      -m hn1 -s <source hbase cluster name> -sp <source cluster Ambari password> -t "table1;table2;table3"
    

后续步骤Next steps

在本文中,您学习了如何设置虚拟网络内部或者在两个虚拟网络之间的 Apache HBase 复制。In this article, you learned how to set up Apache HBase replication within a virtual network, or between two virtual networks. 若要了解有关 HDInsight 和 Apache HBase 的详细信息,请参阅以下文章:To learn more about HDInsight and Apache HBase, see these articles: