title: tgtd + librbd在线扩容
前言
这里介绍下iscsi(tgt模式)使用ceph的librbd时,如何在线对rbd进行扩容操作。
这里假设你已经配置好了ceph集群。我这里的测试环境如下:
ceph05(192.168.10.30)配置单节点ceph集群,同时也作为配置tgtd服务节点。
ceph06(192.168.10.31)作为tgtd服务的客户端(initiator)节点。
1、服务端(tgtd)配置
准备一个rbd:
[root@ceph05 ~]# rbd ls
img01
[root@ceph05 ~]# rbd info img01
rbd image 'img01':
size 22GiB in 5632 objects
order 22 (4MiB objects)
block_name_prefix: rbd_data.10206b8b4567
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:
create_timestamp: Fri Sep 27 11:25:04 2019
配置、启动tgtd服务:
[root@ceph05 ~]# cat /etc/tgt/conf.d/my.conf
<target iqn.2019-09.com.example:target01>
<backing-store rbd/img01>
lun 1
vendor_id iqn.2019-09.com.example
</backing-store>
bs-type rbd
</target>
[root@ceph05 ~]#
[root@ceph05 ~]# systemctl start tgtd
查看tgtd信息:
[root@ceph05 ~]# tgt-admin --show
Target 1: iqn.2019-09.com.example:target01
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 4
Initiator: iqn.1994-05.com.redhat:bf8e54aec2e alias: ceph06
Connection: 0
IP Address: 192.168.10.31
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 23622 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rbd
Backing store path: rbd/img01
Backing store flags:
Account information:
ACL information:
ALL
2、客户端(initiator)配置
在客户端发现、登陆这个target:
[root@ceph06 ~]# iscsiadm -m discovery -t st -p 192.168.10.30
[root@ceph06 ~]# iscsiadm -m node -T iqn.2019-09.com.example:target01 -p 192.168.10.30 -l
查看设备:
[root@ceph06 ~]# lsblk
...
sde 8:64 0 22G 0 disk
sde就是iscsi设备。
3、扩容rbd
然后在服务端(tgtd)对rbd进行扩容:
[root@ceph05 ~]# rbd resize img01 --size 25G
Resizing image: 100% complete...done.
[root@ceph05 ~]# rbd info img01
rbd image 'img01':
size 25GiB in 6400 objects
order 22 (4MiB objects)
block_name_prefix: rbd_data.10206b8b4567
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:
create_timestamp: Fri Sep 27 11:25:04 2019
更新tgtd配置(服务端执行):
[root@ceph05 ~]# tgt-admin --update iqn.2019-09.com.example:target01
然后重新扫描下scsi设备(客户端执行):
# 查看对应磁盘的SCSI控制器设备信息
[root@ceph06 ~]# lsscsi
...
[10:0:0:0] storage IET Controller 0001 -
[10:0:0:1] disk iqn.2019 VIRTUAL-DISK 0001 /dev/sde
# 重新扫描SCSI总线,其中的10:0:0:1就是上面lsscsi命令查到的/dev/sde设备对应的磁盘的SCSI控制器设备信息
[root@ceph06 ~]# echo "---" > /sys/class/scsi_device/10\:0\:0\:1/device/rescan
最后查看设备容量已经更新到25G:
[root@ceph06 ~]# lsblk
...
sde 8:64 0 25G 0 disk
网友评论