8.3. 配置 iSCSI 目标


通常,对 Ceph 存储集群的块级访问仅限于 QEMU 和 librbd,这是在 OpenStack 环境中采用的关键推动因素。Ceph 存储群集的块级别访问现在可以利用 iSCSI 标准来提供数据存储。

先决条件

  • Red Hat Enterprise Linux 7.5 或更高版本。
  • 正在运行的 Red Hat Ceph Storage 集群,版本 3.1 或更高版本。
  • iSCSI 网关节点,它们可以与 OSD 节点或专用节点上在一起。
  • iSCSI 网关节点上的有效的 Red Hat Enterprise Linux 7 和 Red Hat Ceph Storage 3.3 权利/订阅。
  • 为 iSCSI 前端流量和 Ceph 后端流量分隔网络子网。

可以使用 Ansible 或命令行界面部署 Ceph iSCSI 网关。

8.3.1. 使用 Ansible 配置 iSCSI 目标

要求:

  • Red Hat Enterprise Linux 7.5 或更高版本。
  • 正在运行的 Red Hat Ceph Storage 3 或更高版本。

安装:

  1. 在 iSCSI 网关节点上,启用 Red Hat Ceph Storage 3 Tools 存储库。详情请参阅 Red Hat Enterprise Linux 安装指南中的启用 Red Hat Ceph Storage 存储库 一节

    1. 安装 ceph-iscsi-config 软件包:

      # yum install ceph-iscsi-config
  2. 在 Ansible 管理节点上,以 root 用户身份执行以下步骤:

    1. 启用 Red Hat Ceph Storage 3 Tools 存储库。详情请参阅 Red Hat Enterprise Linux 安装指南中的启用 Red Hat Ceph Storage 存储库 一节
    2. 安装 ceph-ansible 软件包:

      # yum install ceph-ansible
    3. /etc/ansible/hosts 文件中为 gateway 组添加一个条目:

      [iscsigws]
      ceph-igw-1
      ceph-igw-2
      注意

      如果与 OSD 节点共存 iSCSI 网关,请将 OSD 节点添加到 [iscsigws] 部分中。

配置:

ceph-ansible 软件包将文件放在 /usr/share/ceph-ansible/group_vars/ 目录中,名为 iscsigws.yml.sample

  1. 创建 iscsigws.yml.sample 文件的副本,并将其命名为 iscsigws.yml

    重要

    新文件名(iscsigws.yml)和新部分标题([iscsigws])仅适用于 Red Hat Ceph Storage 3.1 或更高版本。从以前的 Red Hat Ceph Storage 升级到 3.1 将仍然使用旧的文件名(iscsi-gws.yml)和旧部分标题([iscsi-gws])。

  2. 打开 iscsigws.yml 文件进行编辑。
  3. 取消注释 gateway_ip_list 选项,并使用 IPv4 或 IPv6 地址相应地更新值。

    例如,添加两个网关,其 IPv4 地址为 10.172.19.21 和 10.172.19.22,配置 gateway_ip_list,如下所示:

    gateway_ip_list: 10.172.19.21,10.172.19.22
    重要

    gateway_ip_list 选项提供 IP 地址是必需的。您不能混合使用 IPv4 和 IPv6 地址。

  4. 取消注释 rbd_devices 变量并相应地更新值,例如:

    rbd_devices:
      - { pool: 'rbd', image: 'ansible1', size: '30G', host: 'ceph-1', state: 'present' }
      - { pool: 'rbd', image: 'ansible2', size: '15G', host: 'ceph-1', state: 'present' }
      - { pool: 'rbd', image: 'ansible3', size: '30G', host: 'ceph-1', state: 'present' }
      - { pool: 'rbd', image: 'ansible4', size: '50G', host: 'ceph-1', state: 'present' }
  5. 取消注释 client_connections 变量并相应地更新值,例如:

    启用 CHAP 身份验证的示例

    client_connections:
      - { client: 'iqn.1994-05.com.redhat:rh7-iscsi-client', image_list: 'rbd.ansible1,rbd.ansible2', chap: 'rh7-iscsi-client/redhat', status: 'present' }
      - { client: 'iqn.1991-05.com.microsoft:w2k12r2', image_list: 'rbd.ansible4', chap: 'w2k12r2/microsoft_w2k12', status: 'absent' }

    禁用 CHAP 身份验证的示例

    client_connections:
      - { client: 'iqn.1991-05.com.microsoft:w2k12r2', image_list: 'rbd.ansible4', chap: '', status: 'present' }
      - { client: 'iqn.1991-05.com.microsoft:w2k16r2', image_list: 'rbd.ansible2', chap: '', status: 'present' }

    重要

    仅在 Red Hat Ceph Storage 3.1 或更高版本上支持 CHAP。红帽不支持混合客户端,有些启用了 CHAP 并禁用了一些 CHAP。所有标记为 present 的客户端都必须启用 CHAP,或者必须禁用 CHAP。

  6. 检查以下 Ansible 变量和描述,并根据需要更新。

    Expand
    表 8.1. iSCSI 网关常规变量
    变量meaning/Purpose

    seed_monitor

     Each gateway needs access to the ceph cluster for rados and rbd calls. This means the iSCSI gateway must have an appropriate /etc/ceph/ directory defined. The seed_monitor host is used to populate the iSCSI gateway’s /etc/ceph/ directory.

    cluster_name

     Define a custom storage cluster name.

    gateway_keyring

     Define a custom keyring name.

    deploy_settings

     If set to true, then deploy the settings when the playbook is ran.

    perform_system_checks

     This is a boolean value that checks for multipath and lvm configuration settings on each gateway. It must be set to true for at least the first run to ensure multipathd and lvm are configured properly.

    gateway_iqn

     This is the iSCSI IQN that all the gateways will expose to clients. This means each client will see the gateway group as a single subsystem.

    gateway_ip_list

     The comma separated ip list defines the IPv4 or IPv6 addresses that will be used on the front end network for iSCSI traffic. This IP will be bound to the active target portal group on each node, and is the access point for iSCSI traffic. Each IP should correspond to an IP available on the hosts defined in the iscsigws.yml host group in /etc/ansible/hosts.

    rbd_devices

     This section defines the RBD images that will be controlled and managed within the iSCSI gateway configuration. Parameters like pool and image are self explanatory. Here are the other parameters:
    size = This defines the size of the RBD. You may increase the size later, by simply changing this value, but shrinking the size of an RBD is not supported and is ignored.
    host = This is the iSCSI gateway host name that will be responsible for the rbd allocation/resize. Every defined rbd_device entry must have a host assigned.
    state = This is typical Ansible syntax for whether the resource should be defined or removed. A request with a state of absent will first be checked to ensure the rbd is not mapped to any client. If the RBD is unallocated, it will be removed from the iSCSI gateway and deleted from the configuration.

    client_connections

     This section defines the iSCSI client connection details together with the LUN (RBD image) masking. Currently only CHAP is supported as an authentication mechanism. Each connection defines an image_list which is a comma separated list of the form pool.rbd_image[,pool.rbd_image,…​]. RBD images can be added and removed from this list, to change the client masking. Note, that there are no checks done to limit RBD sharing across client connections.

    Expand
    表 8.2. iSCSI 网关 RBD-TARGET-API 变量
    变量meaning/Purpose

    api_user

    API 的用户名。默认值为 admin

    api_password

    使用 API 的密码。默认值为 admin

    api_port

    使用 API 的 TCP 端口号。默认值为 5000

    api_secure

    值可以是 truefalse。默认值为 false

    loop_delay

    控制轮询 iSCSI 管理对象所需的睡眠间隔(以秒为单位)。默认值为 1

    trusted_ip_list

    有权访问 API 的 IPv4 或 IPv6 地址列表。默认情况下,只有 iSCSI 网关节点有权访问。

    重要

    对于 rbd_devices,池名称或镜像名称中没有句点(.)。

    警告

    网关配置更改一次仅受一个网关的支持。尝试通过多个网关同时运行更改可能会导致配置不稳定和不一致。

    警告

    在运行 ansible-playbook 命令时,Ansible 将安装 ceph-iscsi-cli 软件包,然后根据 group_vars/iscsigws.yml 文件中的设置更新 /etc/ceph/iscsi-gateway.cfg 文件。如果您之前使用 命令行安装过程 安装了 ceph-iscsi-cli 软件包,则 iscsi-gateway.cfg 文件中的现有设置必须复制到 group_vars/iscsigws.yml 文件中。

    请参阅 附录 A, iscsigws.yml 文件示例 查看完整的 iscsigws.yml.sample 文件。

部署:

在 Ansible 管理节点上,以 root 用户身份执行以下步骤。

  1. 执行 Ansible playbook:

    # cd /usr/share/ceph-ansible
    # ansible-playbook site.yml
    注意

    Ansible playbook 将处理 RPM 依赖项、RBD 创建和 Linux iSCSI 目标配置。

    警告

    在独立 iSCSI 网关节点上,验证是否启用了正确的 Red Hat Ceph Storage 3.3 软件存储库。如果它们不可用,则会安装错误的软件包。

  2. 运行以下命令验证配置:

    # gwcli ls
    重要

    不要使用 targetcli 实用程序来更改配置,这会导致以下问题: ALUA 配置错误和路径故障转移问题。可能会导致数据损坏,跨 iSCSI 网关进行不匹配的配置,并且 WWN 信息不匹配,从而导致客户端路径问题。

服务管理:

ceph-iscsi-config 软件包将安装配置管理逻辑和名为 rbd-target-gw 的 Systemd 服务。启用 Systemd 服务后,rbd-target-gw 将在引导时启动,并将恢复 Linux iSCSI 目标状态。使用 Ansible playbook 部署 iSCSI 网关会禁用目标服务。

# systemctl start rbd-target-gw

以下是与 rbd-target-gw Systemd 服务交互的结果。

# systemctl <start|stop|restart|reload> rbd-target-gw
reload
重新加载请求将强制 rbd-target-gw 重新读取配置并将其应用到当前运行的环境。这通常不需要,因为更改是从 Ansible 并行部署到所有 iSCSI 网关节点。
stop
停止请求将关闭网关的门户接口,丢弃与客户端的连接,并从内核中擦除当前的 Linux iSCSI 目标配置。这会将 iSCSI 网关返回到干净的状态。当客户端断开连接时,活跃 I/O 通过客户端多路径重新调度到其他 iSCSI 网关。

管理:

/usr/share/ceph-ansible/group_vars/iscsigws.yml 文件中,Ansible playbook 支持很多操作工作流。

警告

红帽不支持管理 Ceph iSCSI 网关工具导出的 RBD 镜像,如 gwcliceph-ansible。此外,使用 rbd 命令重命名或删除 Ceph iSCSI 网关导出的 RBD 镜像可能会导致存储集群不稳定。

警告

在从 iSCSI 网关配置移除 RBD 镜像之前,请遵循从操作系统中删除存储设备的标准步骤。

有关使用 Red Hat Enterprise Linux 7 的客户端和服务器,有关删除设备的详情,请参阅 Red Hat Enterprise Linux 7 存储管理指南

Expand
表 8.3. 操作工作流
我希望…​通过…​ 更新 iscsigws.yml 文件

添加更多 RBD 镜像

使用新镜像在 rbd_devices 部分添加另一个条目。

重新定义现有 RBD 镜像的大小

更新 rbd_devices 部分中的 size 参数。需要客户端侧操作才能获取磁盘的新大小。

添加客户端

client_connections 部分添加一个条目。

向客户端添加另一个 RBD

将相关的 RBD pool.image 名称添加到客户端的 image_list 变量中。

从客户端中删除 RBD

从客户端 image_list 变量中删除 RBD pool.image 名称。

从系统中删除 RBD

将 RBD 条目 state 变量更改为 absent。RBD 镜像必须首先从操作系统中未分配,才能成功。

更改客户端 CHAP 凭证

更新 client_connections 中的相关 CHAP 详情。这将需要与客户端协调。例如,客户端发出 iSCSI 注销,凭据由 Ansible playbook 更改,凭据会在客户端上更改,然后客户端执行 iSCSI 登录。

删除客户端

更新相关的 client_connections 项目,其状态为 absent。运行 Ansible playbook 后,客户端将从系统清除,但磁盘将保持定义为 Linux iSCSI 目标,以便潜在的重复使用。

进行更改后,重新运行 Ansible playbook,以在 iSCSI 网关节点之间应用更改。

# ansible-playbook site.yml

删除配置:

  1. 在清除 iSCSI 网关配置前断开所有 iSCSI 启动器。对适当的操作系统按照以下步骤操作:

    1. Red Hat Enterprise Linux 启动程序:

      语法

      iscsiadm -m node -T $TARGET_NAME --logout

      $TARGET_NAME 替换为配置的 iSCSI 目标名称。

      示例

      # iscsiadm -m node -T iqn.2003-01.com.redhat.iscsi-gw:ceph-igw --logout
      Logging out of session [sid: 1, target: iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw, portal: 10.172.19.21,3260]
      Logging out of session [sid: 2, target: iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw, portal: 10.172.19.22,3260]
      Logout of [sid: 1, target: iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw, portal: 10.172.19.21,3260] successful.
      Logout of [sid: 2, target: iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw, portal: 10.172.19.22,3260] successful.

    2. Windows 启动器:

      详情请查看 Microsoft 文档

    3. VMware ESXi 启动器:

      如需了解更多详细信息,请参阅 VMware 文档

  2. 在 Ansible 管理节点上,以 Ansbile 用户身份更改为 /usr/share/ceph-ansible/ 目录:

    [user@admin ~]$ cd /usr/share/ceph-ansible/
  3. 运行 Ansible playbook 以删除 iSCSI 网关配置:

    [user@admin ceph-ansible]$ ansible-playbook purge-cluster.yml --limit iscsigws
  4. 在 Ceph monitor 或客户端节点上,以 root 用户身份删除 iSCSI 网关配置对象(gateway.conf):

    [root@mon ~]# rados rm -p pool gateway.conf
  5. 可选。

    如果不再需要导出的 Ceph RADOS 块设备(RBD),则移除 RBD 镜像。以 root 用户身份在 Ceph 监控或客户端 节点上运行以下命令

    语法

    rbd rm $IMAGE_NAME

    $IMAGE_NAME 替换为 RBD 镜像的名称。

    示例

    [root@mon ~]# rbd rm rbd01

8.3.2. 使用命令行界面配置 iSCSI 目标

Ceph iSCSI 网关是 iSCSI 目标节点,也是 Ceph 客户端节点。Ceph iSCSI 网关可以是单机节点,也可以并置在 Ceph 对象存储磁盘(OSD)节点上。完成以下步骤,将安装并配置 Ceph iSCSI 网关以进行基本操作。

要求:

  • Red Hat Enterprise Linux 7.5 或更高版本
  • 正在运行的 Red Hat Ceph Storage 3.3 集群或更新版本
  • 必须安装以下软件包:

    • targetcli-2.1.fb47-0.1.20170815.git5bf3517.el7cp or newer package
    • python-rtslib-2.1.fb64-0.1.20170815.gitec364f3.el7cp or newer package
    • tcmu-runner-1.4.0-0.2.el7cp or newer package
    • openssl-1.0.2k-8.el7 或更新版本的软件包

      重要

      如果这些软件包的早期版本存在,则必须在安装更新的版本前首先删除它们。这些较新的版本必须从 Red Hat Ceph Storage 存储库安装。

在使用 gwcli 工具之前,在存储集群中的所有 Ceph 监控节点上执行以下步骤:

  1. root 用户身份重启 ceph-mon 服务:

    # systemctl restart ceph-mon@$MONITOR_HOST_NAME

    例如:

    # systemctl restart ceph-mon@monitor1

在 Ceph iSCSI 网关节点上以 root 用户身份执行以下步骤,然后继续 安装 部分:

  1. 如果 Ceph iSCSI 网关不在 OSD 节点上并置,则将位于 /etc/ceph/ 中的 Ceph 配置文件从存储集群中正在运行的 Ceph 节点复制到 iSCSI 网关节点。Ceph 配置文件必须存在于 /etc/ceph/ 下的 iSCSI 网关节点上。
  2. 安装和配置 Ceph 命令行界面。详情请参阅 Red Hat Ceph Storage 3 安装指南中的安装 Ceph 命令行界面 一章。
  3. 启用 Ceph 工具存储库:

    # subscription-manager repos --enable=rhel-7-server-rhceph-3-tools-rpms
  4. 如果需要,在防火墙上打开 TCP 端口 3260 和 5000。
  5. 新建或使用现有的 RADOS 块设备 (RBD)。

警告

如果您已使用 Ansible 安装 Ceph iSCSI 网关,请不要使用此流程。

在运行 ansible-playbook 命令时,Ansible 将安装 ceph-iscsi-cli 软件包,然后根据 group_vars/iscsigws.yml 文件中的设置更新 /etc/ceph/iscsi-gateway.cfg 文件。请参阅 要求: 了解更多信息。

安装:

root 用户身份在所有 iSCSI 网关节点上执行以下步骤,除非另有说明。

  1. 安装 ceph-iscsi-cli 软件包:

    # yum install ceph-iscsi-cli
  2. 安装 tcmu-runner 软件包:

    # yum install tcmu-runner
  3. 如果需要,安装 openssl 软件包:

    # yum install openssl
    1. 在主 iSCSI 网关节点上,创建一个目录来存放 SSL 密钥:

      # mkdir ~/ssl-keys
      # cd ~/ssl-keys
    2. 在主 iSCSI 网关节点上,创建证书和密钥文件:

      # openssl req -newkey rsa:2048 -nodes -keyout iscsi-gateway.key -x509 -days 365 -out iscsi-gateway.crt
      注意

      系统将提示您输入环境信息。

    3. 在主 iSCSI 网关节点上,创建一个 PEM 文件:

      # cat iscsi-gateway.crt iscsi-gateway.key > iscsi-gateway.pem
    4. 在主 iSCSI 网关节点上,创建一个公钥:

      # openssl x509 -inform pem -in iscsi-gateway.pem -pubkey -noout > iscsi-gateway-pub.key
    5. 从主 iSCSI 网关节点,将 iscsi-gateway.crtiscsi-gateway.pemiscsi-gateway-pub.keyiscsi-gateway.key 文件复制到其他 iSCSI 网关节点上的 /etc/ceph/ 目录中。
  4. /etc/ceph/ 目录中创建一个名为 iscsi-gateway.cfg 的文件:

    # touch /etc/ceph/iscsi-gateway.cfg
    1. 编辑 iscsi-gateway.cfg 文件并添加以下几行:

      语法

      [config]
      cluster_name = <ceph_cluster_name>
      gateway_keyring = <ceph_client_keyring>
      api_secure = true
      trusted_ip_list = <ip_addr>,<ip_addr>

      示例

      [config]
      cluster_name = ceph
      gateway_keyring = ceph.client.admin.keyring
      api_secure = true
      trusted_ip_list = 192.168.0.10,192.168.0.11

      有关这些选项的详情,请参阅 要求: 中的表 8.1 和 8.2。

      重要

      在所有 iSCSI 网关节点上,iscsi-gateway.cfg 文件都必须相同。

    2. iscsi-gateway.cfg 文件复制到所有 iSCSI 网关节点。
  5. 启用并启动 API 服务:

    # systemctl enable rbd-target-api
    # systemctl start rbd-target-api

配置:

  1. 启动 iSCSI 网关命令行界面:

    # gwcli
  2. 使用 IPv4 或 IPv6 地址创建 iSCSI 网关:

    语法

    >/iscsi-target create iqn.2003-01.com.redhat.iscsi-gw:<target_name>
    > goto gateways
    > create <iscsi_gw_name> <IP_addr_of_gw>
    > create <iscsi_gw_name> <IP_addr_of_gw>

    示例

    >/iscsi-target create iqn.2003-01.com.redhat.iscsi-gw:ceph-igw
    > goto gateways
    > create ceph-gw-1 10.172.19.21
    > create ceph-gw-2 10.172.19.22

    重要

    您不能混合使用 IPv4 和 IPv6 地址。

  3. 添加 RADOS 块设备(RBD):

    语法

    > cd /disks
    >/disks/ create <pool_name> image=<image_name> size=<image_size>m|g|t max_data_area_mb=<buffer_size>

    示例

    > cd /disks
    >/disks/ create rbd image=disk_1 size=50g max_data_area_mb=32

    重要

    池名称或镜像名称中不能有任何句点(.)。

    警告

    max_data_area_mb 选项控制每个镜像可用于在 iSCSI 目标和 Ceph 集群之间传递 SCSI 命令数据的内存量(以兆字节为单位)。如果这个值太小,则可能会导致过量队列完全重试,这会影响性能。如果值太大,则可能会导致一个磁盘使用过多系统内存,这可能会导致其他子系统的分配失败。默认值为 8。

    可以使用 gwcli reconfigure 子命令更改此值。该镜像不得被 iSCSI 启动器使用,才能使此命令生效。除非在本文档中指定,或者红帽支持指示您这样做,否则不要使用 gwcli reconfigure 子命令来调整其他选项。

    语法

    >/disks/ reconfigure max_data_area_mb <new_buffer_size>

    示例

    >/disks/ reconfigure max_data_area_mb 64

  4. 创建客户端:

    语法

    > goto hosts
    > create iqn.1994-05.com.redhat:<client_name>
    > auth chap=<user_name>/<password>

    示例

    > goto hosts
    > create iqn.1994-05.com.redhat:rh7-client
    > auth chap=iscsiuser1/temp12345678

    重要

    仅在 Red Hat Ceph Storage 3.1 或更高版本上支持 CHAP。红帽不支持混合客户端,有些启用了 CHAP 并禁用了一些 CHAP。所有客户端都必须启用 CHAP,或者禁用 CHAP。默认的行为是仅通过其启动器名称验证启动器。

    如果启动器无法登录到目标,那么一些启动器可能是错误配置的 CHAP 身份验证。

    示例

    o- hosts ................................ [Hosts: 2: Auth: MISCONFIG]

    在主机级别执行以下命令 重置所有 CHAP 身份验证:

    /> goto hosts
    /iscsi-target...csi-igw/hosts> auth nochap
    ok
    ok
    /iscsi-target...csi-igw/hosts> ls
    o- hosts ................................ [Hosts: 2: Auth: None]
      o- iqn.2005-03.com.ceph:esx ........... [Auth: None, Disks: 4(310G)]
      o- iqn.1994-05.com.redhat:rh7-client .. [Auth: None, Disks: 0(0.00Y)]
  5. 向客户端添加磁盘:

    语法

    >/iscsi-target..eph-igw/hosts> cd iqn.1994-05.com.redhat:<client_name>
    > disk add <pool_name>.<image_name>

    示例

    >/iscsi-target..eph-igw/hosts> cd iqn.1994-05.com.redhat:rh7-client
    > disk add rbd.disk_1

  6. 要确认 API 正确使用 SSL,请查看 https/var/log/rbd-target-api.log 文件,例如:

    Aug 01 17:27:42 test-node.example.com python[1879]:  * Running on https://0.0.0.0:5000/
  7. 下一步是配置 iSCSI 启动器。有关配置 iSCSI 启动器的更多信息,请参阅 第 8.4 节 “配置 iSCSI 启动器”

验证

  1. 验证 iSCSI 网关是否正常工作:

    示例

    /> goto gateways
    /iscsi-target...-igw/gateways> ls
    o- gateways ............................ [Up: 2/2, Portals: 2]
      o- ceph-gw-1  ........................ [ 10.172.19.21 (UP)]
      o- ceph-gw-2  ........................ [ 10.172.19.22 (UP)]

    注意

    如果状态是 UNKNOWN,请检查网络问题和任何错误。如果使用防火墙,请检查是否打开适当的 TCP 端口。检查 iSCSI 网关是否在 trusted_ip_list 选项中列出。验证 rbd-target-api 服务是否在 iSCSI 网关节点上运行。

  2. 要验证启动器是否连接到 iSCSI 目标,您会看到 initiator LOGGED-IN

    示例

    /> goto hosts
    /iscsi-target...csi-igw/hosts> ls
    o- hosts .............................. [Hosts: 1: Auth: None]
      o- iqn.1994-05.com.redhat:rh7-client  [LOGGED-IN, Auth: None, Disks: 0(0.00Y)]

  3. 验证 LUN 是否跨 iSCSI 网关平衡:

    /> goto hosts
    /iscsi-target...csi-igw/hosts> ls
    o- hosts ................................. [Hosts: 2: Auth: None]
      o- iqn.2005-03.com.ceph:esx ............ [Auth: None, Disks: 4(310G)]
      | o- lun 0 ............................. [rbd.disk_1(100G), Owner: ceph-gw-1]
      | o- lun 1 ............................. [rbd.disk_2(10G), Owner: ceph-gw-2]

    在创建磁盘时,将根据启动器的多路径层将 磁盘分配 iSCSI 网关作为其所有者。启动器的多路径层将报告为 ALUA Active-Optimized (AO)状态。其他路径将报告为处于 ALUA Active-non-Optimized (ANO)状态。

    如果 AO 路径失败,则使用其他 iSCSI 网关之一。故障转移网关的排序取决于启动器的多路径层,其中通常基于首先发现的路径。

    目前,LUN 的平衡不是动态的。在创建磁盘时会选择自己的 iSCSI 网关,且无法更改。

8.3.3. 优化 iSCSI 目标的性能

有许多设置控制 iSCSI 目标如何通过网络传输数据。这些设置可用于优化 iSCSI 网关的性能。

警告

只有在由红帽支持团队指示或根据本文档中指定的要求时才更改这些设置。

gwcli reconfigure 子命令

gwcli reconfigure 子命令可控制用于优化 iSCSI 网关性能的设置。

影响 iSCSI 目标性能的设置

  • max_data_area_mb
  • cmdsn_depth
  • immediate_data
  • initial_r2t
  • max_outstanding_r2t
  • first_burst_length
  • max_burst_length
  • max_recv_data_segment_length
  • max_xmit_data_segment_length

其它资源

8.3.4. 添加更多 iSCSI 网关

作为存储管理员,您可以使用 Ansible 或 gwcli 命令行工具将初始两个 iSCSI 网关扩展到四个 iSCSI 网关。添加更多 iSCSI 网关在使用负载平衡和故障转移选项时为您提供更大的灵活性,同时提供更多冗余。

8.3.4.1. 先决条件

  • 正在运行的 Red Hat Ceph Storage 3 集群。
  • 安装 iSCSI 网关软件。
  • 备用节点或现有 OSD 节点。

8.3.4.2. 使用 Ansible 添加更多 iSCSI 网关

您可以使用 Ansible 自动化实用程序添加更多 iSCSI 网关。此流程将两个 iSCSI 网关的默认安装扩展到四个 iSCSI 网关。您可以在独立节点上配置 iSCSI 网关,也可以与现有 OSD 节点共存。

先决条件

  • 正在运行的 Red Hat Ceph Storage 3 集群。
  • 安装 iSCSI 网关软件。
  • 在 Ansible 管理节点上具有 root 用户访问权限.
  • 在新节点上具有 root 用户访问权限.

流程

  1. 在新 iSCSI 网关节点上,启用 Red Hat Ceph Storage 3 Tools 存储库。

    [root@iscsigw ~]# subscription-manager repos --enable=rhel-7-server-rhceph-3-tools-els-rpms

    如需了解更多详细信息 ,请参阅 Red Hat Enterprise Linux 安装指南中的启用 Red Hat Ceph Storage 存储库 一节

  2. 安装 ceph-iscsi-config 软件包:

    [root@iscsigw ~]# yum install ceph-iscsi-config
  3. 附加到网关组的 /etc/ansible/hosts 文件中的列表:

    示例

    [iscsigws]
    ...
    ceph-igw-3
    ceph-igw-4

    注意

    如果与 OSD 节点共存 iSCSI 网关,请将 OSD 节点添加到 [iscsigws] 部分中。

  4. 打开 /usr/share/ceph-ansible/group_vars/iscsigws.yml 文件进行编辑,并将带有 IPv4 地址的额外两个 iSCSI 网关附加到 gateway_ip_list 选项:

    示例

    gateway_ip_list: 10.172.19.21,10.172.19.22,10.172.19.23,10.172.19.24

    重要

    gateway_ip_list 选项提供 IP 地址是必需的。您不能混合使用 IPv4 和 IPv6 地址。

  5. 在 Ansible 管理节点上,以 root 用户身份执行 Ansible playbook:

    # cd /usr/share/ceph-ansible
    # ansible-playbook site.yml
  6. 从 iSCSI 启动器,重新登录以使用新添加的 iSCSI 网关。

其它资源

8.3.4.3. 使用 gwcli 添加更多 iSCSI 网关

您可以使用 gwcli 命令行工具添加更多 iSCSI 网关。此流程将两个 iSCSI 网关的默认扩展为四个 iSCSI 网关。

先决条件

  • 正在运行的 Red Hat Ceph Storage 3 集群。
  • 安装 iSCSI 网关软件。
  • 具有 root 用户对新节点或 OSD 节点的访问权限.

流程

  1. 如果 Ceph iSCSI 网关不在 OSD 节点上并置,则将位于 /etc/ceph/ 目录中的 Ceph 配置文件从存储集群中正在运行的 Ceph 节点复制到新的 iSCSI 网关节点。Ceph 配置文件必须存在于 /etc/ceph/ 目录下的 iSCSI 网关节点上。
  2. 安装和配置 Ceph 命令行界面。详情请参阅 Red Hat Enterprise Linux 的 Red Hat Ceph Storage 3 安装指南中的安装 Ceph 命令行界面 一章。
  3. 在新 iSCSI 网关节点上,启用 Red Hat Ceph Storage 3 Tools 存储库。

    [root@iscsigw ~]# subscription-manager repos --enable=rhel-7-server-rhceph-3-tools-els-rpms

    如需了解更多详细信息 ,请参阅 Red Hat Enterprise Linux 安装指南中的启用 Red Hat Ceph Storage 存储库 一节

  4. 安装 ceph-iscsi-clitcmu-runner 软件包:

    [root@iscsigw ~]# yum install ceph-iscsi-cli tcmu-runner
    1. 如果需要,安装 openssl 软件包:

      [root@iscsigw ~]# yum install openssl
  5. 在其中一个现有 iSCSI 网关节点上,编辑 /etc/ceph/iscsi-gateway.cfg 文件,并使用新 iSCSI 网关节点的新 IP 地址附加 trusted_ip_list 选项。

    示例

    [config]
    ...
    trusted_ip_list = 10.172.19.21,10.172.19.22,10.172.19.23,10.172.19.24

    有关这些选项的更多详细信息 ,请参阅使用 Ansible 表配置 iSCSI 目标

  6. 将更新的 /etc/ceph/iscsi-gateway.cfg 文件复制到所有 iSCSI 网关节点。

    重要

    在所有 iSCSI 网关节点上,iscsi-gateway.cfg 文件都必须相同。

  7. (可选)如果使用 SSL,还可以将 ~/ssl-keys/iscsi-gateway.crt~/ssl-keys/iscsi-gateway.pem~/ssl-keys/iscsi-gateway-pub.key~/ssl-keys/iscsi-gateway.key 文件从其中一个现有 iSCSI 网关节点复制到新 iSCSI 网关节点上的 /etc/ceph/ 目录中。
  8. 在新的 iSCSI 网关节点上启用并启动 API 服务:

    [root@iscsigw ~]# systemctl enable rbd-target-api
    [root@iscsigw ~]# systemctl start rbd-target-api
  9. 启动 iSCSI 网关命令行界面:

    [root@iscsigw ~]# gwcli
  10. 使用 IPv4 或 IPv6 地址创建 iSCSI 网关:

    语法

    >/iscsi-target create iqn.2003-01.com.redhat.iscsi-gw:_TARGET_NAME_
    > goto gateways
    > create ISCSI_GW_NAME IP_ADDR_OF_GW
    > create ISCSI_GW_NAME IP_ADDR_OF_GW

    示例

    >/iscsi-target create iqn.2003-01.com.redhat.iscsi-gw:ceph-igw
    > goto gateways
    > create ceph-gw-3 10.172.19.23
    > create ceph-gw-4 10.172.19.24

    重要

    您不能混合使用 IPv4 和 IPv6 地址。

  11. 从 iSCSI 启动器,重新登录以使用新添加的 iSCSI 网关。

其它资源

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部