1. 准备
    1. repo配置

      【OpenStack】OpenStack系列6之Sheepdog环境搭建-LMLPHP

      【OpenStack】OpenStack系列6之Sheepdog环境搭建-LMLPHP

      yum clean all

      yum makecache

    2. yum install -y make automake autoconf gcc nss-devel wget git glib2
    3. 安装corosync

      参考:https://github.com/sheepdog/sheepdog/wiki/Install%20From%20Sources

    yum remove corosync corosynclib corosynclib-devel -y

    git clone git://github.com/corosync/corosync.git

    cd corosync

    git checkout -b flatiron origin/flatiron

    ./autogen.sh

    ./configure --enable-nss

    make install

  2. 安装sheepdog
    1. 准备liburcu/ yasm

      参考:https://github.com/sheepdog/sheepdog/wiki/Install%20From%20Sources

      http://lishenxiao.blog.hexun.com/85146991_d.html

      wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

      rpm -Uvh epel-release*rpm

      yum install userspace-rcu -y

      yum install userspace-rcu-devel –y

      安装yasm:

      yum install yasm yasm-devel -y

    2. 安装sheepdog

      git clone git://github.com/sheepdog/sheepdog.git

      cd sheepdog

      ./autogen.sh

      ./configure

      make install

    3. 配置corosync

      参考:https://github.com/sheepdog/sheepdog/wiki/Corosync-config

      http://my.oschina.net/kisops/blog/153576

    4. 启动corosync服务

      /etc/init.d/corosync start

    5. 配置sheepdog

      配置元数据、对象数据路径:

      mount -o remount,user_xattr /var

      mount -o remount,user_xattr /home/disk1

      mount -o remount,user_xattr /home/disk2

      mount -o remount,user_xattr /home/disk3

      参考:https://github.com/sheepdog/sheepdog/wiki/Multi-disk-on-Single-Node-Support

    6. 使用缓存

      mkdir -p /home/cache

    7. 启动sheepdog

      sheep -w size=200G,dir=/home/cache,direction /var/lib/sheepdog,/home/disk1,/home/disk2,/home/disk3

    8. 查看集群节点列表

      collie node list

      或者,

      dog node list

      collie node info

      或者,

      dog node info

    9. 集群存储格式化

      collie cluster format --copies=3

      或者,

      dog cluster format --copies=3

      只需在其中一个节点执行

  3. 使用sheepdog——通过iscsi协议
    1. 参考资料

      https://github.com/sheepdog/sheepdog/wiki/General-protocol-support-%28iSCSI-and-NBD%29

      http://blog.csdn.net/bobpen/article/details/10172163

    2. 创建虚拟机镜像

      dog vdi create ebs 500G

    3. 安装tgt

    git clone git://github.com/fujita/tgt.git -b sheepdog

    cd tgt

    make

    make install

    1. 启动tgtd

      tgtd

    2. 创建target

      tgtadm --op new --mode target --tid 1 --lld iscsi --targetname iqn.2013-10.org.sheepdog-project

      tgtadm --op new --mode lu --tid 1 --lun 2 --bstype sheepdog --backing-store unix:/var/lib/sheepdog/sock:ebs

      tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL

    3. 查看tgtd配置

      tgtadm --lld iscsi --op show --mode target

    4. 安装open-iscsi启动器——操作系统内核需要有scsi、iscsi相关ko支持。

      yum install iscsi-initiator-utils –y

      启动客户端:

      /etc/init.d/iscsi start

      /etc/init.d/iscsid start

      iscsiadm -m discovery -t st -p 127.0.0.1 自动启动iscsi

      发现tgt:

      iscsiadm -m node --targetname iqn.2013-10.org.sheepdog-project --portal 127.0.0.1:3260 --login

      device新增如下:

      【OpenStack】OpenStack系列6之Sheepdog环境搭建-LMLPHP

  4. Sheepdog块设备性能测试
    1. 无SSD,使用本地磁盘做cache,3备份,随机写、顺序写、顺序读性能均较差,但是随机读性能非常好。
  5. 使用sheepdog——通过qeum
    1. 安装qeum编译依赖包

      yum install zlib-devel glib2-devel -y

    2. 编译安装qeum

      wget http://wiki.qemu-project.org/download/qemu-1.5.2.tar.bz2

      tar jxvf qemu-1.5.2.tar.bz2

      cd qemu-1.5.2

      ./configure

      make;make install

    3. 创建磁盘

      qemu-img create -f qcow2 sheepdog:127.0.0.1:7000:disktest 500G

      collie vdi list

    4. 启动虚拟机

      qemu-system-x86_64 --enable-kvm -m 4096 -smp 4 -drive file=sheepdog:disktest,cache=writeback -vnc :8901 -cdrom CentOS-6.3-x86_64-minimal.iso

    5. 通过虚拟机测试sheepdog性能
04-15 12:31