Koozali.org: home of the SME Server

make a mirror server

Offline lerry

  • **
  • 23
  • +0/-0
make a mirror server
« on: August 26, 2010, 06:12:23 PM »
Is there any possibility to make a mirror server of sme server? What i want is to have two server, one a perfect copy of another, and when, for some disaster, the first server goes down the second act like the first.
It is possible?

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: make a mirror server
« Reply #1 on: August 26, 2010, 07:34:38 PM »
Hi

what you are looking for is HA.. tha's not supported by SME, but you have at least 2 possibilities:
- use Affa: this is not a realtime mirroring, but should be enough
- use a cluster with any virtualization sw (I suggest Proxmox, as it's OOSS and available for free) with a virtual SME: in this way you can survive a hw failure

if you still want to try HA on SME, you'll find a howto here.. please note this is unsupported and experimental

finally, please next time use the search link above, as your question has been answered many times.  ;-)
thank you

Offline shawnbishop

  • *****
  • 298
  • +0/-0
Re: make a mirror server
« Reply #2 on: August 27, 2010, 11:24:57 AM »
We have multiple mirror servers that we successfully keep up, but we use good old fashioned rsync and crontab

I have attached a copy of the rsync script we use..

#!/bin/sh

# Simple rsync "driver" script.  (Uses SSH as the transport layer.)
# http://www.scrounge.org/linux/rsync.html

# Demonstrates how to use rsync to back up a directory tree from a local
# machine to a remote machine.  Then re-run the script, as needed, to keep
# the two machines "in sync."  It only copies new or changed files and ignores
# identical files.

# Destination host machine name
DEST="192.168.0.4"

# User that rsync will connect as
# Are you sure that you want to run as root, though?
USER="root"

# Directory to copy from on the source machine.
BACKDIR="/home/e-smith/files/ibays/dsa/files"

# Directory to copy to on the destination machine.
DESTDIR="/home/e-smith/files/ibays/dsa/files"

# excludes file - Contains wildcard patterns of files to exclude.
# i.e., *~, *.bak, etc.  One "pattern" per line.
# You must create this file.
EXCLUDES=/root/rsyncexcludes   

# Options.
# -n Don't do any copying, but display what rsync *would* copy. For testing.
# -a Archive. Mainly propogate file permissions, ownership, timestamp, etc.
# -u Update. Don't copy file if file on destination is newer.
# -v Verbose -vv More verbose. -vvv Even more verbose.
# See man rsync for other options.

# For testing.  Only displays what rsync *would* do and does no actual copying.
#OPTS="-n -vv -u -a --rsh=ssh --exclude-from=$EXCLUDES --stats --progress"
# Does copy, but still gives a verbose display of what it is doing
#OPTS="-v -u -a --rsh=ssh --exclude-from=$EXCLUDES --stats"
# Copies and does no display at all.
#OPTS="--archive --update --rsh=ssh --exclude-from=$EXCLUDES --quiet"
OPTS="--archive --update --rsh=ssh --exclude-from=$EXCLUDES --quiet"

# May be needed if run by cron?
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin

# Only run rsync if $DEST responds.
VAR=`ping -s 1 -c 1 $DEST > /dev/null; echo $?`
if [ $VAR -eq 0 ]; then
    rsync $OPTS $BACKDIR $USER@$DEST:$DESTDIR
else
    echo "Cannot connect to $DEST."
fi