Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed translated content for 'fr'
Sv translation
languageen

Erstellen des Stores mit LVM

Die meisten Linux / CentOS Installationen von uns arbeiten mit LVM. Diese Anleitung beschreibt, wie die Rolle STORE auf ein System mittels LVM installiert werden kann.

Schritt 1 - Feststellen der aktuellen config

Anzeige der disks
Code Block

Creating the Store with LVM

Most of our Linux / CentOS installations work with LVM. This guide describes how to install the STORE role on a system using LVM.

Step 1 - Determining the current config

Translations Ignore


Code Block
languagebash
title
Display of discs
# 
Freier
Show 
Platz
free 
anzeigen
space
df -h
# 
Partitionen
Show 
anzeigen
partitions
fdisk -l
# 
Festplatten
Show 
anzeigen
partitions
ls /dev/sd*
# 
Physische
If 
Volumes
the 
anzeigen
disk 
die
cannot 
durch
yet 
LVM
be 
verwaltet werden lvm pvs # Logische Volumes anzeigen die durch LVM verwaltet werden
seen, re-scan the SCSI bus
echo "- - -" > /sys/class/scsi_host/host0/scan
# View physical volumes managed by LVM
lvm pvs
# Display logical volumes managed by LVM
lvm lvs
# 
Logische
Display 
Volume
logical 
Gruppen
volume 
anzeigen
groups 
die
managed 
durch
by LVM
verwaltet werden

lvm vgs
# 
Wo
Where 
ist
is 
was
what 
gemounted
mounted
mount

Die Informationen oben werden nun gebraucht. Die Konfiguration sollte geprüft werden, nicht das bereits ein LVM für das Storage vorgesehen ist.

Schritt 2 - Anlegen einer neuen Partition

Hier ist es erforderlich, dass man weiß, wo der zusätzlicher Platz zu finden ist. Es gibt 2 Varianten - entweder eine neue Platte, oder eine erweiterte Platte. 

In beiden Fällen, wird eine neue Partition angelegt. Hier in diesen Beispiel, wurde eine neue Platte genutzt, die auf /dev/sdb zu finden ist.

...

Partitionierung mit



The information above is now needed. The configuration should be checked, maybe an LVM is already planned for the storage.

Step 2 - Create a new partition

Here it is necessary to know where to find the additional space. There are 2 variants - either a new plate, or an extended plate. 

In both cases, a new partition is created. Here in this example, a new disk was used, which can be found on /dev/sdb

Adjust the commands below and the partition number (for an existing disk, the partition is then no longer necessarily 1) accordingly.

Anzeige von Discs

Translations Ignore


Code Block
languagebash
title
Partitioning with fdisk
fdisk /dev/sdb
 
# --> 
Bearbeiten
Edit 
der
the 
Partitionen
partitions 
auf
on /dev/sda
 
n
# --> 
Neue
Create 
Partition
new 
anlegen
partition
p
# --> 
Neue
New primary partition
1
# --> Create 
Neue
new 
Partition
partition 1 
anlegen
(view 
(Ausgabe
output 
bei
at fdisk -1 
oben betrachten
above)
Enter
# --> 
Bestätigung
Confirmation 
dass
that 
der
the 
erste
first 
verfügbarer
available 
Zylinder
cylinder 
verwendet
should 
werden
be 
soll
used
Enter
# --> 
Bestätigung
Confirmation 
dass
that 
der
the 
letzte
last 
verfügbarer
available 
Zylinder
cylinder is 
verwendet
to 
werden
be 
soll
used (
ergibt
gives 
in
the 
Summe
maximum 
die
size 
maximale
in 
Größe
total)
t
# --> 
Typ
Change 
der
partition 
Partition ändern
type
8e
# --> Linux LVM
w
# --> 
Wenn
When OK, 
schreiben
write
 
reboot now

...



Step 3 -

...

Inclusion in LVM - Create Device

...

Device für erzeugen

Translations Ignore


Code Block
languagebash
title
Create device for LVM
# Here 
Hier
is 
die
the 
Ausgabe
previous 
vorher
edition 
von
of /dev/sd* --> 
das
this 
hier
is 
ist
the 
die
new 
neue Platte
record (
die
the 
1.
1st 
Partition
partition 
auf
on /dev/sdb, 
sprich die zweite Festplatte, neu angelegte Partition
i.e. the second hard disk, newly created partition)
lvm pvcreate /dev/sdb1

...



Step 4 - Create Volume Group

...

anlegen

Translations Ignore


Code Block
languagebash
titleCreate LVM
lvm vgcreate "vg_jtelshared" /dev/sdb1

...



Step 5 - Create Logical Volume

...

anlegen

Translations Ignore


Code Block
languagebash
titleCreate LVM
lvm lvcreate -l +100%FREE vg_jtelshared -n lv_jtelshared

...



Step 6 - Create File System

...

File System erzeugen

Translations Ignore


Code Block
languagebash
title
Create file system
mkfs.xfs -L data /dev/vg_jtelshared/lv_jtelshared

...




Step 7 - Prepare Mount Point

...

Mount vorbereiten

Translations Ignore


Code Block
languagebash
title
Prepare mount point
mkdir /srv/jtel
mkdir /srv/jtel/shared 

Schritt 8 - Mount Point in fstab festlegen


chown -R jtel:jtel /srv/jtel/shared



Step 8 - Set and mount the mount point in fstab

fstab entry:

Translations Ignore

...


Code Block
languagebash
titlevi /etc/fstab
vi /etc/fstab
...
(
folgende
add the 
Zeile
following 
hinzufügen
line)
 
/dev/mapper/vg_jtelshared-lv_jtelshared /srv/jtel/shared        xfs     defaults 
0   
0 0

...

Endergebnis prüfen
0



And mount:

Translations Ignore


Code Block
languagebash
titlemount
mount /srv/jtel/shared




Step 9 - Check interim result

Translations Ignore


Code Block
languagebash
title
Check final result
df -h

...



There should be an entry for /srv/jtel/shared

...

with corresponding free space

 

Create DRBD Partitions on disk (Both Nodes)

The commands below assume that /dev/sdb will be used for the DRBD partition.

Code Block
device=/dev/sdb
dd if=/dev/zero of=${device} obs=512 count=100
dd if=/dev/zero of=${device} obs=512 count=100 seek=$(( $(blockdev --getsz ${device}) -100 ))
parted ${device} "mklabel gpt"
parted ${device} "mkpart primary 0% 100%"

Verify that the partition is created:

Install Samba and lsof

Translations Ignore


Code Block
titleInstall SAMBA
yum -y install samba samba-client lsof



Configure Samba

Translations Ignore


Code Block
titleConfigure SAMBA
cat <<EOFF > /etc/samba/smb.conf
[global]
        workgroup = SAMBA
        security = user
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
        min protocol = NT1
        ntlm auth = yes

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
Code Block
fdisk -l /dev/sdb   -->   WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion. Disk /dev/sdb: 274.9 GB, 274877906944 bytes, 536870912 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: gpt Disk identifier: E7FF3D92-84BB-44E1-B0B0-26150DB80639 # Start End Size Type
        browseable = 
Name
No
 
1
       read only 
2048
= No
   
536868863
    
256G
 inherit 
Microsoft
acls 
basic primary

Install DRBD Repos (Both Nodes)

Code Block
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

Install DRBD Modules (Both Nodes)

Code Block
yum -y install drbd84-utils kmod-drbd84

Configure Firewall (Both Nodes) 

Code Block
firewall-cmd --zone=public --add-port=7788-7799/tcp --permanent
firewall-cmd --reload

Configure DRBD (Both Nodes)

NOTE: The following commands requires the hostname of both machines and the IP Address. These are obtained as follows:

Code Block
ip addr
hostname

Create a DRBD config file for jtelshared on /dev/sdb

Code Block
title/etc/drbd.d/jtelshared.res
cat <<EOFF > /etc/drbd.d/jtelshared.res resource jtelshared { protocol C; meta-disk internal; device /dev/drbd1; syncer { verify-alg sha1; } net {
= Yes

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = root
        create mask = 0664
        
allow-two-primaries; }
directory mask = 0775

[shared]
    
on
comment 
acd-store1 {
= jtel ACD Shared Directory
    read 
disk
only 
/dev/sdb1;
= no
    public = 
yes
 
address
 
10.4.8.71:7789;
  writable = 
}
yes
    
on
locking 
acd-store2
= 
{
yes
    path 
disk /dev/sdb1;
= /srv/jtel/shared
    guest ok = yes
  
address
 
10.4.8.171:7789; }
 create mask = 0644
    
startup
directory 
{
mask = 0755
    force user 
become-primary-on both;
= jtel
    force 
} } EOFF

Create Metadata and start (Both Nodes)

Code Block
drbdadm create-md jtelshared
drbdadm up jtelshared

Make one node primary (First Node)

Code Block
drbdadm primary jtelshared --force

Tune the transfer (Second Node)

Code Block
drbdadm disk-options --c-plan-ahead=0 --resync-rate=110M jtelshared

Create filesystem (Primary Node)

Code Block
mkfs.xfs -L data /dev/drbd1

Create fstab entry for file system (both nodes)

Add the following line to /etc/fstab

Code Block
/dev/drbd/by-res/jtelshared/0  /srv/jtel/shared         xfs noauto,noatime,nodiratime  0   0

Mount the file system (primary node)

Add the following line to /etc/fstab

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

Wait for initial sync to complete

Code Block
cat /proc/drbd
 
-->
 
# When not yet done:
 
version: 8.4.10-1 (api:1/proto:86-101)
GIT-hash: a4d5de01fffd7e4cde48a080e2c686f9e8cebf4c build by mockbuild@, 2017-09-15 14:23:22

 1: cs:SyncTarget ro:Secondary/Primary ds:Inconsistent/UpToDate C r-----
    ns:0 nr:3955712 dw:3950592 dr:0 al:8 bm:0 lo:5 pe:0 ua:5 ap:0 ep:1 wo:f oos:264474588
        [>....................] sync'ed:  1.5% (258272/262132)M
        finish: 2:08:08 speed: 34,388 (25,652) want: 112,640 K/sec


-->

# When done:

version: 8.4.10-1 (api:1/proto:86-101)
GIT-hash: a4d5de01fffd7e4cde48a080e2c686f9e8cebf4c build by mockbuild@, 2017-09-15 14:23:22

 1: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
    ns:0 nr:15626582 dw:284051762 dr:0 al:8 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0

Untune the transfer (Second Node)

Code Block
drbdadm adjust jtelshared

Make second node primary and mount the file system (Secondary node)

Add the following line to /etc/fstab

Code Block
mkdir /srv/jtel
mkdir /srv/jtel/shared
chown -R jtel:jtel /srv/jtel
drbdadm primary jtelshared

Install Samba and lsof (Both Nodes)

Code Block
titleInstall SAMBA
yum -y install samba samba-client lsof

Configure Samba (Both Nodes)

Code Block
titleConfigure SAMBA
cat <<EOFF > /etc/samba/smb.conf
[global]
        workgroup = SAMBA
        security = user
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
        min protocol = NT1
        ntlm auth = yes

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = root
        create mask = 0664
        directory mask = 0775

[shared]
    comment = jtel ACD Shared Directory
    read only = no
    public = yes
    writable = yes
    locking = yes
    path = /srv/jtel/shared
    guest ok = yes
    create mask = 0644
    directory mask = 0755
    force user = jtel
    force group = jtel
    acl allow execute always = True

EOFF
sed -i -e "s/MYGROUP/WORKGROUP/g" /etc/samba/smb.conf

Setup SeLinux, jtel User access and Firewall for Samba (Both Nodes)

Code Block
titleSeLinux, jtel User, Firewall
setsebool -P samba_enable_home_dirs=on samba_export_all_rw=on use_samba_home_dirs=on use_nfs_home_dirs=on
printf 'fireball\nfireball\n' | smbpasswd -a -s jtel
firewall-cmd --zone=public --add-port=445/tcp --add-port=139/tcp --add-port=138/udp --add-port=137/udp --permanent
firewall-cmd --reload

If necessary, add further users to samba:

Code Block
titleMore SAMBA users
useradd -m Administrator
printf 'F1r3B²11\nF1r3B²11\n' | smbpasswd -a -s Administrator

Test SAMBA (Both Nodes)

This test should be performed on the node which currently has /srv/jtel/shared mounted:

Code Block
titleTest SAMBA
mount /srv/jtel/shared
service nmb start
service smb start

 
# Now check access to the SMB share via (for example) one of the windows machines.
 
service smb stop
service nmb stop
umount /srv/jtel/shared
 
# do same again on other node

Unmount (Both Nodes), disable SAMBA

Code Block
titleUnmount
service smb stop
service nmb stop
umount /srv/jtel/shared
systemctl disable smb

Install PCS Services (Both Nodes)

See Redundancy - Installing PCS Cluster.

Setup virtual IP (One Node Only!)

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

Code Block
titleSet virtual IP
KE_VIP=10.4.8.22

Configure PCS Resources (One Node Only!)

Configure the PCS resources with the following commands:

Code Block
titleConfigure PCS Resources
pcs resource create ClusterDataJTELSharedMount ocf:heartbeat:Filesystem device="/dev/drbd/by-res/jtelshared/0" directory="/srv/jtel/shared" fstype="xfs" --group=jtel_portal_group
pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=${KE_VIP} cidr_netmask=32 op monitor interval=30s --group=jtel_portal_group
pcs resource create samba systemd:smb op monitor interval=30s --group=jtel_portal_group
pcs constraint order start ClusterDataJTELSharedMount then ClusterIP
pcs constraint order start ClusterIP then samba

Test

Test as follows:

Code Block
titleTest pcs status
pcs status
 
--> shows the status of the newly created resources on both nodes, one node should be active. 
 
Cluster name: portal
Stack: corosync
Current DC: uk-acd-store2 (version 1.1.16-12.el7_4.8-94ff4df) - partition with quorum
Last updated: Mon Mar 19 15:40:24 2018
Last change: Mon Mar 19 15:40:16 2018 by root via cibadmin on uk-acd-store1

2 nodes configured
3 resources configured

Online: [ uk-acd-store1 uk-acd-store2 ]

Full list of resources:

 Resource Group: jtel_portal_group
     ClusterDataJTELSharedMount (ocf::heartbeat:Filesystem):    Started uk-acd-store1
     ClusterIP  (ocf::heartbeat:IPaddr2):       Started uk-acd-store1
     samba      (systemd:smb):  Started uk-acd-store1

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

Test the file mount:

Code Block
titleTest file mount
# From the windows machines:
 
dir \\uk-acd-store\shared

Test manual failover:

Code Block
titleTest file mount
# Failover to node 2
pcs cluster standby uk-acd-store1 
 
# ... (wait)
 
pcs status
 
# Then test the availability of the files from the windows machines.
# Create a new file before failing back (to make sure DRBD working ok).
 
# Fail back to node 1
pcs cluster unstandby uk-acd-store1
pcs cluster standby uk-acd-store2
 
# ... (wait)

pcs status

# Then test the availability of the files from the windows machines.
# Check that the new file created above is available.
 
# Unstandby node 2

pcs cluster unstandby uk-acd-store2
group = jtel
    acl allow execute always = True

EOFF
sed -i -e "s/MYGROUP/WORKGROUP/g" /etc/samba/smb.conf



Setup SeLinux, jtel User access and Firewall for Samba

Replace <password> with the password for the jtel user:

Translations Ignore


Code Block
titleSeLinux, jtel User, Firewall
setsebool -P samba_enable_home_dirs=on samba_export_all_rw=on use_samba_home_dirs=on use_nfs_home_dirs=on
printf '<password>\n<password>\n' | smbpasswd -a -s jtel
firewall-cmd --zone=public --add-port=445/tcp --add-port=139/tcp --add-port=138/udp --add-port=137/udp --permanent
firewall-cmd --reload



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

Translations Ignore


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



Test SAMBA

Translations Ignore


Code Block
titleStart SAMBA
systemctl enable nmb
systemctl enable smb
systemctl start nmb
systemctl start smb



Manually link /home/jtel/shared

Translations Ignore


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



Test the file mount

Translations Ignore


Code Block
titleTest file mount
# From the windows machines:
 
dir \\acd-store\shared




Sv translation
languagede

Erstellen des Stores mit LVM

Die meisten Linux / CentOS Installationen von uns arbeiten mit LVM. Diese Anleitung beschreibt, wie die Rolle STORE auf ein System mittels LVM installiert werden kann.

Schritt 1 - Feststellen der aktuellen config

Translations Ignore


Code Block
languagebash
titleDisplay of discs
# Show free space
df -h
# Partitionen anzeigen
fdisk -l
# Show partitions
ls /dev/sd*
# If the disk cannot yet be seen, re-scan the SCSI bus
echo "- - -" > /sys/class/scsi_host/host0/scan
# View physical volumes managed by LVM
lvm pvs
# Display logical volumes managed by LVM
lvm lvs
# Display logical volume groups managed by LVM
lvm vgs
# Where is what mounted
mount



Die Informationen oben werden nun gebraucht. Die Konfiguration sollte geprüft werden, nicht das bereits ein LVM für das Storage vorgesehen ist.

Schritt 2 - Anlegen einer neuen Partition

Hier ist es erforderlich, dass man weiß, wo der zusätzlicher Platz zu finden ist. Es gibt 2 Varianten - entweder eine neue Platte, oder eine erweiterte Platte. 

In beiden Fällen, wird eine neue Partition angelegt. Hier in diesen Beispiel, wurde eine neue Platte genutzt, die auf /dev/sdb zu finden ist.

Die Befehle unten sowie die Partitionsnummer (bei einer vorhandenen Platte ist die Partition dann nicht mehr zwingend 1), entsprechend anpassen.

Display of discs

Translations Ignore


Code Block
languagebash
titlePartitioning with fdisk
fdisk /dev/sdb
 
# --> Edit the partitions on /dev/sda
 
n
# --> Create new partition
p
# --> New primary partition
1
# --> Create new partition 1 (view output at fdisk -1 above)
Enter
# --> Confirmation that the first available cylinder should be used
Enter
# --> Confirmation that the last available cylinder is to be used (gives the maximum size in total)
t
# --> Change partition type
8e
# --> Linux LVM
w
# --> When OK, write
 
reboot now



Schritt 3 - Hereinnahme in LVM - Device Erzeugen

Translations Ignore


Code Block
languagebash
titleCreate device for LVM
# Here is the previous edition of /dev/sd* --> this is the new record (the 1st partition on /dev/sdb, i.e. the second hard disk, newly created partition)
lvm pvcreate /dev/sdb1



Schritt 4 - Volume Group anlegen

Translations Ignore


Code Block
languagebash
titleCreate LVM
lvm vgcreate "vg_jtelshared" /dev/sdb1



Schritt 5 - Logical Volume anlegen

Translations Ignore


Code Block
languagebash
titleCreate LVM
lvm lvcreate -l +100%FREE vg_jtelshared -n lv_jtelshared



Schritt 6 - File System erzeugen

Translations Ignore


Code Block
languagebash
titleCreate file system
mkfs.xfs -L data /dev/vg_jtelshared/lv_jtelshared




Schritt 7 - Mount Point vorbereiten

Translations Ignore


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



Schritt 8 - Mount Point in fstab festlegen und mounten

fstab Eintrag:

Translations Ignore


Code Block
languagebash
titlevi /etc/fstab
vi /etc/fstab
...
(add the following line)
 
/dev/mapper/vg_jtelshared-lv_jtelshared /srv/jtel/shared        xfs     defaults 0   0



Und mounten:

Translations Ignore


Code Block
languagebash
titlemount
mount /srv/jtel/shared




Schritt 9 - Zwischenergebnis prüfen

Translations Ignore


Code Block
languagebash
titleCheck final result
df -h



Es sollte ein Eintrag für /srv/jtel/shared existieren mit entsprechend freier Platz. 

Install Samba and lsof

Translations Ignore


Code Block
titleInstall SAMBA
yum -y install samba samba-client lsof



Configure Samba

Translations Ignore


Code Block
titleConfigure SAMBA
cat <<EOFF > /etc/samba/smb.conf
[global]
        workgroup = SAMBA
        security = user
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
        min protocol = NT1
        ntlm auth = yes

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = root
        create mask = 0664
        directory mask = 0775

[shared]
    comment = jtel ACD Shared Directory
    read only = no
    public = yes
    writable = yes
    locking = yes
    path = /srv/jtel/shared
    guest ok = yes
    create mask = 0644
    directory mask = 0755
    force user = jtel
    force group = jtel
    acl allow execute always = True

EOFF
sed -i -e "s/MYGROUP/WORKGROUP/g" /etc/samba/smb.conf



Setup SeLinux, jtel User access and Firewall for Samba

Replace <password> with the password for the jtel user:

Translations Ignore


Code Block
titleSeLinux, jtel User, Firewall
setsebool -P samba_enable_home_dirs=on samba_export_all_rw=on use_samba_home_dirs=on use_nfs_home_dirs=on
printf '<password>\n<password>\n' | smbpasswd -a -s jtel
firewall-cmd --zone=public --add-port=445/tcp --add-port=139/tcp --add-port=138/udp --add-port=137/udp --permanent
firewall-cmd --reload



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

Translations Ignore


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



Test SAMBA

Translations Ignore


Code Block
titleStart SAMBA
systemctl enable nmb
systemctl enable smb
systemctl start nmb
systemctl start smb



Manually link /home/jtel/shared

Translations Ignore

...


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



Test the file mount

Translations Ignore


Code Block
titleTest file mount
# From the windows machines:
 
dir \\acd-store\shared