zoukankan      html  css  js  c++  java
  • 通过iscsi协议使用ceph rbd

    转自:http://blog.csdn.net/wytdahu/article/details/46545235

    ceph很早就已经支持通过iscsi协议来使用rbd,这篇博文对此做下演示,并且使用OSD Server作为iscsi target端。

     一、OSD Server side

    1、安装支持rbd的TGT软件包

    1 #echo "deb http://ceph.com/packages/ceph-extras/debian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ceph-extras.list  
    2 #apt-get install tgt  

    2、安装完成后确认tgt支持rbd

    1 # tgtadm --lld iscsi --op show --mode system | grep rbd  
    2     rbd (bsoflags sync:direct)  

     3、创建一个image(示例中pool名称叫做iscsipool,image叫做iamge1)

    1 #rbd create iscsipool/image1 --size 10240 --image-format 2  

     4、在tgt服务中注册刚才创建好的image,只需要将下面的内容添加到/etc/tgt/targets.conf 或者 etc/tgt/conf.d/ceph.conf中即可。

    1 <target iqn.2014-04.rbdstore.example.com:iscsi>  
    2     driver iscsi  
    3     bs-type rbd  
    4     backing-store iscsipool/image1  # Format is <iscsi-pool>/<iscsi-rbd-image>  
    5     initiator-address 10.10.2.49    #client address allowed to map the address  
    6 </target> 

    5、重启或者重载tgt服务

    1 #service tgt reload  
    2 or  
    3 #service tgt restart  

    6、关闭rbd cache,否则可能导致数据丢失或者损坏

    1 vim /etc/ceph/ceph.conf  
    2 [client]  
    3 rbd_cache = false  

     二、Client side

    1、安装open-scsi

    1 #apt-get install open-iscsi  -y

    2、启动open-scsi服务

    # service open-iscsi restart  
     * Unmounting iscsi-backed filesystems                                                                                                    [ OK ]   
     * Disconnecting iSCSI targets                                                                                                            [ OK ]   
     * Stopping iSCSI initiator service                                                                                                       [ OK ]   
     * Starting iSCSI initiator service iscsid                                                                                                [ OK ]   
     * Setting up iSCSI targets                                                                                                                        
    iscsiadm: No records found  
                                                                                                                                              [ OK ]  
     * Mounting network filesystems   

     3、发现目标设备

    1 # iscsiadm -m discovery -t st -p 10.10.2.50  
    2 10.10.2.50:3260,1 iqn.2014-04.rbdstore.example.com:iscsi  

    4、挂载目标设备

    1 #  iscsiadm -m node --login  
    2 Logging in to [iface: default, target: iqn.2014-04.rbdstore.example.com:iscsi, portal: 10.10.2.50,3260] (multiple)  
    3 Login to [iface: default, target: iqn.2014-04.rbdstore.example.com:iscsi, portal: 10.10.2.50,3260] successful.

    5、确认设备已经挂载(示例中sda就是iscsdi设备)

    root@cetune1:~# lsblk   
    NAME                  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT  
    sda                     8:0    0    10G  0 disk   
    vda                   253:0    0    24G  0 disk   
    ?..vda1                253:1    0   190M  0 part /boot  
    ?..vda2                253:2    0     1K  0 part   
    ?..vda5                253:5    0  23.8G  0 part   
      ?..linux-swap (dm-0) 252:0    0   3.8G  0 lvm  [SWAP]  
      ?..linux-root (dm-1) 252:1    0    20G  0 lvm  /  

     

  • 相关阅读:
    PAT (Advanced Level) 1010. Radix (25)
    PAT (Advanced Level) 1009. Product of Polynomials (25)
    PAT (Advanced Level) 1008. Elevator (20)
    PAT (Advanced Level) 1007. Maximum Subsequence Sum (25)
    PAT (Advanced Level) 1006. Sign In and Sign Out (25)
    PAT (Advanced Level) 1005. Spell It Right (20)
    PAT (Advanced Level) 1004. Counting Leaves (30)
    PAT (Advanced Level) 1001. A+B Format (20)
    PAT (Advanced Level) 1002. A+B for Polynomials (25)
    PAT (Advanced Level) 1003. Emergency (25)
  • 原文地址:https://www.cnblogs.com/chris-cp/p/6272722.html
Copyright © 2011-2022 走看看