Setting up DRBD in mode primary-secondary

From EN Ikoula wiki
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

en:Setting up DRBD in mode primary-secondary he:הגדרת DRBD במצב ראשי-משני ro:Configurarea DRBD în mod primar-secundar ru:Настройка DRBD в режиме первичного и вторичного pl:Definiowanie DRBD w trybie podstawowy zapasowy ja:プライマリ-セカンダリ モードで DRBD のセットアップ ar:إعداد DRBD في الوضع الابتدائي-الثانوي zh:DRBD 在小学中学在模式设置 de:Einrichten von DRBD im Modus Primär-Sekundär nl:Opzetten van DRBD in modus primaire-secundaire it:Configurazione DRBD in modalità primario-secondario pt:Configurando o DRBD no modo primário-secundário es:Configurar DRBD en modo primario-secundario fr:Mise en place de DRBD en mode primaire-secondaire

This article has been created by an automatic translation software. You can view the article source here.

Introduction

The documentation below concerns the setting up DRBD in elementary-secondary mode with the ext filesystem 4.
We will use in the example the Serverfollowing s :

  • Server n �1:
    • Name : TestDRBD 01
    • IP : 10.0.0.100
  • Server n �1:
    • Name : TestDRBD02
    • IP: 10.0.0.200

The disk used is appointing /dev/sdb and the partition used on each of Servers /dev/sdb1.

Installation

It is necessary for this establishment, to proceed with the installation of package DRBD :

apt-get install -y drbd8-utils

Configuration and implementation of DRBD

The first stage of the operation consists of the configuration of our resource DRBD.
We are, in the example, create the following file : /etc/drbd.d/testdrbd.res
The latter containing the following lines (do the two Servers):

resource testdrbd {
  meta-disk internal;
  device /dev/drbd1;
  syncer {
    verify-alg sha1;
  }
  net {
    allow-two-primaries;
  }

  on TestDRBD01 {
    disk /dev/sdb1;
    address 10.0.0.100:7789;
  }

  on TestDRBD02 {
    disk /dev/sdb1;
    address 10.0.0.200:7789;
  }
}

The next step is to do the manipulations and the launch of the resources DRBD :

  • Operation to do on both Servers:
drbdadm create-md testdrbd 

modprobe drbd
drbdadm up testdrbd
  • Can do this operation on the first Server only :
drbdadm -- --overwrite-data-of-peer primary testdrbd 
  • You must now wait until the end of synchronization, this is verifiable via the command :
cat /proc/drbd

Configuration and implementation of the system of file (Ext 4)

Now you can just format your drbd resources in order to use it, then the mount :

mkfs.ext4 /dev/drbd1
mount /dev/drbd1 /mnt

Toggle between the two Servers

This primary-secondary-mode configuration you prevents to mount the drbd on both resources Servers.
As such, here is the method to switch between the two mounting Servers :

umount /dev/drbd1
drbdadm secondary testdrbd
  • On the Server secondary (new primary ):
drbdadm primary testdrbd
mount /dev/drbd1 /mnt

You have now reversed the roles of your Servers.



This article seemed you to be useful ?

0



You are not allowed to post comments.