Ceph iSCSI卷

在这里插入图片描述

http://download.ceph.com/ceph-iscsi/3/

https://chacra.ceph.com/r/

https://1.chacra.ceph.com/r/
https://2.chacra.ceph.com/r/
https://3.chacra.ceph.com/r/
https://4.chacra.ceph.com/r/

配置源

ceph-iscsi.repo

[ceph-iscsi]
name=ceph-iscsi noarch packages
baseurl=http://download.ceph.com/ceph-iscsi/3/rpm/el7/noarch
enabled=1
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc
type=rpm-md

[ceph-iscsi-source]
name=ceph-iscsi source packages
baseurl=http://download.ceph.com/ceph-iscsi/3/rpm/el7/SRPMS
enabled=0
gpgcheck=1
gpgkey=https://download.ceph.com/keys/release.asc
type=rpm-md

python-rtslib-dev.repo

[python-rtslib]
name=python-rtslib packages for $basearch
baseurl=https://2.chacra.ceph.com/r/python-rtslib/master/67eb1605c697b6307d8083b2962f5170db13d306/centos/7/flavors/default/$basearch
enabled=1
gpgcheck=0
type=rpm-md

[python-rtslib-noarch]
name=python-rtslib noarch packages
baseurl=https://2.chacra.ceph.com/r/python-rtslib/master/67eb1605c697b6307d8083b2962f5170db13d306/centos/7/flavors/default/noarch
enabled=1
gpgcheck=0
type=rpm-md

[python-rtslib-source]
name=python-rtslib source packages
baseurl=https://2.chacra.ceph.com/r/python-rtslib/master/67eb1605c697b6307d8083b2962f5170db13d306/centos/7/flavors/default/SRPMS
enabled=1
gpgcheck=0
type=rpm-md

tcmu-runner-dev.repo

[tcmu-runner]
name=tcmu-runner packages for $basearch
baseurl=https://1.chacra.ceph.com/r/tcmu-runner/master/9c84f7a4348ac326ac269fbdda507953dba6ec2c/centos/7/flavors/default/$basearch
enabled=1
gpgcheck=0
type=rpm-md

[tcmu-runner-noarch]
name=tcmu-runner noarch packages
baseurl=https://1.chacra.ceph.com/r/tcmu-runner/master/9c84f7a4348ac326ac269fbdda507953dba6ec2c/centos/7/flavors/default/noarch
enabled=1
gpgcheck=0
type=rpm-md

[tcmu-runner-source]
name=tcmu-runner source packages
baseurl=https://1.chacra.ceph.com/r/tcmu-runner/master/9c84f7a4348ac326ac269fbdda507953dba6ec2c/centos/7/flavors/default/SRPMS
enabled=1
gpgcheck=0
type=rpm-md

安装

yum install ceph-iscsi-cli tcmu-runner
mkdir ~/ssl-keys
cd ~/ssl-keys

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


cat iscsi-gateway.crt iscsi-gateway.key > iscsi-gateway.pem


openssl x509 -inform pem -in iscsi-gateway.pem -pubkey -noout > iscsi-gateway-pub.key

copy the iscsi-gateway.crt, iscsi-gateway.pem, iscsi-gateway-pub.key, and iscsi-gateway.key files to the /etc/ceph/ directory on the other iSCSI gateway nodes

touch /etc/ceph/iscsi-gateway.cfg

Syntax

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

Example

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

IMPORTANT
The iscsi-gateway.cfg file must be identical on all iSCSI gateway nodes.

Copy the iscsi-gateway.cfg file to all iSCSI gateway nodes.

Enable and start the API service

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

Target配置

进入target命令行

gwcli

创建target

注:对一个集群一般情况创建一个target, 仅有新业务或集群创建时需要创建新的iscsi-target
示例:

cd /iscsi-target/
create iqn.2003-01.com.redhat.iscsi-gw:ceph-igw

创建Hosts挂载点

进入到对应target 的hosts目录下创建hosts ,例如 为iqn.2003-01.com.redhat.iscsi-gw:ceph-igw 创建一个host iqn.2020-05.com.test-client

示例:

cd  /iscsi-target/iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/hosts
/iscsi-target...eph-igw/hosts> create iqn.2020-05.com.test-client
cd /iscsi-target/iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/hosts
/iscsi-target...eph-igw/hosts> create iqn.2020-06.com.test-client

配置host认证

可以对每个Host增加个chap认证,例如 iqn.2020-05.com.test-client 配置认证
示例:

cd /iscsi-target/iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/hosts/iqn.2020-05.com.test-client
/iscsi-target...dp:rhv-client> auth chap=user/password

创建RBD硬盘

注: rbd 是ceph pool 名称, image是硬盘名称,命名方式如: host05-2TB host05对应iqn.2020-05,2TB代表大小

示例:

cd /disks
/disks> create rbd image=host05-2TB size=2T

RBD硬盘附加

注:一个host可以附加多个硬盘

示例:

/disks> cd  /iscsi-target/iqn.2003-01.com.redhat.iscsi-gw:ceph-igw/hosts/iqn.2020-05.com.test-client
/iscsi-target...dp.rhv-client> disk add rbd.host05-2TB
ok

验证 客户端操作

设置Initiator Name

vim /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2020-06.com.test-client
systemctl restart iscsid

发现target

iscsiadm -m discovery -t st -p  节点IP
iscsiadm -m discovery -t st -p 10.127.32.149
10.127.32.149:3260,1 iqn.2003-01.com.redhat.iscsi-gw:ceph-igw
10.127.32.150:3260,2 iqn.2003-01.com.redhat.iscsi-gw:ceph-igw
10.127.32.154:3260,3 iqn.2003-01.com.redhat.iscsi-gw:ceph-igw

登录target

iscsiadm -m node -T iqn.2003-01.com.redhat.iscsi-gw:ceph-igw -l

查看

lsblk
multipath -ll

登出target

iscsiadm -m node -T iqn.2003-01.com.redhat.iscsi-gw:ceph-igw -u
lsblk

参考:
https://blog.csdn.net/wylfengyujiancheng/article/details/105348766

猜你喜欢

转载自blog.csdn.net/wuxingge/article/details/108023254