创建,分发并初始化rings

创建,分发并初始化rings

在开始启动对象存储服务前,你必须创建初始化account,container和object rings。ring builder创建每个节点用户决定和部署存储体系的配置文件。简单的说,这个指南使用一个region和包括两个最多2^10 (1024) 个分区的zone,每个对象3个副本和在移动分区超过1次时最少1小时时间。对对象存储,一个分区意味着存储设备的一个目录而不是传统的分区表。更多信息,参考`Deployment Guide <http://docs.openstack.org/developer/swift/deployment_guide.html>`__。

注解

在控制节点上执行这些步骤。

创建账户ring

帐户服务器使用帐户 ring 来维护一个容器的列表。

  1. 切换到 ``/etc/swift``目录。

  2. 创建基本 account.builder 文件:

    # swift-ring-builder account.builder create 10 3 1
    

    注解

    这个命令执行后没有输出。

  3. 添加每个节点到 ring 中:

    # swift-ring-builder account.builder \
      add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6002 \
      --device DEVICE_NAME --weight DEVICE_WEIGHT
    

    STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替换为存储节点管理网络的IP地址。将 DEVICE_NAME``替换为同一个存储节点存储设备名称。例如,使用 :ref:`swift-storage` 中的第一个存储节点的 ``/dev/sdb 存储设备,大小为100:

    # swift-ring-builder account.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdb --weight 100
    

    在每个存储节点上面重复执行这个命令。在这个例子的架构中,使用该命令的四个变量:

    # swift-ring-builder account.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdb --weight 100
    Device d0r1z1-10.0.0.51:6002R10.0.0.51:6002/sdb_"" with 100.0 weight got id 0
    # swift-ring-builder account.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6002 --device sdc --weight 100
    Device d1r1z2-10.0.0.51:6002R10.0.0.51:6002/sdc_"" with 100.0 weight got id 1
    # swift-ring-builder account.builder add \
      --region 1 --zone 2 --ip 10.0.0.52 --port 6002 --device sdb --weight 100
    Device d2r1z3-10.0.0.52:6002R10.0.0.52:6002/sdb_"" with 100.0 weight got id 2
    # swift-ring-builder account.builder add \
      --region 1 --zone 2 --ip 10.0.0.52 --port 6002 --device sdc --weight 100
    Device d3r1z4-10.0.0.52:6002R10.0.0.52:6002/sdc_"" with 100.0 weight got id 3
    
  4. 验证 ring 的内容:

    # swift-ring-builder account.builder
    account.builder, build version 4
    1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
    The minimum number of hours before a partition can be reassigned is 1
    The overload factor is 0.00% (0.000000)
    Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
                 0       1     1       10.0.0.51  6002       10.0.0.51              6002      sdb  100.00          0 -100.00
                 1       1     1       10.0.0.51  6002       10.0.0.51              6002      sdc  100.00          0 -100.00
                 2       1     2       10.0.0.52  6002       10.0.0.52              6002      sdb  100.00          0 -100.00
                 3       1     2       10.0.0.52  6002       10.0.0.52              6002      sdc  100.00          0 -100.00
    
  5. 平衡 ring:

    # swift-ring-builder account.builder rebalance
    Reassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00
    

创建容器ring

容器服务器使用容器环来维护对象的列表。但是,它不跟踪对象的位置。

  1. 切换到 ``/etc/swift``目录。

  2. 创建基本``container.builder``文件:

    # swift-ring-builder container.builder create 10 3 1
    

    注解

    这个命令执行后没有输出。

  3. 添加每个节点到 ring 中:

    # swift-ring-builder container.builder \
      add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6001 \
      --device DEVICE_NAME --weight DEVICE_WEIGHT
    

    STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替换为存储节点管理网络的IP地址。将 DEVICE_NAME``替换为同一个存储节点存储设备名称。例如,使用 :ref:`swift-storage` 中的第一个存储节点的 ``/dev/sdb 存储设备,大小为100:

    # swift-ring-builder container.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6001 --device sdb --weight 100
    

    在每个存储节点上面重复执行这个命令。在这个例子的架构中,使用该命令的四个变量:

    # swift-ring-builder container.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6001 --device sdb --weight 100
    Device d0r1z1-10.0.0.51:6001R10.0.0.51:6001/sdb_"" with 100.0 weight got id 0
    # swift-ring-builder container.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6001 --device sdc --weight 100
    Device d1r1z2-10.0.0.51:6001R10.0.0.51:6001/sdc_"" with 100.0 weight got id 1
    # swift-ring-builder container.builder add \
      --region 1 --zone 2 --ip 10.0.0.52 --port 6001 --device sdb --weight 100
    Device d2r1z3-10.0.0.52:6001R10.0.0.52:6001/sdb_"" with 100.0 weight got id 2
    # swift-ring-builder container.builder add \
      --region 1 --zone 2 --ip 10.0.0.52 --port 6001 --device sdc --weight 100
    Device d3r1z4-10.0.0.52:6001R10.0.0.52:6001/sdc_"" with 100.0 weight got id 3
    
  4. 验证 ring 的内容:

    # swift-ring-builder container.builder
    container.builder, build version 4
    1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
    The minimum number of hours before a partition can be reassigned is 1
    The overload factor is 0.00% (0.000000)
    Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
                 0       1     1       10.0.0.51  6001       10.0.0.51              6001      sdb  100.00          0 -100.00
                 1       1     1       10.0.0.51  6001       10.0.0.51              6001      sdc  100.00          0 -100.00
                 2       1     2       10.0.0.52  6001       10.0.0.52              6001      sdb  100.00          0 -100.00
                 3       1     2       10.0.0.52  6001       10.0.0.52              6001      sdc  100.00          0 -100.00
    
  5. 平衡 ring:

    # swift-ring-builder container.builder rebalance
    Reassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00
    

创建对象ring

对象服务器使用对象环来维护对象在本地设备上的位置列表。

  1. 切换到 ``/etc/swift``目录。

  2. 创建基本``object.builder``文件:

    # swift-ring-builder object.builder create 10 3 1
    

    注解

    这个命令执行后没有输出。

  3. 添加每个节点到 ring 中:

    # swift-ring-builder object.builder \
      add --region 1 --zone 1 --ip STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS --port 6000 \
      --device DEVICE_NAME --weight DEVICE_WEIGHT
    

    STORAGE_NODE_MANAGEMENT_INTERFACE_IP_ADDRESS 替换为存储节点管理网络的IP地址。将 DEVICE_NAME``替换为同一个存储节点存储设备名称。例如,使用 :ref:`swift-storage` 中的第一个存储节点的 ``/dev/sdb 存储设备,大小为100:

    # swift-ring-builder object.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6000 --device sdb --weight 100
    

    在每个存储节点上面重复执行这个命令。在这个例子的架构中,使用该命令的四个变量:

    # swift-ring-builder object.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6000 --device sdb --weight 100
    Device d0r1z1-10.0.0.51:6000R10.0.0.51:6000/sdb_"" with 100.0 weight got id 0
    # swift-ring-builder object.builder add \
      --region 1 --zone 1 --ip 10.0.0.51 --port 6000 --device sdc --weight 100
    Device d1r1z2-10.0.0.51:6000R10.0.0.51:6000/sdc_"" with 100.0 weight got id 1
    # swift-ring-builder object.builder add \
      --region 1 --zone 2 --ip 10.0.0.52 --port 6000 --device sdb --weight 100
    Device d2r1z3-10.0.0.52:6000R10.0.0.52:6000/sdb_"" with 100.0 weight got id 2
    # swift-ring-builder object.builder add \
      --region 1 --zone 2 --ip 10.0.0.52 --port 6000 --device sdc --weight 100
    Device d3r1z4-10.0.0.52:6000R10.0.0.52:6000/sdc_"" with 100.0 weight got id 3
    
  4. 验证 ring 的内容:

    # swift-ring-builder object.builder
    object.builder, build version 4
    1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion
    The minimum number of hours before a partition can be reassigned is 1
    The overload factor is 0.00% (0.000000)
    Devices:    id  region  zone      ip address  port  replication ip  replication port      name weight partitions balance meta
                 0       1     1       10.0.0.51  6000       10.0.0.51              6000      sdb  100.00          0 -100.00
                 1       1     1       10.0.0.51  6000       10.0.0.51              6000      sdc  100.00          0 -100.00
                 2       1     2       10.0.0.52  6000       10.0.0.52              6000      sdb  100.00          0 -100.00
                 3       1     2       10.0.0.52  6000       10.0.0.52              6000      sdc  100.00          0 -100.00
    
  5. 平衡 ring:

    # swift-ring-builder object.builder rebalance
    Reassigned 1024 (100.00%) partitions. Balance is now 0.00.  Dispersion is now 0.00
    

分发环配置文件

  • 复制``account.ring.gz``,container.ring.gz``和``object.ring.gz 文件到每个存储节点和其他运行了代理服务的额外节点的 /etc/swift 目录。

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.