A recommended topology below:
Another recommended topology below:
$ sudo apt-get update
$ sudo apt-get install ssh vim gcc make gdb fakeroot build-essential \
kernel-package libncurses5 libncurses5-dev zlib1g-dev \
libglib2.0-dev qemu xorg bridge-utils openvpn vncviewer \
libssl-dev libpixman-1-dev nfs-common git
/etc/network/interfaces
):auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.11.1
netmask 255.255.255.0
gateway 192.168.11.254
dns-nameservers 8.8.8.8
eth0 is your physical NIC name, please modify it according to your actual NIC name
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
bridge_ports eth0
bridge_maxwait 0
address 192.168.11.2
netmask 255.255.255.0
gateway 192.168.11.254
dns-nameservers 8.8.8.8
auto eth0
iface eth0 inet static
address 0.0.0.0
auto eth1
iface eth1 inet static
address 192.168.111.1
netmask 255.255.255.0
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
bridge_ports eth0
bridge_maxwait 0
address 192.168.11.3
netmask 255.255.255.0
gateway 192.168.11.254
dns-nameservers 8.8.8.8
auto eth0
iface eth0 inet static
address 0.0.0.0
auto eth1
iface eth1 inet static
address 192.168.111.2
netmask 255.255.255.0
Build the high-speed connections (ex. 10G NIC) with Primary and Backup nodes by the eth1
After editing these network interfaces, type /etc/init.d/networking restart
or reboot
$ sudo apt-get install nfs-kernel-server
/etc/exports
to add your NFS folder: /home/[your username]/nfsfolder *(rw,no_root_squash,no_subtree_check)
After editing /etc/exports
, type /etc/init.d/nfs-kernel-server restart
or reboot
Go to your nfs folder, then download Cuju and build a VM image file (or download our Ubuntu-16.04 VM image file, the account/password
is root/root
), they will be synced with Primary and Backup node.
Download command
$ git clone https://github.com/Cuju-ft/Cuju
$ wget -nc https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl
$ chmod +x gdown.pl
$ ./gdown.pl https://drive.google.com/file/d/0B9au9R9FzSWKNjZpWUNlNDZLcEU/view Ubuntu20G-1604.tar.gz
Google drive download reference:
gdown.pl
$ sudo mkdir /mnt/nfs
$ sudo mount -t nfs 192.168.11.1:/home/[your username]/nfsfolder /mnt/nfs
$ cd /mnt/nfs
$ git clone https://github.com/Cuju-ft/Cuju.git
$ cd Cuju
$ ./configure --enable-cuju --enable-kvm --disable-pie --target-list=x86_64-softmmu
$ make -j8
*1
*2
$ cd Cuju/kvm
$ ./configure
$ make -j8
$ ./reinsmodkvm.sh
*1
If you meeterror: incompatible type for argument 5 of '__get_user_pages_unlocked'
, you can use this patch:$ cd Cuju $ patch -p1 < ./patch/__get_user_pages_unlocked.patch
*2
If you meeterror: implicit declaration of function 'use_eager_fpu' [-werror=implicit-function-declaration]
, you can use this patch:$ cd Cuju $ patch -p1 < ./patch/use_eager_fpu.patch
$ cd /mnt/nfs/Cuju/kvm
$ ./reinsmodkvm.sh
runvm.sh
sudo ./x86_64-softmmu/qemu-system-x86_64 \
-drive if=none,id=drive0,cache=none,format=raw,file=/mnt/nfs/Ubuntu20G-1604.img \
-device virtio-blk,drive=drive0 \
-m 1G -enable-kvm \
-net tap,ifname=tap0 -net nic,model=virtio,vlan=0,macaddr=ae:ae:00:00:00:25 \
-cpu host \
-vga std -chardev socket,id=mon,path=/home/[your username]/vm1.monitor,server,nowait -mon chardev=mon,id=monitor,mode=readline
You need to change the guest image path (file=/mnt/nfs/Ubuntu20G-1604.img
) and monitor path (path=/home/[your username]/vm1.monitor
) for your environment
$ vncviewer :5900 &
The default account/password
is root/root
if you use we provide guest image
recv.sh
sudo x86_64-softmmu/qemu-system-x86_64 \
-drive if=none,id=drive0,cache=none,format=raw,file=/mnt/nfs/Ubuntu20G-1604.img \
-device virtio-blk,drive=drive0 \
-m 1G -enable-kvm \
-net tap,ifname=tap1 -net nic,model=virtio,vlan=0,macaddr=ae:ae:00:00:00:25 \
-vga std -chardev socket,id=mon,path=/home/[your username]/vm1r.monitor,server,nowait -mon chardev=mon,id=monitor,mode=readline \
-cpu host \
-incoming tcp:0:4441,ft_mode
recv.sh
sed -e 's/mode=readline/mode=readline -incoming tcp\:0\:4441,ft_mode/g' -e 's/vm1.monitor/vm1r.monitor/g' -e 's/tap0/tap1/g' ./runvm.sh > tmp.sh
chmod +x ./tmp.sh
./tmp.sh
ftmode.sh
sudo echo "migrate_set_capability cuju-ft on" | sudo nc -U /home/[your username]/vm1.monitor
sudo echo "migrate -c tcp:192.168.111.2:4441" | sudo nc -U /home/[your username]/vm1.monitor
You need to change the ip address and port (tcp:192.168.111.2:4441
) for your environment, this is Backup Host's IP
And change the monitor path (/home/[your username]/vm1.monitor
) for your environment
If you successfully start Cuju, you will see the following message show on Primary side:
If you want to test failover
You can kill
or ctrl-c
VM on the Primary Host
You will need new session with vncviewer:
$ vncviewer :5900 &
$ vncviewer :5901 &