Configuration of iSCSI transport service based on ceph cluster

Preparation:
System: CentOS-7-x86_64-DVD-1511 (minimum installation Chinese)
a complete ceph cluster (the cluster used in this article is a mon node, a healthy cluster of three osd nodes)
using tools: server scsi -target-utils-1.0.38-48 Linux client iscsi-initiator-utils
scsi-target-utils-1.0.38-48 download address
http://apt-mirror.sepia.ceph.com/centos6-qemu-kvm /scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm
turn off the firewall and selinux
systemctl disable firewalld (turn off the firewall to start automatically)
systemctl stop firewalld (turn off the fire prevention please)
setenforce 0 (temporarily turn off selinux )
Permanently close Modify SELINUX in the /etc/selinux/config file to disabled
SELINUX=disabled

step:

1. Download
Method 1: Browser visual download, send to the server using xshell
        yum install -y lrzsz
        rz
Method 2: yum install -y wget
        wget http://apt-mirror.sepia.ceph.com/centos6-qemu- kvm/scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm

2. Installation
Method 1: rpm -ivh scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm (this method is not recommended when there is a network connection on the server side)
        Method 1 installation Dependencies required in the process
        boost-iostreams.x86_64 0:1.53.0-27.el7 boost-random.x86_64 0:1.53.0-27.el7         
        boost-system.x86_64 0:1.53.0-27.el7 boost -thread.x86_64 0:1.53.0-27.el7         
        libibverbs.x86_64 0:13-7.el7 librados2.x86_64 1:10.2.10-0.el7            
        librbd1.x86_64 1:10.2.10-0.el7 librdmacm.x86_64 0:13-7.el7                 
        lsof.x86_64 0:4.87-4.el7 lttng-ust.x86_64 0:2.4.1-4.el7              
        perl.x86_64 4:5.16.3-292.el7 perl-Carp.noarch 0: 1.26-244.el7             
        perl-Config-General.noarch 0:2.61-1.el7  perl-Encode.x86_64 0:2.51-7.el7             
        perl-Exporter.noarch 0:5.68-3.el7        perl-File-Path.noarch 0:2.09-2.el7          
        perl-File-Temp.noarch 0:0.23.01-3.el7    perl-Filter.x86_64 0:1.49-3.el7             
        perl-Getopt-Long.noarch 0:2.40-2.el7     perl-HTTP-Tiny.noarch 0:0.033-3.el7         
        perl-PathTools.x86_64 0:3.40-5.el7       perl-Pod-Escapes.noarch 1:1.04-292.el7      
        perl-Pod-Perldoc.noarch 0:3.20-4.el7     perl-Pod-Simple.noarch 1:3.28-4.el7         
        perl-Pod-Usage.noarch 0:1.63-3.el7       perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
        perl-Socket.x86_64 0:2.010-4.el7         perl-Storable.x86_64 0:2.45-3.el7           
        perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7       
        perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27 -2.el7           
        perl-libs.x86_64 4:5.16.3-292.el7 perl-macros.x86_64 4:5.16.3-292.el7         
        perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0 :2.5.1-3.el7         
        perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7     
        sg3_utils.x86_64 0:1.37-12.el7 sg3_utils-libs.x86_64 0 :1.37-12.el7         
        userspace-rcu.x86_64 0:0.7.16-1.el7     
Method 2: yum isntall scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm (with It is recommended to use this method in the case of a network connection, and the dependencies will be automatically resolved)

3. Enable tgt service
systemctl enable tgtd.service
systemctl start tgtd.service
start scsi-target-utils service
service tgtd start or systemctl start tgtd
start the scsi-target-utils service
chconfig tgtd on to
see if scsi-target-utils is started
netstat –anltp|grep 3260

4. Verify whether tgt supports rbd
tgtadm --lld iscsi --mode system --op show | grep rbd It is
recommended to use the website provided by download method 2, use version 1.0.38, and verify that rbd is supported

5. Create iscsi target

Create a storage pool and rbd mirror
ceph osd pool create iscsi-pool 192 192 (before executing the next step, it is recommended to use the rbd ls -p iscsipool command to check whether the creation is successful)
rbd create iscsipool/image01 --size 10240
Note: In this example, use The cluster is a mon node, a ceph cluster of three osd nodes, the pgs value is 192, and the size of the mirror created is 10G according to the number of osd nodes during implementation
(if the creation fails, use the command ceph osd pool delete iscsipool iscsipool --yes -i-really-really-mean-it delete the created pool, where iSCSIpool is the name of the pool created by me)
After the mirror is created successfully, the ceph cluster will be unhealthy, and it will gradually recover to health status

6. Modify the configuration file
vi /etc/tgt/targets.conf and
add the following configuration
<target 192.168.1.104:iscsi>
    driver iscsi
    bs-type rbd
    backing-store iscsi-pool/image01
</target>
or in the /etc/tgt directory Create a conf.d directory under the conf.d directory, and create a configuration file with the suffix .conf in the conf.d directory. An example of the written content is as follows
<target 192.168.1.104:iscsi>
    driver iscsi
    bs-type rbd
    backing-store iscsi-pool/image01
</target>

7. Restart the target service
systemctl restart tgtd.service

8. Check the created scsi target
tgtadm --lld iscsi --mode target --op show
and you can see that the created lun1 indicates success

9. Authenticate the iSCSI service using the client

Control Panel->Administrative Tools->iSCSI Initiator->Enter the ip address of the server providing iSCSI service in the target->click Quick Connect
If the prompt is not active, click the connect button in the lower left corner.
Linux client configuration: 1. Configure the extension source, the source in 1511 does not contain the installation package of iscsi-initiator-utils
                   yum install -y epel-release
                   yum install -y iscsi-initiator-utils
                 2. Discover the target device
                   iscsiadm -m discovery -t sendtargets -p 192.168.1.111
                 3. Mount the target device
                   iscsiadm -m node -T 192.168.1.111:iscsi -l
                 4. Uninstall the target device
                   iscsiadm -m node -T 192.168.1.109:iscsi -u

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325475752&siteId=291194637
Recommended