DRBD

Descripción

DRDB es un raid por software o un sistema de replicacion por bloques de sistemas de almacenamiento.

Prerequistos

Dos maquinas con sendos discos duros y/o particiones disponibles, conectadas por red.

Procedimiento

A. Instalación básica

Instale los paquetes basicos drbd y el modulo del kernel.

yum install drbd kmod-drbd

B. Configuración

1. Cree un archivo de configuracion en ambos nodos

Este archivo contiene

  • Disk partitions on node0 and node1.
  • Network connection between nodes.
  • Error handling
  • Synchronization

Un ejemplo se muestra en los anexos

2. Cree la particion a compartir en primer NODO

[root@node0 ~]# drbdadm create-md repdata

Reinicie el equipo para que reconozca esto y ya levante el servicio drbd. Puede hacerle seguimiento con “cat /proc/drbd”

3. Cree la particion a compartir en segundo  NODO

[root@node1 ~]# drbdadm create-md repdata

Reinicie el equipo y/o reinicie el servicio drbd. Puede hacerle seguimiento con “cat /proc/drbd” y debe mostrar que los dos se  ven.

4. Designe y sincronice el nodo primario

Y  monitoree hasta que termine

[root@node0 ~]# drbdadm -- --overwrite-data-of-peer primary repdata[root@node0 ~]# watch cat /proc/drbd

5. Formatee monte e inicie a probarlo

En el nodo primario puede iniciar a usarlo con

[root@node0 ~]# mkfs.ext3 -L repdata /dev/drbd0 

Montelo en una particion

[root@node0 ~]# mount /dev/drbd0 /repdata

Cree un par de archivos ahi

[root@node0 ~]# for i in {1..2};do dd if=/dev/zero of=/repdata/file$i bs=1M count=100;done

4. Compruebe replicacion

Para hacer esto debe cambiar los roles entre primario y secundario para poderlo montar en el otro nodo

[root@node0 ~]# umount /repdata[root@node0 ~]# drbdadm secondary repdata

Ahora active y monte en el segundo

[root@node1 ~]# drbdadm primary repdata[root@node1 ~]# mount /dev/drbd0 /repdata

Ahora revise los archivos y deben estar OK

Como integro otros sistemas

1. MySQL - MariaDB

http://www.bits-pilani.ac.in:12360/courses/SDETC103/MySQL - MariaDB/manual.html#ha-drbd-install –

Excelente documento aun cuando no vaya a usar MySQL - MariaDB

2. LVM

Problemas

1. Nadie me dice como integrar con Heartbeat v2

2.Cuando NO USAR DRBD

http://fghaas.wordpress.com/2007/06/26/when-not-to-use-drbd/ –

2.Split Brain

http://www.drbd.org/users-guide/s-resolve-split-brain.html

At this point, unless you configured DRBD to automatically recover from split brain, you must manually intervene by selecting one node whose modifications will be discarded (this node is referred to as the split brain victim). This intervention is made with the following commands:

drbdadm secondary resourcedrbdadm -- --discard-my-data connect resource

On the other node (the split brain survivor), if its connection state is also StandAlone, you would enter:

drbdadm connect resource

Referencias

- User Guide Oficial http://www.drbd.org/users-guide/about.html

- Howto de Centos en Español http://wiki.centos.org/es/HowTos/Ha-Drbd –

FIN

global {# minor-count 1; usage-count no}resource repdata {protocol C; # There are A, B and C protocols. Stick with C.# incon-degr-cmd "echo 'DRBD Degraded!' | wall; sleep 60 ; halt -f";# If a cluster starts up in degraded mode, it will echo a message to all# users. It'll wait 60 seconds then halt the system.on ping.skinatech.com {device /dev/drbd0; # The name of our drbd device.disk /dev/sdb1; # Partition we wish drbd to use.address 192.168.12.21:7788; # node0 IP address and port number.meta-disk internal; # Stores meta-data in lower portion of sdb1.}on pong.skinatech.com {device /dev/drbd0; # Our drbd device, must match node0.disk /dev/sdb1; # Partition drbd should use.address 192.168.12.22:7788; # IP address of node1, and port number.meta-disk internal; #Stores meta-data in lower portion of sdb1.}disk {on-io-error detach; # What to do when the lower level device errors.}net {max-buffers 2048; #datablock buffers used before writing to disk.ko-count 4; # Peer is dead if this count is exceeded.#on-disconnect reconnect; # Peer disconnected, try to reconnect.}syncer {rate 10M; # Synchronization rate, in megebytes. Good for 100Mb network.#group 1; # Used for grouping resources, parallel sync.al-extents 257; # Must be prime, number of active sets.}startup {wfc-timeout 0; # drbd init script will wait infinitely on resources.degr-wfc-timeout 120; # 2 minutes.}} # End of resource repdata

15-Mayo-2009 J.E.Gomez v1.0 Primera version


Advertencia

Este documento es privado y es de u so exclusivo de sus autores y de SKINA TECH. Cualquier uso sin una autorización escrita es contra la ley de derechos de autor y de propiedad intelectual, y será motivo de una acción legal.


 

Volver arriba