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 或更高版本。
安装:
在 iSCSI 网关节点上,启用 Red Hat Ceph Storage 3 Tools 存储库。详情请参阅 Red Hat Enterprise Linux 安装指南中的启用 Red Hat Ceph Storage 存储库 一节。
安装
ceph-iscsi-config软件包:# yum install ceph-iscsi-config
在 Ansible 管理节点上,以
root用户身份执行以下步骤:- 启用 Red Hat Ceph Storage 3 Tools 存储库。详情请参阅 Red Hat Enterprise Linux 安装指南中的启用 Red Hat Ceph Storage 存储库 一节。
安装
ceph-ansible软件包:# yum install ceph-ansible在
/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。
创建
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])。-
打开
iscsigws.yml文件进行编辑。 取消注释
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 地址。取消注释
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' }取消注释
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。检查以下 Ansible 变量和描述,并根据需要更新。
Expand 表 8.1. iSCSI 网关常规变量 变量 meaning/Purpose seed_monitorEach 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. Theseed_monitorhost is used to populate the iSCSI gateway’s/etc/ceph/directory.cluster_nameDefine a custom storage cluster name.
gateway_keyringDefine a custom keyring name.
deploy_settingsIf set to
true, then deploy the settings when the playbook is ran.perform_system_checksThis 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_iqnThis 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_listThe 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.ymlhost group in/etc/ansible/hosts.rbd_devicesThis section defines the RBD images that will be controlled and managed within the iSCSI gateway configuration. Parameters like
poolandimageare 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 definedrbd_deviceentry 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_connectionsThis 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_listwhich is a comma separated list of the formpool.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
值可以是
true或false。默认值为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 用户身份执行以下步骤。
执行 Ansible playbook:
# cd /usr/share/ceph-ansible # ansible-playbook site.yml注意Ansible playbook 将处理 RPM 依赖项、RBD 创建和 Linux iSCSI 目标配置。
警告在独立 iSCSI 网关节点上,验证是否启用了正确的 Red Hat Ceph Storage 3.3 软件存储库。如果它们不可用,则会安装错误的软件包。
运行以下命令验证配置:
# 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 镜像,如 gwcli 和 ceph-ansible。此外,使用 rbd 命令重命名或删除 Ceph iSCSI 网关导出的 RBD 镜像可能会导致存储集群不稳定。
在从 iSCSI 网关配置移除 RBD 镜像之前,请遵循从操作系统中删除存储设备的标准步骤。
有关使用 Red Hat Enterprise Linux 7 的客户端和服务器,有关删除设备的详情,请参阅 Red Hat Enterprise Linux 7 存储管理指南。
| 我希望… | 通过… 更新 iscsigws.yml 文件 |
|---|---|
| 添加更多 RBD 镜像 |
使用新镜像在 |
| 重新定义现有 RBD 镜像的大小 |
更新 |
| 添加客户端 |
在 |
| 向客户端添加另一个 RBD |
将相关的 RBD |
| 从客户端中删除 RBD |
从客户端 |
| 从系统中删除 RBD |
将 RBD 条目 state 变量更改为 |
| 更改客户端 CHAP 凭证 |
更新 |
| 删除客户端 |
更新相关的 |
进行更改后,重新运行 Ansible playbook,以在 iSCSI 网关节点之间应用更改。
# ansible-playbook site.yml
删除配置:
在清除 iSCSI 网关配置前断开所有 iSCSI 启动器。对适当的操作系统按照以下步骤操作:
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.Windows 启动器:
详情请查看 Microsoft 文档。
VMware ESXi 启动器:
如需了解更多详细信息,请参阅 VMware 文档。
在 Ansible 管理节点上,以 Ansbile 用户身份更改为
/usr/share/ceph-ansible/目录:[user@admin ~]$ cd /usr/share/ceph-ansible/运行 Ansible playbook 以删除 iSCSI 网关配置:
[user@admin ceph-ansible]$ ansible-playbook purge-cluster.yml --limit iscsigws在 Ceph monitor 或客户端节点上,以
root用户身份删除 iSCSI 网关配置对象(gateway.conf):[root@mon ~]# rados rm -p pool gateway.conf可选。
如果不再需要导出的 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.el7cpor newer package -
python-rtslib-2.1.fb64-0.1.20170815.gitec364f3.el7cpor newer package -
tcmu-runner-1.4.0-0.2.el7cpor newer package openssl-1.0.2k-8.el7或更新版本的软件包重要如果这些软件包的早期版本存在,则必须在安装更新的版本前首先删除它们。这些较新的版本必须从 Red Hat Ceph Storage 存储库安装。
-
在使用 gwcli 工具之前,在存储集群中的所有 Ceph 监控节点上执行以下步骤:
以
root用户身份重启ceph-mon服务:# systemctl restart ceph-mon@$MONITOR_HOST_NAME例如:
# systemctl restart ceph-mon@monitor1
在 Ceph iSCSI 网关节点上以 root 用户身份执行以下步骤,然后继续 安装 部分:
-
如果 Ceph iSCSI 网关不在 OSD 节点上并置,则将位于
/etc/ceph/中的 Ceph 配置文件从存储集群中正在运行的 Ceph 节点复制到 iSCSI 网关节点。Ceph 配置文件必须存在于/etc/ceph/下的 iSCSI 网关节点上。 - 安装和配置 Ceph 命令行界面。详情请参阅 Red Hat Ceph Storage 3 安装指南中的安装 Ceph 命令行界面 一章。
启用 Ceph 工具存储库:
# subscription-manager repos --enable=rhel-7-server-rhceph-3-tools-rpms- 如果需要,在防火墙上打开 TCP 端口 3260 和 5000。
新建或使用现有的 RADOS 块设备 (RBD)。
- 详情请查看 第 2.1 节 “先决条件”。
如果您已使用 Ansible 安装 Ceph iSCSI 网关,请不要使用此流程。
在运行 ansible-playbook 命令时,Ansible 将安装 ceph-iscsi-cli 软件包,然后根据 group_vars/iscsigws.yml 文件中的设置更新 /etc/ceph/iscsi-gateway.cfg 文件。请参阅 要求: 了解更多信息。
安装:
以 root 用户身份在所有 iSCSI 网关节点上执行以下步骤,除非另有说明。
安装
ceph-iscsi-cli软件包:# yum install ceph-iscsi-cli安装
tcmu-runner软件包:# yum install tcmu-runner如果需要,安装
openssl软件包:# yum install openssl在主 iSCSI 网关节点上,创建一个目录来存放 SSL 密钥:
# mkdir ~/ssl-keys # cd ~/ssl-keys在主 iSCSI 网关节点上,创建证书和密钥文件:
# openssl req -newkey rsa:2048 -nodes -keyout iscsi-gateway.key -x509 -days 365 -out iscsi-gateway.crt注意系统将提示您输入环境信息。
在主 iSCSI 网关节点上,创建一个 PEM 文件:
# cat iscsi-gateway.crt iscsi-gateway.key > iscsi-gateway.pem在主 iSCSI 网关节点上,创建一个公钥:
# openssl x509 -inform pem -in iscsi-gateway.pem -pubkey -noout > iscsi-gateway-pub.key-
从主 iSCSI 网关节点,将
iscsi-gateway.crt、iscsi-gateway.pem、iscsi-gateway-pub.key和iscsi-gateway.key文件复制到其他 iSCSI 网关节点上的/etc/ceph/目录中。
在
/etc/ceph/目录中创建一个名为iscsi-gateway.cfg的文件:# touch /etc/ceph/iscsi-gateway.cfg编辑
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文件都必须相同。-
将
iscsi-gateway.cfg文件复制到所有 iSCSI 网关节点。
启用并启动 API 服务:
# systemctl enable rbd-target-api # systemctl start rbd-target-api
配置:
启动 iSCSI 网关命令行界面:
# gwcli使用 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 地址。
添加 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创建客户端:
语法
> 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)]向客户端添加磁盘:
语法
>/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要确认 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/- 下一步是配置 iSCSI 启动器。有关配置 iSCSI 启动器的更多信息,请参阅 第 8.4 节 “配置 iSCSI 启动器”。
验证
验证 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 网关节点上运行。要验证启动器是否连接到 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)]验证 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
其它资源
-
有关
max_data_area_mb的信息,包括如何使用gwcli reconfigure来调整它的示例 ,请参见为 块设备指南 配置 iSCSI 目标 一节中,以及在容器中 配置 Ceph iSCSI 网关。
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用户访问权限.
流程
在新 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 存储库 一节。
安装
ceph-iscsi-config软件包:[root@iscsigw ~]# yum install ceph-iscsi-config附加到网关组的
/etc/ansible/hosts文件中的列表:示例
[iscsigws] ... ceph-igw-3 ceph-igw-4注意如果与 OSD 节点共存 iSCSI 网关,请将 OSD 节点添加到
[iscsigws]部分中。打开
/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 地址。在 Ansible 管理节点上,以
root用户身份执行 Ansible playbook:# cd /usr/share/ceph-ansible # ansible-playbook site.yml- 从 iSCSI 启动器,重新登录以使用新添加的 iSCSI 网关。
其它资源
- 有关使用 iSCSI 启动器的更多详细信息,请参阅配置 iSCSI 启动器。
8.3.4.3. 使用 gwcli 添加更多 iSCSI 网关 复制链接链接已复制到粘贴板!
您可以使用 gwcli 命令行工具添加更多 iSCSI 网关。此流程将两个 iSCSI 网关的默认扩展为四个 iSCSI 网关。
先决条件
- 正在运行的 Red Hat Ceph Storage 3 集群。
- 安装 iSCSI 网关软件。
-
具有
root用户对新节点或 OSD 节点的访问权限.
流程
-
如果 Ceph iSCSI 网关不在 OSD 节点上并置,则将位于
/etc/ceph/目录中的 Ceph 配置文件从存储集群中正在运行的 Ceph 节点复制到新的 iSCSI 网关节点。Ceph 配置文件必须存在于/etc/ceph/目录下的 iSCSI 网关节点上。 - 安装和配置 Ceph 命令行界面。详情请参阅 Red Hat Enterprise Linux 的 Red Hat Ceph Storage 3 安装指南中的安装 Ceph 命令行界面 一章。
在新 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 存储库 一节。
安装
ceph-iscsi-cli和tcmu-runner软件包:[root@iscsigw ~]# yum install ceph-iscsi-cli tcmu-runner如果需要,安装
openssl软件包:[root@iscsigw ~]# yum install openssl
在其中一个现有 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 目标。
将更新的
/etc/ceph/iscsi-gateway.cfg文件复制到所有 iSCSI 网关节点。重要在所有 iSCSI 网关节点上,
iscsi-gateway.cfg文件都必须相同。-
(可选)如果使用 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/目录中。 在新的 iSCSI 网关节点上启用并启动 API 服务:
[root@iscsigw ~]# systemctl enable rbd-target-api [root@iscsigw ~]# systemctl start rbd-target-api启动 iSCSI 网关命令行界面:
[root@iscsigw ~]# gwcli使用 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 地址。
- 从 iSCSI 启动器,重新登录以使用新添加的 iSCSI 网关。
其它资源
- 有关使用 iSCSI 启动器的更多详细信息,请参阅配置 iSCSI 启动器。