Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
 
Sv translation
languageen

Notes

We no longer support DRBD on the base file system. We always install with LVM for maintenance purposes.

We use the whole disk, so increasing size is done using LVM by adding new disks.

It is recommended to create the STORE machine without the disk for the storage being mounted by the installation routines. 

Disk and DRBD Setup

Create LVM Physical Volume, Volume Group and Logical Volume (Both Nodes)

The commands below assume that /dev/sdb will be used for the DRBD on top of LVM configuration, and that the disks are EXACTLY the same size.

Code Block
# Create the phsyical volume - this is based on sdb assuming it is the second drive on the system
lvm pvcreate /dev/sdb
 
# Create the volume group
lvm vgcreate "vg_drbd_jtelshared" /dev/sdb
 
# Create the logical volume
lvm lvcreate -l +100%FREE vg_drbd_jtelshared -n lv_drbd_jtelshared

Configure Firewall for DRBD (Both Nodes)

Code Block
# Prepare the firewall
firewall-cmd --zone=public --add-port=7788-7799/tcp --permanent
firewall-cmd --reloadufw allow 7788:7799/tcp

Prepare Mount Point (Both Nodes)

The data should be mounted to the directory /srv/jtel/shared.

The following commands prepare for this:

Code Block
languagebash
mkdir /srv/jtel
mkdir /srv/jtel/shared
chown -R jtel:jtel /srv/jtel

Install

ELrepo and

DRBD (Both Nodes)

We now install DRBD 9. This requires using the ELrepo. Also, SELinux must be set to permissive for DRBD. The kernel package is included in debian, but the tools must be installed.

Code Block
languagebash
dnfapt-get -y install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
dnf -y install drbd90-utils kmod-drbd90
systemctl enable drbd
semanage permissive -a drbd_t
systemctl start drbd

Configure DRBD (Both Nodes)

DRBD must be configured with static ip addresses and correct hostnames.

The IP addresses below must be modified:

Status
colourRed
titleCAUTION IP ADDRESSES
Status
colourRed
titleCAUTION HOSTNAMES
drbd-utils

Configure DRBD (Both Nodes)

DRBD must be configured with static ip addresses and correct hostnames.

The IP addresses below must be modified:

Status
colourRed
titleCAUTION IP ADDRESSES
 
Status
colourRed
titleCAUTION HOSTNAMES

Code Block
# Configure DRBD
cat <<EOFF > /etc/drbd.d/jtelshared.res
resource jtelshared {
    protocol C;
    meta-disk internal;
    device /dev/drbd0;
    syncer {
        verify-alg sha1;
    }
    net {
        allow-two-primaries;
    }
    on acd-lb1.jtel.local {
        disk   /dev/vg_drbd_jtelshared/lv_drbd_jtelshared;
        address 10.1.1.1:7789;
    }
    on acd-lb2.jtel.local {
        disk   /dev/vg_drbd_jtelshared/lv_drbd_jtelshared;
        address 10.1.1.2:7789;
    }
}
EOFF

Global configuration (note, the c-max-rate is good for a 1GBit network. You might want to change this.

Code Block
cp /etc/drbd.d/global_common.conf /etc/drbd.d/global_common.conf.orig
cat << EOFF > /etc/drbd.d/global_common.conf
global {
    usage-count no;
    udev-always-use-vnr;
}

common {
    handlers {
    }

    startup {
    }

    options {
    }

    disk {
        c-plan-ahead 10;
        c-fill-target 24M;
        c-min-rate 10M;
        c-max-rate 100M;
    }

    net {
        max-buffers 36k; 
        sndbuf-size 1024k;
        rcvbuf-size 2048k;
    }
}
EOFF

Start and Enable Kernel Module (Both Nodes)

Code Block
modprobe drbd
systemctl enable drbd
systemctl start drbd

Create Metadata and Start (Both Nodes)

Code Block
# Create metadata and start DRBD
drbdadm create-md jtelshared
drbdadm up jtelshared

Make ONE Node Primary

Code Block
# Make ONE node primary
drbdadm primary jtelshared --force

Wait for Sync

DRBD will now sync. This might take some time.

Note: with DRBD9 we currently have no options to tune the transfer.

You can watch the initial sync with the following command:

Code Block
drbdadm status jtelshared

You will see outbout like this:

Code Block
jtelshared role:Primary
  disk:UpToDate
  acd-store2 role:Secondary
    replication:SyncSource peer-disk:Inconsistent done:7.19

This means the following:

  • The local machine is primary.
  • The disk in the local machine is up to date.
  • acd-store2 is secondary
  • It is inconsistent and syncing, 7.19% done
Warning

Do not continue until this step is complete.

Make Second Node Primary (SECOND NODE ONLY)

Code Block
drbdadm primary jtelshared

Create the Filesystem (FIRST NODE ONLY)

Code Block
mkfs.ext4 /dev/drbd/by-res/jtelshared/0

Create fstab entry for file system (Both Nodes)

This command adds a line to /etc/fstab

Code Block
cat << EOFF >> /etc/fstab
/dev/drbd/by-res/jtelshared/0  /srv/jtel/shared         ext4 noauto,noatime,nodiratime  0   0
EOFF

Test DRBD

Now, we can test the DRBD setup.

Mount the file system (FIRST Node)

Code Block
mount /srv/jtel/shared

Create a test file and Unmount (FIRST Node) 

Code Block
cat <<EOFF > /srv/jtel/shared/test.txt
test 123
EOFF
umount /srv/jtel/shared

Mount the file system and check test file (SECOND Node)

Code Block
mount /srv/jtel/shared
cat /srv/jtel/shared/test.txt

# Check contents of file before proceeding  
  
rm /srv/jtel/shared/test.txt
umount /srv/jtel/shared


Warning

Do not proceed unless you can see the contents of the test file.

Comment Mount out in fstab (BOTH nodes) and disable DRBD

Code Block
sed -i '/jtelshared/s/^/#/' /etc/fstab
systemctl disable drbd
umount /srv/jtel/shared

Install PCS Cluster (BOTH NODES)

Info

If you have not installed Pacemaker / Corosync on both LB machines, do this now - see here: Redundancy - Installing PCS Cluster

Install and Configure Samba 

Installation (BOTH NODES)

These commands install the samba server and client and lsof.

Translations Ignore


Code Block
apt-get -y install samba samba-client lsof


Next disable smbd (this will be managed by the pcs cluster):

Translations Ignore


Code Block
systemctl stop smbd
systemctl disable smbd


Configure Samba (BOTH NODES)

The following creates a samba configuration file with a minimum configuration.

Translations Ignore


Code Block
# SMB Conf
cat <<EOFF > /etc/samba/smb.conf
[global]
    workgroup = JTEL
    security = user
    passdb backend = tdbsam
    min protocol = SMB2
    reset on zero vc = yes
[shared]
    comment = jtel ACD Shared Directory
    public = no
    read only = no
    writable = yes
    locking = yes
    path = /srv/jtel/shared
    create mask = 0644
    directory mask = 0755
    force user = jtel
    force group = jtel
    acl allow execute always = True
EOFF


Setup the Firewall (BOTH NODES)

The following command sets up the firewall:


Translations Ignore


Code Block
ufw allow 445/tcp


Link /home/jtel/shared (BOTH NODES)

Link the /home/jtel/shared folder. 

Translations Ignore


Code Block
ln -s /srv/jtel/shared /home/jtel/shared


Setup Access to the Samba Server

jtel User Access (BOTH NODES)

The following command creates the smb credentials for the jtel user.

Status
colourRed
titleCaution Password

Translations Ignore


Code Block
printf '<password>\n<password>\n' | smbpasswd -a -s jtel


Further User Access (BOTH NODES)

If necessary, add further users to samba - replacing password with the actual password for the user. Here, for example, the windows administrator user:

Status
colourRed
titleCaution Password

Translations Ignore


Code Block
useradd -m Administrator
printf '<password>\n<password>\n' | smbpasswd -a -s Administrator


Configure Cluster Resources

Now all resources will be configured in the pacemaker cluster.

Setup virtual IP (One Node Only!)

Change the following to set the virtual IP which should be shared between the nodes.

Status
colourRed
titleCaution IP Address

Code Block
JT_VIP=10.1.1.100

Configure PCS Resources for DRBD Mount, DRBD Primary / Secondary, Samba and Virtual IP Address (One Node Only!)

Configure the PCS resources with the following commands:

Code Block
# Configure using a file jtel_cluster_config
cd
pcs cluster cib jtel_cluster_config
# DRBD Primary Secondary
pcs -f jtel_cluster_config resource create DRBDClusterMount ocf:linbit:drbd drbd_resource=jtelshared op monitor interval=60s
pcs -f jtel_cluster_config resource promotable DRBDClusterMount promoted-max=1 promoted-node-max=1 clone-max=2 clone-node-max=1 notify=true
# DRBD File System Mount
pcs -f jtel_cluster_config resource create DRBDClusterFilesystem ocf:heartbeat:Filesystem device="/dev/drbd/by-res/jtelshared/0" directory="/srv/jtel/shared" fstype="ext4"
# Colocation of File System Mount with Primary DRBD instance
pcs -f jtel_cluster_config constraint colocation add DRBDClusterFilesystem with DRBDClusterMount-clone INFINITY with-rsc-role=Master
# Promote first, then start filesystem
pcs -f jtel_cluster_config constraint order promote DRBDClusterMount-clone then start DRBDClusterFilesystem
# Resource for Samba
pcs -f jtel_cluster_config resource create Samba systemd:smbd op monitor interval=30s 
# Resource for virtual IP
pcs -f jtel_cluster_config resource create ClusterIP ocf:heartbeat:IPaddr2 ip=${JT_VIP} cidr_netmask=32 op monitor interval=30s
# Samba must be with active DRBD filesystem
pcs -f jtel_cluster_config constraint colocation add Samba with DRBDClusterFilesystem INFINITY
# Cluster IP must be with Samba
pcs -f jtel_cluster_config constraint colocation add ClusterIP with Samba INFINITY
# Start DRBD File system then start Samba
pcs -f jtel_cluster_config constraint order DRBDClusterFilesystem then Samba
# Start Samba then start Cluster IP
pcs -f jtel_cluster_config constraint order Samba then ClusterIP

Check the configuration:

Code Block
# Check the config file
pcs -f jtel_cluster_config config

Push the configuration to the cluster:

Code Block
# Push the config to the cluster
pcs cluster cib-push jtel_cluster_config --config

Ensure ownership of jtel directory:

Code Block
chown -R jtel:jtel /srv/jtel

Tests

Test pcs status

First of all, we test the cluster status:

Code Block
pcs status

You should see output similar to this:


Code Block
Cluster name: jtel_cluster
Cluster Summary:
  * Stack: corosync
  * Current DC: acd-lb1 (version 2.0.3-5.el8_2.1-4b1f869f0f) - partition with quorum
  * Last updated: Sat Oct  3 12:59:34 2020
  * Last change:  Sat Oct  3 12:31:22 2020 by root via cibadmin on acd-lb2
  * 2 nodes configured
  * 5 resource instances configured

Node List:
  * Online: [ acd-lb1 acd-lb2 ]

Full List of Resources:
  * Clone Set: DRBDClusterMount-clone [DRBDClusterMount] (promotable):
    * Masters: [ acd-lb1 ]
    * Stopped: [ acd-lb2 ]
  * DRBDClusterFilesystem       (ocf::heartbeat:Filesystem):    Started acd-lb1
  * Samba       (systemd:smb):  Started acd-lb1
  * ClusterIP   (ocf::heartbeat:IPaddr2):       Started acd-lb1

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

Make sure all of the resources are started and both nodes are online.

Test File Mount

You should now be able to access \\acd-store\shared from the windows machines for example. 

If you want to test from linux, you will need to mount STORE as described here: Mounting STORE - All Linux except for STORE (CentOS8/Win2019)

Test Failover and Failback

You can test failover and failback with any of the following commands:

Standby and Unstandby

Caution: standby and unstandby have been observed to not failover the resources correctly. 

Use with caution.

Code Block
pcs node standby acd-lb1

# TEST

pcs node unstandby acd-lb1

# TEST

pcs node standby acd-lb2

# TEST

pcs node unstandby acd-lb2

# TEST

Stop Cluster Node

Code Block
pcs cluster stop acd-lb1

# TEST

pcs cluster start acd-lb1

# TEST

pcs cluster stop acd-lb2

# TEST

pcs cluster start acd-lb2

# TEST

Reboot

Rebooting is also a good way to test.

Power Off

This is the best way to test, but be aware, you may cause split brain on DRBD and need to repair it.

Debian 11 - Possible ruby problem

It has been observed, that the following file contains errors, even if the cluster "appears" to be working properly.

Code Block
less /var/log/pcsd/pcsd.log

--> 

E, [2022-04-03T00:06:25.007 #43472]    ERROR -- : Unable to connect to node acd-store4, the node is not known
E, [2022-04-03T00:06:25.007 #43472]    ERROR -- : Unable to connect to node acd-store3, the node is not known

This can be fixed as follows:

Code Block
# ON BOTH NODES

# Install missing ruby library
gem install orderedhash

# Unauthorize the cluster
pcs pcsd deauth

# ON ONE NODE

# Authorize the cluster
pcs cluster auth -u hacluster -p <password>

# CHECKS
less /var/log/pcsd/pcsd.log

#### Log should look “normal”

pcs status

#### Cluster should look „normal“


Sv translation
languagede

Status
colourRed
titleTHIS PAGE IS ONLY AVAILABLE IN ENGLISH

Sv translation
languagefr

Notes

Nous ne soutenons plus le DRBD sur le système de fichiers de base. Nous installons toujours avec LVM pour des raisons de maintenance.

Nous utilisons le disque entier, donc l'augmentation de la taille se fait en utilisant LVM par l'ajout de nouveaux disques.

Il est recommandé de créer la machine MAGASIN sans que le disque de stockage soit monté par les routines d'installation. 

Configuration du disque et du DRBD

Créer le volume physique LVM, le groupe de volumes et le volume logique de LVM (Les deux nœuds)

Les commandes ci-dessous supposent que /dev/sdb sera utilisé pour le DRBD en plus de la configuration LVM, et que les disques sont EXACTEMENT de la même taille.

Code Block
# Créer le volume phsyical - ceci est basé sur sdb en supposant qu'il s'agit du deuxième lecteur du système lvm pvcreate / dev / sdb # Créer le groupe de volumes lvm vgcreate "vg_drbd_jtelshared" / dev / sdb # Créer le volume logique lvm lvcreate -l + 100% GRATUIT vg_drbd_jtelshared -n lv_drbd_jtelshared

Configurer le pare-feu pour DRBD (Les deux nœuds)

Code Block
# Prepare the firewall ufw allow 7788:7799/tcp

Préparer le point de montage (Les deux nœuds)

Les données doivent être montées dans le répertoire /srv/jtel/shared.

Les commandements suivants s'y préparent :

Code Block
languagebash
mkdir /srv/jtel mkdir /srv/jtel/shared chown -R jtel:jtel /srv/jtel

Installer DRBD (les deux nœuds)

Nous installons maintenant DRBD. Le paquet noyau est inclus dans Debian, mais les outils doivent être installés.

Code Block
languagebash
apt-get -y install drbd-utils

Configurer DRBD (les deux nœuds)

DRBD doit être configuré avec des adresses ip statiques et des noms d'hôtes corrects.

Les adresses IP ci-dessous doivent être modifiées :

Status
colourRouge
titleADDRESSES IP DE PRÉCAUTION
 
Status
colourRouge
titleNOMS D'HÔTES DE PRÉCAUTION

Code Block
# Configure DRBD 
Code Block
# Configure DRBD
cat <<EOFF > /etc/drbd.d/jtelshared.res
 resource jtelshared {
    protocol C;
    meta-disk internal;
    device /dev/drbd0;
    syncer {
        { verify-alg sha1;
 } net { allow-two-primaries; }
 on acd-lb1.jtel.local { net {
        allow-two-primaries;
    }
    on acd-store1.jtel.local {
        disk   /dev/vg_drbd_jtelshared/lv_drbd_jtelshared;
        address 10.1.1.1:7789;
    }
    on acd-store2.jtel.local {
        disk   /dev/vg_drbd_jtelshared/lv_drbd_jtelshared;
        address 10.1.1.2:7789;
    }
}
EOFF
Create Metadata and Start
disk /dev/vg_drbd_jtelshared/lv_drbd_jtelshared; address 10.1.1.1:7789; } on acd-lb2.jtel.local { disk /dev/vg_drbd_jtelshared/lv_drbd_jtelshared; address 10.1.1.2:7789; } } EOFF

Configuration globale (notez que le taux c-max est bon pour un réseau de 1 Go. Vous voudrez peut-être changer cela.

Code Block
cp /etc/drbd.d/global_common.conf /etc/drbd.d/global_common.conf.orig cat << EOFF > /etc/drbd.d/global_common.conf global { usage-count no; udev-always-use-vnr; } common { handlers { } startup { } options { } disk { c-plan-ahead 10; c-fill-target 24M; c-min-rate 10M; c-max-rate 100M; } net { max-buffers 36k; sndbuf-size 1024k; rcvbuf-size 2048k; } } EOFF

Démarrer et activer le module Kernel (les deux nœuds)

Code Block
modprobe drbd systemctl enable drbd systemctl start drbd

Créer des métadonnées et démarrer (les deux nœuds

(Both Nodes

)

Code Block
# Create metadata and start DRBD
 drbdadm create-md jtelshared
 drbdadm up jtelshared
Make ONE Node Primary

Rendre UN Nœud primaire

Code Block
# MakeRendre UN ONEnœud nodeprincipal primary
drbdadm primaryprimaire jtelshared --force

Wait for Sync

Attendre la synchro

DRBD va maintenant se synchroniser. Cela peut prendre un certain tempsDRBD will now sync. This might take some time, however, you do not have to wait, as long as you make sure the primary is active in the PCS cluster below.

Note : with DRBD9 we currently have no options to tune the transfer.You can watch the initial sync with the following commandavec DRBD9, nous n'avons actuellement aucune option pour régler le transfert.

Vous pouvez regarder la synchronisation initiale avec la commande suivante :

Code Block
drbdadm status jtelshared

You will see outbout like thisVous verrez les choses ainsi :

Code Block
jtelshared role:Primary
  disk:UpToDate
  acd-store2 role:Secondary
    replication:SyncSource peer-disk:Inconsistent done:7.19

This means the followingCela signifie ce qui suit :

  • La machine locale est primaire.
  • Le disque de la machine locale est à jour
  • The local machine is primary.
  • The disk in the local machine is up to date.
  • acd-store2 is secondary
  • It is inconsistent and syncing, 7.19% done

You can continue, but usually it is best to wait for it to complete.

Make Second Node Primary 
  • est secondaire
  • Il est incohérent et synchrone, 7,19% Terminé
Warning

Ne continuez pas tant que cette étape n'est pas terminée.

Faire du deuxième nœud un nœud primaire (DEUXIÈME NŒUD SEULEMENT

(SECOND NODE ONLY

)

Code Block
drbdadm primary jtelshared

Create the Filesystem (FIRST NODE ONLY)

Code Block
mkfs.xfs -L data /dev/drbd/by-res/jtelshared/0

Create fstab entry for file system (Both Nodes)

This command adds a line to /etc/fstab

Créer un système de fichiers (premier nœud seulement)

Code Block
mkfs.ext4 /
Code Block
cat << EOFF >> /etc/fstab
/dev/drbd/by-res/jtelshared/0  /srv/jtel/shared         xfs noauto,noatime,nodiratime  0   0
EOFF

Test DRBD

Now, we can test the DRBD setup.

Mount the file system (FIRST Node)

Code Block
mount /srv/jtel/shared

Create a test file and Unmount (FIRST Node) 

Code Block
cat <<EOFF > /srv/jtel/shared/test.txt
test 123
EOFF
umount /srv/jtel/shared

Mount the file system and check test file (SECOND Node)

Créer une entrée fstab pour le système de fichiers (Les deux nœuds)

Cette commande ajoute une ligne à /etc/fstab

Code Block
cat << EOFF >> /etc/fstab /dev/drbd/by-res/jtelshared/0
Code Block
mount /srv/jtel/shared
cat /srv/jtel/shared ext4 noauto,noatime,nodiratime 0 0 EOFF

Tester DRBD

Maintenant, nous pouvons tester la configuration du DRBD.

Monter le système de fichiers (PREMIER nœud)

Code Block
mount/test.txt

# Check contents of file before proceeding  
  
rm /srv/jtel/shared/test.txt
umount /srv/jtel/shared
Warning

Do not proceed unless you can see the contents of the test file.

Comment Mount out in fstab (BOTH nodes) and disable DRBD

Créer un fichier test et le démonter (PREMIER nœud) 

Code Block
cat <<EOFF > /srv/jtel/shared/test.txt test 123 EOFF 
Code Block
sed -i '/jtelshared/s/^/#/' fstab
systemctl disable drbd
umount /srv/jtel/shared

Install PCS Cluster (BOTH NODES)

Info

If you have not installed Pacemaker / Corosync on both LB machines, do this now - see here: Redundancy - Installing PCS Cluster

Install and Configure Samba 

Installation (BOTH NODES)

These commands install the samba server and client and lsof.

Translations Ignore
Code Block
dnf -y install samba samba-client lsof

Configure Samba (BOTH NODES)

The following creates a samba configuration file with a minimum configuration.

Translations Ignore
Code Block
# SMB Conf
cat <<EOFF > /etc/samba/smb.conf
[global]
    workgroup = JTEL
    security = user
    passdb backend = tdbsam
    min protocol = SMB3
    reset on zero vc = yes
[shared]
    comment = jtel ACD Shared Directory
    public = no
    read only = no
    writable = yes
    locking = yes
    path = /srv/jtel/shared
    create mask = 0644
    directory mask = 0755
    force user = jtel
    force group = jtel
    acl allow execute always = True
EOFF

Setup SeLinux and the Firewall (BOTH NODES)

The following command sets up selinux for the smb service and opens the necessary ports in the firewall:

Translations Ignore
Code Block
setsebool -P samba_enable_home_dirs=on samba_export_all_rw=on use_samba_home_dirs=on use_nfs_home_dirs=on
firewall-cmd --zone=public --add-port=445/tcp --add-port=139/tcp --add-port=138/udp --add-port=137/udp --permanent
firewall-cmd --reload

Monter le système de fichiers et vérifier le fichier test (SECOND Node)

Code Block
mount /srv/jtel/shared cat /srv/jtel/shared/test.txt # Check contents of file before proceeding      rm /srv/jtel/shared/test.txt umount /srv/jtel/shared


Warning

Ne procédez pas si vous ne pouvez pas voir le contenu du fichier test.

Commentaire Monter dans fstab (les DEUX nœuds) et désactiver DRBD

Code Block
sed -i '/jtelshared/s/^/#/' /etc/fstab systemctl disable drbd umount /srv/jtel/shared

Installer le PCS Cluster (LES DEUX NODES)

Info

Si vous n'avez pas installé Pacemaker / Corosync sur les deux machines LB, faites-le maintenant - voir ici: Redondance - Installation du cluster PCS

Installer et configurer Samba 

Installation (les deux nœuds)

Ces commandes installent le serveur et le client samba et lsof.

Translations Ignore


Code Block
apt-get -y install samba samba-client lsof


Désactivez ensuite smbd (cela sera géré par le cluster pcs):

Translations Ignore


Code Block
systemctl stop smbd systemctl disable smbd


Configurer Samba (les deux nœuds)

Ce qui suit crée un fichier de configuration samba avec une configuration minimale.

Translations Ignore


Code Block
# SMB Conf cat <<EOFF > /etc/samba/smb.conf [global] workgroup = JTEL security = user passdb backend = tdbsam min protocol = SMB2 reset on zero vc = yes [shared] comment = jtel ACD Shared Directory public = no read only = no writable = yes locking = yes path = /srv/jtel/shared create mask = 0644 directory mask = 0755 force user = jtel force group = jtel acl allow execute always = True EOFF


Configurer le pare-feu (LES DEUX NOEUDS)

La commande suivante configure le pare-feu:


Translations Ignore


Code Block
ufw allow 445/tcp ufw allow 137/udp ufw allow 138/udp ufw allow 139/udp


Liez /home/jtel/shared (LES DEUX NODES)

Liez le dossier /home/jtel/shared

Link /home/jtel/shared (BOTH NODES)

Link the /home/jtel/shared folder

Translations Ignore


Code Block
ln -s /srv/jtel/shared /home/jtel/shared

Setup Access to the Samba Server

jtel User Access (BOTH NODES)


Configuration de l'accès au serveur Samba

accès utilisateur jtel (LES DEUX NODES)

La commande suivante crée les identifiants smb pour l'utilisateur jtelThe following command creates the smb credentials for the jtel user.

Status
colourRed
titleCaution PasswordMot de passe de précaution

Translations Ignore


Code Block
printf '<password>\n<password>\n' | smbpasswd -a -s jtel
Further User Access
 


Accès supplémentaire pour les utilisateurs (LES DEUX

(BOTH

NODES)

If necessary, add further users to samba - replacing password with the actual password for the user. Here, for example, the windows administrator userSi nécessaire, ajoutez d'autres utilisateurs à samba - en remplaçant password par le mot de passe réel de l'utilisateur. Ici, par exemple, l'utilisateur administrateur de Windows :

Status
colourRed
titleCaution PasswordMot de passe de précaution

Translations Ignore


Code Block
useradd -m Administrator
 printf '<password>\n<password>\n' | smbpasswd -a -s Administrator

Configure Cluster Resources

Now all resources will be configured in the pacemaker cluster.

Setup virtual IP (One Node Only!)

 


Configurer les ressources du cluster

Désormais, toutes les ressources seront configurées dans le cluster pacemaker.

Configurer l'IP virtuel (UN seul nœud !)

Modifiez les éléments suivants pour définir l'IP virtuel qui doit être partagé entre les nœudsChange the following to set the virtual IP which should be shared between the nodes.

Status
colourRed
titleAdresse IP de Caution IP Address

Code Block
JT_VIP=10.1.1.100

Configure PCS Resources for DRBD Mount, DRBD Primary / Secondary, Samba and Virtual IP Address (One Node Only!)

Configurer les ressources PCS pour le montage de la DRBD, la DRBD primaire / secondaire, la Samba et l'adresse IP virtuelle (Un seul nœud !)

Configurez les ressources PCS à l'aide des commandes suivantes Configure the PCS resources with the following commands :

Code Block
# Configure using a file jtel_cluster_config
 cd
 pcs cluster cib jtel_cluster_config
 # DRBD Primary Secondary
 pcs -f jtel_cluster_config resource create DRBDClusterMount ocf:linbit:drbd drbd_resource=jtelshared op monitor interval=60s
 pcs -f jtel_cluster_config resource promotable DRBDClusterMount promoted-max=1 promoted-node-max=1 clone-max=2 clone-node-max=1 notify=true
 # DRBD File System Mount
 pcs -f jtel_cluster_config resource create DRBDClusterFilesystem ocf:heartbeat:Filesystem device="/dev/drbd/by-res/jtelshared/0" directory="/srv/jtel/shared" fstype="xfsext4"
 # Colocation of File System Mount with Primary DRBD instance
 pcs -f jtel_cluster_config constraint colocation add DRBDClusterFilesystem with DRBDClusterMount-clone INFINITY with-rsc-role=Master
 # Promote first, then start filesystem
 pcs -f jtel_cluster_config constraint order promote DRBDClusterMount-clone then start DRBDClusterFilesystem
 # Resource for Samba
 pcs -f jtel_cluster_config resource create Samba systemd:smbsmbd op monitor interval=30s 
# Resource for virtual IP
 pcs -f jtel_cluster_config resource create ClusterIP ocf:heartbeat:IPaddr2 ip=${JT_VIP} cidr_netmask=32 op monitor interval=30s
 # Samba must be with active DRBD filesystem
 pcs -f jtel_cluster_config constraint colocation add Samba with DRBDClusterFilesystem INFINITY
 # Cluster IP must be with Samba
 pcs -f jtel_cluster_config constraint colocation add ClusterIP with Samba INFINITY
 # Start DRBD File system then start Samba
 pcs -f jtel_cluster_config constraint order DRBDClusterFilesystem then Samba
 # Start Samba then start Cluster IP
 pcs -f jtel_cluster_config constraint order Samba then ClusterIP

Check the Vérifiez la configuration :

Code Block
# Check the config file
Vérifiez le fichier de configuration pcs -f jtel_cluster_config config

Push the configuration to the Poussez la configuration vers le cluster :

Code Block
# PushPoussez thela configconfiguration tosur thele cluster
pcs de PCs du cluster cib-push jtel_cluster_config --configconfig

Assurez la propriété du répertoire jtel:

Code Block
chown -R jtel:jtel /srv/jtel

Tests

Test pcs status

Tester le statut du PC

Tout d'abord, nous testons le statut du cluster First of all, we test the cluster status :

Code Block
pcs status

You should see output similar to thisVous devriez voir un résultat similaire à celui-ci :


Code Block
ClusterNom du namecluster: jtel_cluster
Cluster Summary:
  * Stack Récapitulatif du cluster: * Pile: corosync
  * CurrentDC DCactuel: acd-lb1 (version 2.0.3-5.el8_2.1-4b1f869f0f) - partition withavec quorum
 * Dernière *mise Lastà updatedjour: Sam Sat3 Oct  3 12:59:34 2020
  * LastDernier changechangement: Sam Sat3 Oct  3 12:31:22 2020 by root via cibadmin on acd-lb2
  * 2 nodes configured
  * 5 resource instances configured

 Node List:
  * Online: [ acd-lb1 acd-lb2 ]

 Full List of Resources:
  * Clone Set: DRBDClusterMount-clone [DRBDClusterMount] (promotable):
    * Masters: [ acd-lb1 ]
    * Stopped: [ acd-lb2 ]
  * DRBDClusterFilesystem       (ocf::heartbeat:Filesystem):    Started acd-lb1
  * Samba       (systemd:smb):  Started acd-lb1
  * ClusterIP   (ocf::heartbeat:IPaddr2):      ): Started acd-lb1

 Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

Make sure all of the resources are started and both nodes are online.

Test File Mount

Assurez-vous que toutes les ressources sont lancées et que les deux nœuds sont en ligne.

Tester la monture du fichier

You should now be able to access \\acd-store\shared from the windows machines for example.  des machines à fenêtres par exemple. 

Si vous voulez tester à partir de linux, vous devrez monter le MAGASIN comme décrit ici If you want to test from linux, you will need to mount STORE as described hereMounting STORE - All Linux except for STORE (CentOS8/Win2019)

Test Failover

and

et Failback

You can test failover and failback with any of the following commands:

Standby and Unstandby

Vous pouvez tester le failover et le failback avec l'une des commandes suivantes :

En veille (Standby) et hors veille (Unstandby)

Attention: il a été observé que les ressources en veille et en veille ne basculent pas correctement les ressources. 

Utiliser avec précaution.

Code Block
pcs node standby acd-lb1

 # TEST

 pcs node unstandby acd-lb1

 # TEST

 pcs node standby acd-lb1

lb2 # TEST

 pcs node unstandby acd-lb1

lb2 # TEST
Stop Cluster Node
 

Arrêter le nœud du cluster

Code Block
pcs cluster stop acd-lb1

 # TEST

 pcs cluster start acd-lb1

 # TEST

pcs cluster stop acd-lb2

# TEST

pcs cluster startstop acd-lb2

# TEST

Reboot

Rebooting is also a good way to test.

Power Off

This is the best way to test, but be aware, you may cause split brain on DRBD and need to repair it.

Sv translation
languagede

Status
colourRed
titleTHIS PAGE IS ONLY AVAILABLE IN ENGLISH

This page is only available in English


 # TEST pcs cluster start acd-lb2 # TEST 

Redémarrer

Le redémarrage est également un bon moyen de tester.

Déconnecté

C'est la meilleure façon de faire le test, mais sachez que vous pouvez provoquer une scission du cerveau sur la DRBD et qu'il faut la réparer.

Sv translation
languagefr
Status
colourRed
title