KVM virtualization open-source high availability solution (4) sheepdog --- "ruiyou Cup" virtualization essay

Source: Internet
Author: User

650) this. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "title =" clip_image002 "border =" 0 "alt =" clip_image002 "src =" http://www.bkjia.com/uploads/allimg/131228/0346324462-0.gif "height =" 333 "/>

Sheepdog is a distributed file system tailored for kvm virtualization. It has been thoroughly optimized for the kvm system and is the ultimate solution for kvm virtualized Distributed File System. The current version is 0.4, if you want to use it in a production environment, you still have to wait for a more mature version release.

Note:

Purpose:

1. The cluster is designed with a virtual machine capacity of 70-300 units. It occupies 1 Cabinet and is composed of 1U servers, with 6 servers and GB x 8 servers;

Sheepdog cluster architecture:

1. storage servers can be elastically increased or reduced by using hash algorithms, and redundant;

2. each server requires at least four NICs. If the server only has two NICs on board, you need to add one dual-port Nic to bind the four NICs, this improves the network bandwidth;

3. Each Server is a storage node and a computing node;

Sheepdog cluster construction:

Note: This article describes how to install libvirt on centos 6.3. If you want to use libvirt, you must install it on fedora17.

1 Installation

Install epel Source

Rpm-Uvh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-7.noarch.rpm

Yum install corosynclib-devel

If centos6.x is used, You Need To uninstall corosync first because the version carried by the system is outdated.

Yum remove corosync corosynclib-devel

Source code installation required

Yum install nss-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

Modify corosync configuration document

# Please read the corosync. conf 5 manual page

Cat <& lt; EOF>/etc/corosync. conf

Compatibility: whitetank

Aisexec {

User: root

Group: root

}

Service {

Name: pacemaker

Ver: 0

}

Totem {

Version: 2

Secauth: off

Threads: 0

Interface {

Ringnumber: 0

Bindnetaddr: your ip address segment, such as 192.168.1.0

Mcastaddr: 226.94.1.1

Mcastport: 5405

Ttl: 64

}

}

Logging {

Fileline: off

To_stderr: no

To_logfile: yes

To_syslog: no

Logfile:/var/log/cluster/corosync. log

Debug: off

Timestamp: on

Logger_subsys {

Subsys: AMF

Debug: off

}

}

Amf {

Mode: disabled

}

EOF

Service corosync restart

Install the latest qemu

Git clone git: // git.sv.gnu.org/qemu.git

Cd qemu

./Configure

Make install

Cd ..

Install sheepdog

Source code Installation

Rpm-Uvh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-7.noarch.rpm

Yum install userspace-rcu-devel-y

Cd/root

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

Cd sheepdog

./Autogen. sh

./Configure

Make install

Cd ..

Installing the latest libvirt requires new kernel support)

Yum install device-mapper-devel-y

Yum install python-devel-y

Yum install libnl-devel-y

Yum install lib-xml2-y

Yum install-y gnutls-devel

Git clone git: // libcmd.org/libcmd.git

Cd libvirt

./Autogen. sh

Make

Make install

2. Use

Mkdir-p/var/lib/sheepdog

A block device or partition is required for sheepdog.

Mount/dev/vg_datap/lv_for_sheep/var/lib/sheepdog

Start the service

/Etc/init. d/sheepdog start

Or

Sheep/var/lib/sheepdog

/Var/lib/sheepdog is the storage location of sheepdog. This directory must be in xattr ext3 ext4 format.

Add a user to use sheepdog

Remount the sheepdog storage location

Format a sheepdog Cluster

Collie cluster format -- copies = 3

Copies indicates the number of image redundancy.

It can also be formatted in the background.

Collie cluster format-B farm -- copies = 3

Reuse operations

1) view the cluster status

Collie node list

[Root @ dell3 ~] # Collie node list

M Id Host: Port V-Nodes Zone

-0 10.10.11.100: 7000 64 2030766602

-1 10.10.11.101: 7000 64-720696822

-2 10.10.11.102: 7000 64-167048694

-3 10.10.11.103: 7000 64-133494262

2) generate an image

Qemu-img create sheepdog: Alice 256G

3) convert an existing image to sheepdog.

Qemu-img convert-t writethrough ~ /Amd64.raw sheepdog: Bob

4) view the image

Collie vdi list

5) Start the VM

Qemu-system-x86_64 sheepdog: Alice

6) modify the cache Mode

Qemu-system-x86_64-drive file = sheepdog: Alice, cache = writeback

7) create a VM Snapshot

Qemu-img snapshot-c name sheepdog: Alice

8) view snapshots

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 80000

Alice 0 256 GB 0.0 MB 0.0 MB 2010-03-23 c0000

Alice 1 256 GB 0.0 MB 0.0 MB 2010-03-23 40000

9) Start from the specified Snapshot

Qemu-system-x86_64 sheepdog: Alice: 1

10) clone from Snapshot

Qemu-img create-B sheepdog: Alice: 1 sheepdog: Charlie

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 80000

Alice 0 256 GB 0.0 MB 0.0 MB 2010-03-23 c0000

S Alice 1 256 GB 0.0 MB 0.0 MB 2010-03-23 40000

Charlie 0 256 GB 0.0 MB 0.0 MB 2010-03-23 100000

11) Stop the Cluster

Collie cluster shutdown

12) libvirt support

<Disk type = 'network'>

<Driver name = "qemu" type = "raw" io = "threads" ioeventfd = "on" event_idx = "off"/>

<Source protocol = "sheepdog" name = "image_name">

<Host name = "hostname" port = "7000"/>

</Source>

<Target dev = "hdb" bus = "ide"/>

<Boot order = '1'/>

<Transient/>

<Address type = 'Drive 'controller = '0' bus = '1' unit = '0'/>

</Disk>

13) Start a virtual machine. The vnc port is 5902 and the NIC is e1000.

Qemu-system-x86_64 -- enable-kvm-m 2048-drive file = sheepdog: w2k3-drive file = sheepdog: w2k3d-net nic, model = e1000-vnc: 2

This article is from the "xiaoli110 blog". For more information, contact the author!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.