Pcsd-nfs: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „*pcs resource create nfsshare Filesystem device=/dev/rbd0 directory=/mnt/misc fstype=ext4 --group nfsgroup *pcs resource create nfs-daemon nfsserver nfs_shared…“)
 
Zeile 1: Zeile 1:
 +
=Vorraussetzungen=
 +
*Eingerichteter HA-Cluster
 +
 +
=DRBD erstellen=
 +
*apt-get install drbd8-utils
 +
 +
==Die Partionen mit LVM erstellen==
 +
*pvcreate /dev/sdb
 +
*vgcreate ubuntu-francis /dev/sdb
 +
*lvcreate --name drbd-demo --size 1G ubuntu-francis
 +
(Für andere Seite wiederholen)
 +
 +
==DRBD konfigurieren==
 +
'''Die folgenden Anweißungen müssen auf beiden Nodes ausgeführt werden'''
 +
*vi /etc/drbd.d/wwwdata.res
 +
<source lang=bash>
 +
resource wwwdata {
 +
protocol C;
 +
meta-disk internal;
 +
device /dev/drbd1;
 +
syncer {
 +
  verify-alg sha1;
 +
}
 +
net {
 +
  allow-two-primaries;
 +
}
 +
on francis {
 +
  disk  /dev/ubuntu-francis/drbd-demo;
 +
  address  192.168.50.51:7789;
 +
}
 +
on claire {
 +
  disk  /dev/ubuntu-claire/drbd-demo;
 +
  address  192.168.50.52:7789;
 +
}
 +
}
 +
</source>
 +
===drbd-laufwerk erstellen===
 +
*drbdadm create-md wwwdata
 +
<source lang=bash>
 +
initializing activity log
 +
NOT initializing bitmap
 +
Writing meta data...
 +
New drbd meta data block successfully created.
 +
</source>
 +
===drbd-Laufwerk hochfahren===
 +
*modprobe drbd
 +
*drbdadm up wwwdata
 +
 +
===Diesen Rechner als primär verwenden===
 +
 +
'''Die folgenden Befehle müssen nur auf der Node ausgeführt werden, die später die primäre Node sein soll'''
 +
 +
*drbdadm primary --force wwwdata
 +
 +
===Dateisystem erstellen===
 +
*mkfs.xfs /dev/drbd1
 +
<source lang=bash>
 +
meta-data=/dev/drbd1            isize=512    agcount=4, agsize=131066 blks
 +
        =                      sectsz=512  attr=2, projid32bit=1
 +
        =                      crc=1        finobt=1, sparse=0
 +
data    =                      bsize=4096  blocks=524263, imaxpct=25
 +
        =                      sunit=0      swidth=0 blks
 +
naming  =version 2              bsize=4096  ascii-ci=0 ftype=1
 +
log      =Internes Protokoll    bsize=4096  blocks=2560, version=2
 +
        =                      sectsz=512  sunit=0 blks, lazy-count=1
 +
realtime =keine                  extsz=4096  blocks=0, rtextents=0
 +
</source>
 +
 +
==Resourcen anlegen==
 +
===in der Datei drbd_cfg zwischenspeichern===
 +
*pcs cluster cib drbd_cfg
 +
===Die Resource für das Master/Slave-Setup erstellen===
 +
*pcs -f drbd_cfg resource create WebData ocf:linbit:drbd \
 +
*>drbd_resource=wwwdata op monitor interval=60s
 +
*pcs -f drbd_cfg resource master WebDataClone WebData \
 +
*>master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 \
 +
*>notify=true
 +
*pcs -f drbd_cfg resource show
 +
<source lang=bash>
 +
VirtualIP (ocf::heartbeat:IPaddr2): Started francis
 +
WebSite (ocf::heartbeat:apache): Started francis
 +
Master/Slave Set: WebDataClone [WebData]
 +
    Stopped: [ claire francis ]
 +
</source>
 +
===Die Konfiguration aus der Datei ins cib übernehmen===
 +
*pcs cluster cib-push drbd_cfg
 +
<source lang=bash>
 +
CIB updated
 +
</source>
 +
*pcs status
 +
<source lang=bash>
 +
Cluster name: underwood
 +
Last updated: Wed Oct 26 16:07:39 2016 Last change: Wed Oct 26 16:07:29 2016 by root via cibadmin on francis
 +
Stack: corosync
 +
Current DC: claire (version 1.1.14-70404b0) - partition with quorum
 +
2 nodes and 4 resources configured
 +
 +
Online: [ claire francis ]
 +
 +
Full list of resources:
 +
 +
VirtualIP (ocf::heartbeat:IPaddr2): Started francis
 +
WebSite (ocf::heartbeat:apache): Started francis
 +
Master/Slave Set: WebDataClone [WebData]
 +
    Masters: [ francis ]
 +
    Slaves: [ claire ]
 +
 +
PCSD Status:
 +
  francis: Online
 +
  claire: Online
 +
 +
Daemon Status:
 +
  corosync: active/enabled
 +
  pacemaker: active/enabled
 +
  pcsd: active/enabled
 +
</source>
 +
 +
 +
 
*pcs resource create nfsshare Filesystem device=/dev/rbd0 directory=/mnt/misc fstype=ext4 --group nfsgroup
 
*pcs resource create nfsshare Filesystem device=/dev/rbd0 directory=/mnt/misc fstype=ext4 --group nfsgroup
 
*pcs resource create nfs-daemon nfsserver nfs_shared_infodir=/mnt/misc/nfsinfo nfs_no_notify=true  --group nfsgroup
 
*pcs resource create nfs-daemon nfsserver nfs_shared_infodir=/mnt/misc/nfsinfo nfs_no_notify=true  --group nfsgroup
 
*pcs resource create nfs-root exportfs clientspec=10.0.0.0/255.0.0.0 options=rw,sync,no_root_squash directory=/mnt/misc/data fsid=0 --group nfsgroup
 
*pcs resource create nfs-root exportfs clientspec=10.0.0.0/255.0.0.0 options=rw,sync,no_root_squash directory=/mnt/misc/data fsid=0 --group nfsgroup
 
*pcs resource create nfs_ip IPaddr2 ip=10.82.100.100 cidr_netmask=16 --group nfsgroup
 
*pcs resource create nfs_ip IPaddr2 ip=10.82.100.100 cidr_netmask=16 --group nfsgroup

Version vom 21. September 2017, 07:30 Uhr

Vorraussetzungen

  • Eingerichteter HA-Cluster

DRBD erstellen

  • apt-get install drbd8-utils

Die Partionen mit LVM erstellen

  • pvcreate /dev/sdb
  • vgcreate ubuntu-francis /dev/sdb
  • lvcreate --name drbd-demo --size 1G ubuntu-francis

(Für andere Seite wiederholen)

DRBD konfigurieren

Die folgenden Anweißungen müssen auf beiden Nodes ausgeführt werden

  • vi /etc/drbd.d/wwwdata.res
resource wwwdata {
 protocol C;
 meta-disk internal;
 device /dev/drbd1;
 syncer {
  verify-alg sha1;
 }
 net {
  allow-two-primaries;
 }
 on francis {
  disk   /dev/ubuntu-francis/drbd-demo;
  address  192.168.50.51:7789;
 }
 on claire {
  disk   /dev/ubuntu-claire/drbd-demo;
  address  192.168.50.52:7789;
 }
}

drbd-laufwerk erstellen

  • drbdadm create-md wwwdata
initializing activity log
NOT initializing bitmap
Writing meta data...
New drbd meta data block successfully created.

drbd-Laufwerk hochfahren

  • modprobe drbd
  • drbdadm up wwwdata

Diesen Rechner als primär verwenden

Die folgenden Befehle müssen nur auf der Node ausgeführt werden, die später die primäre Node sein soll

  • drbdadm primary --force wwwdata

Dateisystem erstellen

  • mkfs.xfs /dev/drbd1
meta-data=/dev/drbd1             isize=512    agcount=4, agsize=131066 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=0
data     =                       bsize=4096   blocks=524263, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =Internes Protokoll     bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =keine                  extsz=4096   blocks=0, rtextents=0

Resourcen anlegen

in der Datei drbd_cfg zwischenspeichern

  • pcs cluster cib drbd_cfg

Die Resource für das Master/Slave-Setup erstellen

  • pcs -f drbd_cfg resource create WebData ocf:linbit:drbd \
  • >drbd_resource=wwwdata op monitor interval=60s
  • pcs -f drbd_cfg resource master WebDataClone WebData \
  • >master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 \
  • >notify=true
  • pcs -f drbd_cfg resource show
VirtualIP	(ocf::heartbeat:IPaddr2):	Started francis
 WebSite	(ocf::heartbeat:apache):	Started francis
 Master/Slave Set: WebDataClone [WebData]
     Stopped: [ claire francis ]

Die Konfiguration aus der Datei ins cib übernehmen

  • pcs cluster cib-push drbd_cfg
CIB updated
  • pcs status
Cluster name: underwood
Last updated: Wed Oct 26 16:07:39 2016		Last change: Wed Oct 26 16:07:29 2016 by root via cibadmin on francis
Stack: corosync
Current DC: claire (version 1.1.14-70404b0) - partition with quorum
2 nodes and 4 resources configured

Online: [ claire francis ]

Full list of resources:

 VirtualIP	(ocf::heartbeat:IPaddr2):	Started francis
 WebSite	(ocf::heartbeat:apache):	Started francis
 Master/Slave Set: WebDataClone [WebData]
     Masters: [ francis ]
     Slaves: [ claire ]

PCSD Status:
  francis: Online
  claire: Online

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


  • pcs resource create nfsshare Filesystem device=/dev/rbd0 directory=/mnt/misc fstype=ext4 --group nfsgroup
  • pcs resource create nfs-daemon nfsserver nfs_shared_infodir=/mnt/misc/nfsinfo nfs_no_notify=true --group nfsgroup
  • pcs resource create nfs-root exportfs clientspec=10.0.0.0/255.0.0.0 options=rw,sync,no_root_squash directory=/mnt/misc/data fsid=0 --group nfsgroup
  • pcs resource create nfs_ip IPaddr2 ip=10.82.100.100 cidr_netmask=16 --group nfsgroup