Centos 6.5でtgtバックエンドストレージをcephとして構成

3814 ワード

運用環境


Centos 6.5
ceph 0.87
tgt 

操作手順


tgtのインストール
#wget http://ceph.com/packages/ceph-extras/rpm/centos6/x86_64/scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm
#rpm -ivh scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm

rbd driverで現在のtgtがサポートされているかどうかを確認
[root@ceph-osd-3 ~]# tgtadm --lld iscsi --mode system --op show
System:
    State: ready
    debug: off
LLDs:
    iser: error
    iscsi: ready
Backing stores:
    rbd (bsoflags sync:direct)
    rdwr (bsoflags sync:direct)
    ssc
    null
    bsg
    sg
    sheepdog
Device types:
    passthrough
    tape
    changer
    controller
    osd
    cd/dvd
    disk
iSNS:
    iSNS=Off
    iSNSServerIP=
    iSNSServerPort=3205
    iSNSAccessControl=Off

Backing storesバーにrbdが表示されます.このtgtがrbdをサポートできることを示します.
tgtの作成に必要なpoolおよびrbd
[root@ceph-osd-1 ~]ceph osd pool create iscsi 256
[root@ceph-osd-1 ~]rbd create tgt --size 10240 --pool iscsi

rbdの表示
[root@ceph-osd-1 ~]# rbd ls --pool iscsi
tgt

gtプロファイルに次の内容を追加
include /etc/tgt/conf.d/*.conf

    driver iscsi
    bs-type rbd
    backing-store iscsi/tgt  


tgtdを再起動
[root@ceph-osd-3 ~]# /etc/init.d/tgtd restart
Stopping target framework daemon
Starting target framework daemon

iscsi initiator端子にiscsi targetを接続する
[root@ceph-osd-1 ~]# iscsiadm -m discovery -t sendtargets -p 10.10.200.165
Starting iscsid:                                           [  OK  ]
10.10.200.165:3260,1 iqn.2014-11.rbdstore.com:iscsi
[root@ceph-osd-1 ~]# iscsiadm -m node -T iqn.2014-11.rbdstore.com:iscsi -l
Logging in to [iface: default, target: iqn.2014-11.rbdstore.com:iscsi, portal: 10.10.200.165,3260] (multiple)
Login to [iface: default, target: iqn.2014-11.rbdstore.com:iscsi, portal: 10.10.200.165,3260] successful.
[root@ceph-osd-1 ~]# fdisk -l

Disk /dev/sdb: 5788.2 GB, 5788206759936 bytes
255 heads, 63 sectors/track, 703709 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sda: 209.7 GB, 209715068928 bytes
255 heads, 63 sectors/track, 25496 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009a9dd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         131     1048576   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             131        1176     8392704   82  Linux swap / Solaris
/dev/sda3            1176       25497   195356672   8e  Linux LVM

Disk /dev/mapper/vg_swift-LogVol00: 200.0 GB, 200043134976 bytes
255 heads, 63 sectors/track, 24320 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/docker-253:0-3539142-pool: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 65536 bytes
Disk identifier: 0x00000000


Disk /dev/sdc: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 4194304 bytes
I/O size (minimum/optimal): 4194304 bytes / 4194304 bytes
Disk identifier: 0x00000000

sdcはマッピングされた新しいハードディスクであることがわかります