Start with the RBD support for TGT
A couple a months ago, Dan Mick posted a nice article that introduced the RBD support for iSCSI / TGT. In this article, I will have a look at it.
I. OSD Server side
The following actions must be performed on your OSD nodes.
Add the Ceph extra repositorie since it contains a package version of TGT with the RBD support. And install the package:
$ echo "deb http://ceph.com/packages/ceph-extras/debian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ceph-extras.list |
We can check that tgt has been well compiled with the RBD support:
$ sudo tgtadm --lld iscsi --op show --mode system | grep rbd |
First provision a new RBD image in Ceph:
$ ceph osd pool create iscsi 128 128 |
Register targets on your OSD servers, for this either append the following in /etc/tgt/targets.conf
or etc/tgt/conf.d/ceph.conf
:
<target iqn.2014-04.rbdstore.example.com:iscsi>
driver iscsi
bs-type rbd
backing-store iscsi/iscsi-rbd # Format is <iscsi-pool>/<iscsi-rbd-image>
initiator-address <clients address allowed to map the device>
</target>
Then reload the tgt service:
$ service tgt reload |
II. Client side
It is critical that you disable the RBD caching, using writeback caching while mapping multiple targets on different host could result in data loss or corruption.
It’s important to disable the rbd cache on tgtd host. Set in /etc/ceph/ceph.conf:
[client]
rbd_cache = false
Install open-iscsi
on your client machine:
$ sudo apt-get install open-iscsi |
Discover the target:
$ iscsiadm -m discovery -t st -p 192.168.0.100 # the IP is the IP of one of your OSD with the TGT |
Map the target:
$ iscsiadm -m node --login |
Check if everything went well:
$ sudo cat /proc/partition |
Check the block size:
$ blockdev --report /dev/sdh |
Moving forward in a next article, I will discuss a multipath implementation to make this setup highly available.
Comments