当前位置: 首页 > 工具软件 > Remus > 使用案例 >

ubutnu12.10安装xen4.2.1以及remus和DRBD

薛滨海
2023-12-01

1. 系统首先配置LVM


2. 配置网络

apt-get install bridge-utils
vi /etc/network/interfaces
#
auto xenbr0
iface xenbr0 inet static
	address			//本机IP
	netmask 		//子网掩码
	gateway 		//网关地址
	dns-nameservers //dns地址
	ridge_ports eth0

auto eth0
iface eth0 inet manual
#
/etc/init.d/networking restart

vi /etc/hosts
#
10.0.1.50 left
10.0.1.51 right
#

3. 准备安装Xen

apt-get install libjpeg-turbo8-dev
apt-get install libvncserver-dev
apt-get install git-core mercurial screen tcpdump minicom ntp ntpdate tree debootstrap bcc bin86 gawk bridge-utils
apt-get install iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif texinfo pciutils-dev build-essential make gcc 
apt-get install libc6-dev zlib1g-dev python python-dev python-twisted libncurses5-dev patch libvncserver-dev iasl libbz2-dev 
apt-get install e2fslibs-dev uuid-dev libtext-template-perl autoconf debhelper debconf-utils docbook-xml docbook-xsl dpatch xsltproc rcconf bison flex 
apt-get install gcc-multilib ocaml-findlib libyajl-dev yajl-tools libglib2.0-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev

4. 安装Xen

apt-get install transfig libpixman-1-dev
#latest
apt-get install git-core
git clone git://xenbits.xen.org/xen.git
#release
wget http://bits.xensource.com/oss-xen/release/4.2.1/xen-4.2.1.tar.gz
tar zxvf xen-4.2.1.tar.gz
cd xen-4.2.1
wget http://download.locatrix.com/xen/remus-qdisc-py.patch
patch -p1 < remus-qdisc-py.patch
./configure --enable-githttp
vi ./.config
#
PYTHON_PREFIX_ARG=--install-layout=deb
#
make world
make deb

cd /home/eross/xen-4.2.1/dist
./install.sh

update-grub

ls -al /boot/xen*
-rw-r--r-- 1 root root   802303 Jan 30 20:57 /boot/xen-4.2.1.gz
lrwxrwxrwx 1 root root       12 Jan 30 20:57 /boot/xen-4.2.gz -> xen-4.2.1.gz
lrwxrwxrwx 1 root root       12 Jan 30 20:57 /boot/xen-4.gz -> xen-4.2.1.gz
lrwxrwxrwx 1 root root       12 Jan 30 20:57 /boot/xen.gz -> xen-4.2.1.gz
-rw-r--r-- 1 root root 15388780 Jan 30 20:57 /boot/xen-syms-4.2.1

update-rc.d xencommons defaults 19 18
update-rc.d xendomains defaults 21 20
update-rc.d xen-watchdog defaults 22 23


apt-get install libtext-template-perl libconfig-inifiles-perl libfile-slurp-perl liblist-moreutils-perl
wget http://mirror.pnl.gov/ubuntu/pool/universe/x/xen-tools/xen-tools_4.3.1-1_all.deb
dpkg -i xen-tools_4.3.1-1_all.deb

reboot

5. 安装DRBD

apt-get install autoconf build-essential
wget http://remusha.wikidot.com/local--files/configuring-and-installing-remus/drbd-8.3.11-remus.tar.gz
tar zxvf <span style="font-family: Arial, Helvetica, sans-serif;">drbd-8.3.11-remus.tar.gz</span>
cd ./drbd-8.3.11
./autogen.sh
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-km
make
make install
cd drbd
make clean all
make install
vi /etc/modules
# add drbd

6. 配置DRBD

cp /home/user/drbd-8.3.11/scripts/global_common.conf.protoD /etc/drbd.d/global_common.conf
cp /home/user/drbd-8.3.11/scripts/testvms_protoD.res /etc/drbd.d/SystemHA_protoD.res
lvcreate -n test -L 10G right
vi /etc/drbd.d/SystemHA_protoD.res
#
resource drbd-vm {
        device /dev/drbd1;
        disk /dev/right/test;
        meta-disk internal;
        on left {
                address IP地址:端口;
        }
        on right{
                address IP地址:端口;
        }
}
#

drbdadm create-md drbd-vm
drbdadm up drbd-vm


root@null:~$ cat /proc/drbd 
version: 8.3.9 (api:88/proto:86-95)
GIT-hash: 3ba4fc581d6215744597b3d4c525db276ce000ee build by root@null, 2011-05-14 19:33:56

 1: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent D r-----

设置主节点

drbdadm -- --overwrite-data-of-peer primary drbd-vm


若drbd同步过程中,两个节点都出现standalone状态,表明drbd进入脑裂状态。

secondary节点:
drbdadm secondary db
drbdadm disconnect drbd-vm 
drbdadm -- --discard-my-data connect drbd-vm

primary节点:
drbdadm connect drbd-vm

7. 配置remus

vi /etc/xen/xend-config.sxp
# Ensure the following are uncommented
(xend-relocation-server yes)
(xend-relocation-port 8002)
(xend-relocation-address '')
(xend-relocation-hosts-allow '')
#

vi /etc/modules
#
sch_plug
sch_prio
sch_ingress
cls_basic
cls_tcindex
cls_u32
act_mirred
ifb
#

8. 测试remus

pvcreate /dev/drbd1
vgcreate drbdtest /dev/drbd1
或者 pvcreate /dev/left/test    vgcreate drbdtest /dev/left/test
xen-create-image --hostname=ubuntu \
  --memory=512mb \
  --vcpus=2 \
  --lvm=drbdtest \
  --dhcp \
  --pygrub \
  --dist=precise


xm create /etc/xen/ubuntu.cfg -c
xm list

# test live migration, if you can't live migrate, then Remus isn't going to work either
xm migrate --live rt right

# try remus ("rt" is the domU, and "right" is the other server, assuming we're running from "left" here)
remus -i 40 rt right

# You should get a whole bunch of these messages:
#
PROF: flushed memory at 1361239602.516625
PROF: suspending at 1361239602.554033
#

可以通过以下任一命令查看remus是否成功

pkill -USR1 remus
xm destory ubuntu



 类似资料: