Preface
Sheepdog is a virtual machine Distributed file system designed specifically for QEMU, with a completely symmetric structure and no central node of the metadata service, thus eliminating the risk of a single point of failure. This article is based on the latest 0.7.0 release Test, which describes the installation configuration and use of sheepdog. Sheepdog back-end cluster management
Sheepdog backend Cluster Management is used to manage membership and message communication between nodes. There are currently four modes available, namely local driver (for stand-alone testing), Corosync (default), Zookeeper and Accord.
There are two types of models:
– Full symmetry (dependent on Corosync, running in Sheepdog's address space)
Cons: Small scale [<100]
Pros: No Configuration required
– Separate control cluster (dependent on accord* or Zookeeper, running in separate address space)
Cons: Need to configure control cluster
Advantages: Large scale [>1000]
The default Corosync mode is used for this test.
Preparation before installation:
Do some system setup first
echo "* Soft nofile 65533" >>/etc/security/limits. conf echo "* Hard Nofile 65533" >>/etc/security/limits. conf Yum install-y make Automake autoconf gcc nss-devel wget git glib2
Installing the Epel source
RPM-IVH http://dl. Fedoraproject. ORG/PUB/EPEL/6/x86_64/epel-release-6-8. Noarch. Rpm
Installing Sheepdog 1). Install Corosync
CENTOS6 comes with an old version, we need to install the new
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). Install Sheepdog
Cd/home2/install git clone git://GitHub. Com/collie/sheepdog. Git CD Sheepdog./Autogen. Sh./Configure make Install
configuring Corosync and Sheepdog
Cd/etc/corosync CP Corosync. Conf. Example Corosync. Conf
Edit corosync.conf Modify bindnetaddr into your network segment like 192.168.1.0
# Please read the corosync. Conf 5 manual page Compatibility:whitetank totem {version:2 Secauth:off threads:0 # Note, Fail_recv_const is only n eeded If you ' re # have problems with Corosync crashing under # Heavy sheepdog traffic. This crash are due to # delayed/resent/misordered multicast packets. # fail_recv_const:5000 Interface {ringnumber:0 bindnetaddr:192.168.1.0 mcastaddr:226.94.1.1 mcastport:5405}} L ogging {fileline:off to_stderr:no to_logfile:yes To_syslog:yes # The pathname of the log file logfile:/Var/log/ Cluster/corosync. Log Debug:off timestamp:on Logger_subsys {SUBSYS:AMF Debug:off}} AMF {mode:disabled}
Start the service
/Etc/init. D/corosync start # or start by command (/Var/lib/sheepdog is the data directory that sheepdog uses, you can change to other) # Sheep/var/lib/sheepdog
Sheepdog requires that the/var/lib/sheepdog directory is located in a partition that supports XATTR
Mount-o remount, user_xattr/
The above operations need to be performed on each sheepdog node
Format the sheepdog cluster and set up 3 replicas, just on one of the nodes to perform
Collie cluster Format--copies = 3
View node Status
Collie Node List
This sheepdog cluster has been configured to create Sheepdog disk images using qemu-img
Since the qemu1.2 version of CENTOS6 does not support sheepdog, a new version of QEMU is compiled here.
Installing a dependent Package
Yum Install Zlib-devel glib2-devel-y
Compiling QEMU
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
Create Disk
/usr/local/bin/qemu-img create-f qcow2 sheepdog:myfirstdisk 10G
If the sheepdog is running on another machine, you need to specify the IP and port
/usr/local/bin/qemu-img create-f qcow2 sheepdog:192.168. 1.100:7000:myfirstdisk 10G
List the images in sheepdog
Collie VDI List
Convert an existing image into sheepdog
Qemu-img Convert./mysystem. Raw Sheepdog:mysystem
start a virtual machine
qemu-system-x86_64--enable-kvm-m 1024-drive file = sheepdog:myfirstdisk, cache = writeback-vnc:15-cdrom/data/ Centos-6.4-i386-minimal. Iso
Other usage 1) Create a snapshot
QEMU-IMG snapshot-c name Sheepdog:myfirstdisk
View mirror list After snapshot creation
Collie VDI list name ID size used shared creation time Object ID--------------------------------------------------------- -----------Bob 0 2.0 GB 1.6 GB 0.0 MB 2010-03-23 16:16 80000 myfirstdisk 0 GB 0.0 MB 0.0 MB 2010-03-23 16: c0000 s Myfirstdisk 1 GB 0.0 mb 0.0 MB 2010-03-23 16:16 40000
To start a virtual machine with a snapshot
Qemu-system-x86_64 sheepdog:myfirstdisk:1
2) disk cloning
Qemu-img create-b Sheepdog:myfirstdisk Sheepdog:D Isk2
3) Close Sheepdog cluster
Collie cluster shutdown
This command closes the process for all nodes
4) Use fuse mount Sheepdog
First, create a volume named My_volume
echo My_volume >/Var/lib/sheepdog/vdi/mount
Format to EXT4 and Mount
Mkfs. Ext4/var/lib/sheepdog/volume/my_volume Mount-o loop/var/lib/sheepdog/volume/my_volume/mnt
When the connected sheepdog machine goes down we can switch online to another sheepdog
echo IP:p ort >/var/lib/sheepdog/config/sheep_info