1, sudo yum install corosynclib-devel
1, yum update kernel
2 , wget qemu , libvirt
1, http://libvirt.org/sources/libvirt-1.1.4.tar.gz
2, http://wiki.qemu-project.org/download/qemu-1.6.1.tar.bz2
3, ftp://195.220.108.108/linux/opensuse/factory/repo/oss/suse/x86_64/liburcu2-0.8.0-3.3.x86_64.rpm
4, ftp://195.220.108.108/linux/opensuse/factory/repo/oss/suse/x86_64/liburcu-devel-0.8.0-3.3.x86_64.rpm
3, install qemu
$ cd /qemu-16.1
$ ./configure
$ sudo make; make install
$ cd ..
4, install libvirt
1, yum -y install device-mapper-devel libpciaccess-devel libnl-devel
2, ./configure ;make ;make install
5, git clone git://github.com/collie/sheepdog.git
$ cd sheepdog
$ ./autogen.sh
$ ./configure
$ sudo make install
$ cd ..
6, start service corosync  ... ...
1, cd /etc/corosync
2, cp corosync.conf.example corosync.conf
3, vim corosync.conf
# Please read the corosync.conf.5 manual page
compatibility: whitetank
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 192.168.19.111 # my ip
mcastaddr: 226.94.1.1
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
to_syslog: yes
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
amf {
mode: disabled
}
4, /etc/init.d/corosync restart
7, start sheepdog
1, sheepdog /var/lib/sheepdog or /etc/init.d/sheepdog restart
8, check node list
[root@localhost corosync]# collie node list
Id   Host:Port         V-Nodes       Zone
0   192.168.19.111:7000  128 1863559360
[root@localhost corosync]#
9, check cluster info
[root@localhost corosync]# collie cluster info
Cluster status: running, auto-recovery enabled
Cluster created at Wed Nov 20 04:57:54 2013
Epoch Time           Version
2013-11-20 11:31:59      5 [192.168.19.111:7000]
2013-11-20 11:27:40      4 []
2013-11-20 05:02:19      3 [192.168.19.111:7000]
2013-11-20 05:00:59      2 []
2013-11-20 04:57:54      1 [192.168.19.111:7000]
10, Add p_w_picpath to sheepdog storage
1, qemu-img create -f raw sheepdog:vm0000001 5G
11, add boot p_w_picpath to sheepdog storage
1, qemu-img convert -t directsync /var/lib/sheepdog/root.img sheepdog:redhat
12, list p_w_picpaths
[root@localhost corosync]# collie vdi list
Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
redhat       0   10 GB  3.2 GB  0.0 MB 2013-11-20 11:39   307f49     3
vm0000001     0  5.0 GB  0.0 MB  0.0 MB 2013-11-20 11:38   6a4207     3
vm0000002     0  5.0 GB  0.0 MB  0.0 MB 2013-11-20 11:53   6a43ba     3
data1        0  0.2 MB  4.0 MB  0.0 MB 2013-11-20 11:45   77165c     3
data2        0  5.0 GB  0.0 MB  0.0 MB 2013-11-20 11:47   771b75     3
[root@localhost corosync]#
13, from boot p_w_picpath to sheepdog storage
1, libvirt xml configure
<domain type='qemu'>
<name>testvm</name>
<memory>1048576</memory>
<os>
<type arch='x86_64'>hvm</type>
</os>
<devices>
<disk type='network' device="disk">
<source protocol="sheepdog" name="redhat"/>
<target dev='vda' bus='virtio'/>
</disk>
<graphics type='vnc' port='-1' autoport='yes'/>
</devices>
</domain>
14, full xml configure
<domain type='qemu' id='9'>
<name>testvm</name>
<uuid>f2a772c0-972b-4662-a143-d28be1f0a4c6</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>1</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-1.6'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/local/bin/qemu-system-x86_64</emulator>
<disk type='network' device='disk'>
<driver name='qemu'/>
<source protocol='sheepdog' name='redhat'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<controller type='usb' index='0'>
<alias name='usb0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</memballoon>
</devices>
<seclabel type='none'/>
</domain>