[DRBD-user] Temporary accessing files on a secondary node

Ehud Karni ehud at unix.mvs.co.il
Tue Apr 21 14:04:06 CEST 2009

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


On Mon, 20 Apr 2009 10:48:05 -0400, Guillaume de Rorthais wrote:
>
> Presently, rsync is taking way too much time and load on the server,
> that's why we are planing to use DRBD: keep an up-to-date backup
> server (we have today one backup per 24 hours) reduce load on primary.
>
> And we would prefer to access accurate data if needed on the
> secondary backup server.

We have the same setup. We use rsync to keep snapshots (at 24h each),
and use DRBD for backup (both on site and remote disaster recovery,
see my other mail on the 3 node setup).

I wrote 2 small scripts to de/activate the secondary and tertiary nodes.
We have an LVM partition on the DRBD one, so it must be de/activated too.
They are listed below (with my local host and disk names).

Ehud.



#! /bin/sh -ex

case `hostname` in
    rmt-fs* ) RSC="rmt"  ;;                # resource name on rmt-fs(-lcl)
    bu-pro2 ) RSC="lcl"  ;;                # resource name on bu-pro2
esac

##  cat /proc/drbd                             # show drbd status
drbdadm disconnect $RSC                    # disconnect from primary
drbdadm primary $RSC                       # Promote to primary status
##  cat /proc/drbd                             # show drbd status
vgscan                                     # see /dev/drbd0 now
##  lvdisplay                                  # show new lv (not activated)
lvchange -a y ulvm                         # activate it
mount /dev/ulvm/mvsdsk /lcl-fs-nfs         # mount it, so it can be used
############### end of drbd-destination-use-localy.sh ###############



#! /bin/sh -ex

case `hostname` in
    rmt-fs* ) RSC="rmt"  ;;                        # resource name on rmt-fs(-lcl)
    bu-pro2 ) RSC="lcl"  ;;                        # resource name on bu-pro2
esac

##  cat /proc/drbd                                     # show drbd status
umount /lcl-fs-nfs                                 # umount it (must)
lvchange -a n ulvm                                 # de-activate it
drbdadm secondary $RSC                             # disable /dev/drbd<N>
vgscan                                             # update LVM tables (drop drbd lv)
drbdadm -- --discard-my-data connect $RSC          # stop the "split-brain" status and resynchronize

##  cat /proc/drbd                                     # show drbd status
##  sleep 15
##  cat /proc/drbd                                     # show drbd status
##  sleep 15
##  cat /proc/drbd                                     # show drbd status
############### end of drbd-destination-sync-mode.sh ###############


--
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry



More information about the drbd-user mailing list