You are here

Part14: HA LVM. My Study Notes for Red Hat Certificate of Expertise in Clustering and Storage Management Exam (EX436)

[root@foserver01 ~]# for i in 1 2 3 4; do ssh centos-clase$i "lvmconf --enable-cluster"; done
[root@foserver01 ~]# for i in 1 2 3 4; do ssh centos-clase$i "chkconfig clvmd on ; service clvmd restart"; done
Restarting clvmd: connect() failed on local socket: No such file or directory
[FAILED]
Starting clvmd:
Activating VG(s): Error locking on node centosclu1hb1: device-mapper: create ioctl on vg_rootvg-rootlv failed: Device or resource busy
Error locking on node centosclu1hb1: device-mapper: create ioctl on vg_rootvg-swaplv failed: Device or resource busy
Error locking on node centosclu1hb1: device-mapper: create ioctl on vg_rootvg-usrlv failed: Device or resource busy
0 logical volume(s) in volume group "vg_rootvg" now active
Error locking on node centosclu1hb1: device-mapper: create ioctl on vg_rootvg-varlv failed: Device or resource busy
clvmd not running on node centosclu2hb1
1 logical volume(s) in volume group "vgcluster" now active
clvmd not running on node centosclu2hb1
4 logical volume(s) in volume group "vg_rootvg" now active
clvmd not running on node centosclu2hb1

We are going to add back node3, centos-clase3:

[root@centos-clase1 ~]# ccs -h centos-clase1 --addnode centosclu3hb1
Node centosclu3hb1 added.
[root@centos-clase1 ~]# cman_tool version -r
[root@centos-clase1 ~]#
[root@centos-clase1 ~]# clustat
Cluster Status for fomvsclu @ Thu Sep 5 16:52:04 2013
Member Status: Quorate

Member Name ID Status
------ ---- ---- ------
centosclu1hb1 1 Online, Local, rgmanager
centosclu2hb1 2 Online, rgmanager
centosclu3hb1 3 Offline
/dev/mapper/quorumdisk 0 Online, Quorum Disk

Service Name Owner (Last) State
------- ---- ----- ------ -----
service:hanfs centosclu2hb1 started
service:sambapublic centosclu2hb1 started
service:wwwprod centosclu2hb1 started

[root@centos-clase3 ~]# service cman start
Starting cluster:
Checking if cluster has been disabled at boot... [ OK ]
Checking Network Manager... [ OK ]
Global setup... [ OK ]
Loading kernel modules... [ OK ]
Mounting configfs... [ OK ]
Starting cman... [ OK ]
Starting qdiskd... [ OK ]
Waiting for quorum... [ OK ]
Starting fenced... [ OK ]
Starting dlm_controld... [ OK ]
Tuning DLM kernel config... [ OK ]
Starting gfs_controld... [ OK ]
Unfencing self... [ OK ]
Joining fence domain... [ OK ]
[root@centos-clase3 ~]#
[root@centos-clase3 ~]# clustat
Cluster Status for fomvsclu @ Thu Sep 5 16:53:58 2013
Member Status: Quorate

Member Name ID Status
------ ---- ---- ------
centosclu1hb1 1 Online
centosclu2hb1 2 Online
centosclu3hb1 3 Online, Local
/dev/mapper/quorumdisk 0 Online, Quorum Disk

and we should remove the quorom disk, we remove it from cluster.conf:
[root@centos-clase1 ~]# vi /etc/cluster/cluster.conf
[root@centos-clase1 ~]# cman_tool version -r
ot@centos-clase2 ~]# clustat
Cluster Status for fomvsclu @ Thu Sep 5 16:56:05 2013
Member Status: Quorate

Member Name ID Status
------ ---- ---- ------
centosclu1hb1 1 Online, rgmanager
centosclu2hb1 2 Online, Local, rgmanager
centosclu3hb1 3 Online
/dev/mapper/quorumdisk 0 Offline, Quorum Disk

We are now going to configure our vgcluster as a clustered vg, and we are going to configure a ha-lvm resource for our web resource group :

[root@centos-clase1 ~]# umount /mnt
[root@centos-clase1 ~]#
[root@centos-clase1 ~]# vgchange -a n /dev/vgcluster
0 logical volume(s) in volume group "vgcluster" now active
[root@centos-clase1 ~]# vgchange -c y /dev/vgcluster
Volume group "vgcluster" successfully changed
[root@centos-clase1 ~]# vgchange -a e /dev/vgcluster
1 logical volume(s) in volume group "vgcluster" now active

[root@centos-clase1 ~]# mount /dev/mapper/vgcluster-lvol1 /mnt
[root@centos-clase1 ~]# cd /mnt
[root@centos-clase1 mnt]# vi index.html
[root@centos-clase1 mnt]# cd
[root@centos-clase1 ~]# umount /mnt
[root@centos-clase1 ~]# lvchange -a n /dev/mapper/vgcluster-lvol1

We create the resource indicating the vg and lvol:
[root@centos-clase1 ~]# ccs -h centos-clase1 --addresource lvm name=lvmweb vg_name=vgcluster lv_name=lvol1

And now we add it to the web resource group editing cluster.conf:

we modify the device to add lvol1

--> this is our ha-lvm resource

---> we create the fs resource as a child of the lvm ha resource

We activate the changes, and we can see in the log, how it mounts the new resource:

[root@centos-clase1 ~]# cman_tool version -r

Sep 05 17:11:42 rgmanager Reconfiguring
Sep 05 17:11:42 rgmanager Loading Service Data
Sep 05 17:11:57 rgmanager Stopping changed resources.
Sep 05 17:11:58 rgmanager [fs] unmounting /var/www/html
Sep 05 17:11:58 rgmanager Restarting changed resources.
Sep 05 17:11:58 rgmanager Starting changed resources.
Sep 05 17:12:00 rgmanager [fs] mounting /dev/dm-17 on /var/www/html
Sep 05 17:12:00 rgmanager [fs] mount -t ext4 /dev/dm-17 /var/www/html

[root@centos-clase2 ~]# df -h
/dev/mapper/vgcluster-lvol1
1008M 253M 705M 27% /var/www/html

If we try to mount/activate lvol1 from vgcluster, we can see it's locked:

[root@centos-clase1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_rootvg 1 4 0 wz--n- 19.59g 6.88g
vg_rootvg 1 4 0 wz--n- 19.59g 6.88g
vgcluster 1 1 0 wz--nc 2.00g 1020.00m
[root@centos-clase1 ~]# lvchange -a y /dev/vgcluster/lvol1
Error locking on node centosclu2hb1: Device or resource busy
Error locking on node centosclu1hb1: Volume is busy on another node
Error locking on node centosclu3hb1: Volume is busy on another node

So we now for sure that only one node will mount the FS.

Unix Systems: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.

Fatal error: Class CToolsCssCache contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (DrupalCacheInterface::__construct) in /homepages/37/d228974590/htdocs/sites/all/modules/ctools/includes/css-cache.inc on line 52