hot standby VM
-
librarymark
- Posts: 18
- Joined: 28. Apr 2010, 15:16
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: Ubuntu, WIndows XP, freebsd
hot standby VM
Hello, all -
I have to come up with a way to make two vm host servers stay in sync. My boss wants me to make it such that if one of our servers craps out, I can bring up all the vm's on the other server with little down time as possible (of course) and have the Vm's no more than a day out of date data wise.
I have done a lot of searching on this forum and haven't run across a definitive method for doing this. I would rather not have to bring down a vm to clone it if I don't have to.
Can someone point me to a better way than just stopping the running vm and copying it? Would I be able to copy snapshot files from one Vm to an Identical Vm on another physical host?
Thanks!
Library Mark
I have to come up with a way to make two vm host servers stay in sync. My boss wants me to make it such that if one of our servers craps out, I can bring up all the vm's on the other server with little down time as possible (of course) and have the Vm's no more than a day out of date data wise.
I have done a lot of searching on this forum and haven't run across a definitive method for doing this. I would rather not have to bring down a vm to clone it if I don't have to.
Can someone point me to a better way than just stopping the running vm and copying it? Would I be able to copy snapshot files from one Vm to an Identical Vm on another physical host?
Thanks!
Library Mark
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: hot standby VM
For Windows hosts check out shadowcopy, or Google live backup site:forums.virtualbox.org
-
librarymark
- Posts: 18
- Joined: 28. Apr 2010, 15:16
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: Ubuntu, WIndows XP, freebsd
Re: hot standby VM
Thanks, Perryg - sadly, I am using Ubuntu Server 11.04. I guess I should have mentioned it.
-
mschwartz
- Posts: 92
- Joined: 18. Oct 2010, 21:01
- Primary OS: MS Windows 7
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: ubuntu
Re: hot standby VM
http://linux.about.com/library/cmd/blcmdl1_rdist.htm
NAME
rdist - remote file distribution client program
...
DESCRIPTION
Rdist is a program to maintain identical copies of files over multiple hosts. It preserves the owner, group, mode, and mtime of files if possible and can update programs that are executing.
NAME
rdist - remote file distribution client program
...
DESCRIPTION
Rdist is a program to maintain identical copies of files over multiple hosts. It preserves the owner, group, mode, and mtime of files if possible and can update programs that are executing.
-
librarymark
- Posts: 18
- Joined: 28. Apr 2010, 15:16
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: Ubuntu, WIndows XP, freebsd
Re: hot standby VM [Solved]
So I wound up using LVM snapshots and rsync. Works very well so far in testing. I keep one machine on the production VM server and export it to an appliance, Then, import the appliance on the backup server. When creating the VM, make sure that there is unused space on the disk so that the LVM snapshots work. Also be sure the share the ssh key from the primary VM to the backup - see http://www.debian-administration.org/articles/152.
Near as I can tell, if the primary VM fails, all I have to do is change the IP of the backup vm and we are back in business.
(I'm using Ubuntu 9.10 server for testing)
My bash test script looks like this:
and exclude_list.txt looks like this:
LIke I said, it seems to be working well. I can install software on the original VM and run the backup script, and the same software runs on the backup machine. If anyone can help me improve this or point out mistakes I would be grateful. This of course does not work for VM's that don't support LVM's like my pfsense firewalls and such, but it's a huge step forward.
Near as I can tell, if the primary VM fails, all I have to do is change the IP of the backup vm and we are back in business.
(I'm using Ubuntu 9.10 server for testing)
My bash test script looks like this:
Code: Select all
#!/bin/bash
remote_machine="<remote machine IP>"
local_mysql_password="<local mysql password>"
LVCREATE="/sbin/lvcreate"
LVREMOVE="/sbin/lvremove"
MYSQL="/usr/bin/mysql"
MOUNT="/bin/mount"
UMOUNT="/bin/umount"
SSH="/usr/bin/ssh"
RSYNC="/usr/bin/rsync"
# flush and lock local mysql
$MYSQL -p$local_mysql_password -e 'flush tables with read lock; flush logs;'
# create snapshot
$LVCREATE -pr -L5G -s -n rootsnapshot /dev/lvm-test/root
# unlock local mysql
$MYSQL -p$local_mysql_password -e 'unlock tables;'
# mount the snapshot
$MOUNT /dev/lvm-test/rootsnapshot /mnt/rootsnapshot/
# stop apache and mysql on remote host
$SSH $remote_machine '/etc/init.d/apache2 stop'
$SSH $remote_machine 'stop mysql'
# do backup here
$RSYNC --exclude-from /root/exclude_list.txt --delete -avz -e ssh / root@$remote_machine:/
# start mysql and apache on remote host
$SSH $remote_machine 'start mysql'
$SSH $remote_machine '/etc/init.d/apache2 start'
# unmount the snapshot
$UMOUNT /mnt/rootsnapshot/
# remove the snapshot
$LVREMOVE -f /dev/lvm-test/rootsnapshot
Code: Select all
/root/.ssh
/etc/udev
/var/lib/nfs
/proc
/sys
/dev
/tmp
/mnt
/var/run
/var/lib/ureadahead
Re: hot standby VM
The backup VM's can use the same IP/Mac just keep cable connect set to disconnected or keep them offline, the other Host's IP is not important. If possible use shared storage, that will keep the VM's really small while the data is not inside them.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
librarymark
- Posts: 18
- Joined: 28. Apr 2010, 15:16
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: Ubuntu, WIndows XP, freebsd
Re: hot standby VM
The issue with disconnecting the network cable disconnected is that the backup won't run. When you create the appliance, it gets a new MAC. I have the backup script running every hour.
Re: hot standby VM
If the VM and VBox is not running then the backup(rsync) will update the target, for testing purpose you can bring up a vm with cable disconnected. The MAC can and should be made the same, a hot standby is useless if things need to be changed.
For example when using 2 Hosts where the second is serving as a hot standby but also running other stuff the standby VM's are registered but in a shutdown state, rsync mirrors from A to B but in a separate folder, a small script de-registers the shutdown VDI's, moves the rsynced images, re-registers them and starts them, all with the same uuid/ip and mac. When A is back up the same applies in reverse.
For example when using 2 Hosts where the second is serving as a hot standby but also running other stuff the standby VM's are registered but in a shutdown state, rsync mirrors from A to B but in a separate folder, a small script de-registers the shutdown VDI's, moves the rsynced images, re-registers them and starts them, all with the same uuid/ip and mac. When A is back up the same applies in reverse.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
librarymark
- Posts: 18
- Joined: 28. Apr 2010, 15:16
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: Ubuntu, WIndows XP, freebsd
Re: hot standby VM
My "system" is talking vm to vm, not vm-host to vm-host. If I turn off the backup VM, it does not get updated.
Re: hot standby VM
Huh? what exactly are you updating then? hopefully you are rsyncing vdi to vdi, any other way is a bit cumbersome.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
librarymark
- Posts: 18
- Joined: 28. Apr 2010, 15:16
- Primary OS: Ubuntu other
- VBox Version: OSE other
- Guest OSses: Ubuntu, WIndows XP, freebsd
Re: hot standby VM
Right now I am backing up from one VM to another.
-
bb42
- Posts: 4
- Joined: 21. Jan 2012, 12:33
- Primary OS: MS Windows XP
- VBox Version: OSE other
- Guest OSses: XP
Re: hot standby VM
On my Linux Debian Server, I now use OpenVZ as part of Promox VE - this includes a Cluster option, i.e. central management of multiple physical servers in a master-slave relation.
For my windows clients, I found the various features of VirtualBox with Windows surpass any Linux option.
For my windows clients, I found the various features of VirtualBox with Windows surpass any Linux option.
-
Technologov
- Volunteer
- Posts: 3342
- Joined: 10. May 2007, 16:59
- Location: Israel
Re: hot standby VM
My recommendation:
make 2 servers, and single shared storage (via NFS or SMB), so you can share one VM on both servers:
Machine->add (the VM on both hosts)
then:
You need to check if guest is alive or not, and if not, just fire up the VM on second host.
You can check either by ping or "Guest Control exec".
make 2 servers, and single shared storage (via NFS or SMB), so you can share one VM on both servers:
Machine->add (the VM on both hosts)
then:
You need to check if guest is alive or not, and if not, just fire up the VM on second host.
You can check either by ping or "Guest Control exec".
Re: hot standby VM
i am new in cluster server using virtualbox so please give me information about it what ever you all know about it because i want to prepare research paper on it.
Last edited by Perryg on 21. Feb 2013, 18:55, edited 1 time in total.
Reason: removed unnecessary coding.
Reason: removed unnecessary coding.