How to setup a Two-Node cluster:
1. Modify /etc/hosts on both the nodes to include stationary and heartbeat IP addresses.
2. Create volume groups, logical volumes, filesystems on the first node and then import on the second node
3. Configure /.rhosts & /etc/cmcluster/cmclnodelist on both the nodes
Example:
/.rhosts
node1 root
node2 root
/etc/cmcluster/cmclnodelist
node1 root
node2 root
4. Configure stationary and heartbeat IP addresses on both the nodes
a. Modify /etc/rc.config.d/netconf
b. /sbin/init.d/net stop
c. /sbin/init.d/net start
5. Modify /etc/lvmrc to disable auto-activation of volume groups
6. Create the cluster configuration file on the first node
# cmquerycl -v -C /etc/cmcluster/mycluster.conf -n node1 -n node2
7. Modify the configuration file include your needs
8. Verify the configuration file
# cmcheckconf -v -C /etc/clcluster/mycluster.conf
9. Create the cluster binary file and distribute to all the nodes across the cluster
# cmapplyconf -v -C /etc/clcluster/mycluster.conf
10. To view the cluster configuration
# cmviewcl -v
11. Start the cluster
# cmruncl -v
12. Halt the cluster
# cmhaltcl -v
13. You're done.
Execution sequence for starting a package :
1. Master control script
2. External pre-scripts
3. Volume Groups
4. File Systems
5. Package IPs
6. External Scripts
7. Services
Frequently used commands :
To start the entire cluster : # cmruncl –v
To stop the entire cluster : # cmhaltcl
To view the status of cluster : # cmviewcl
To view the cluster, node, package status : # cmviewcl -v
To start a node in the cluster : # cmrunnode -v nodename
To stop a node in the cluster : # cmhaltnode -f -v nodename
To see the configuration : # cmgetconf -C config_name
To start a package : # cmrunpkg pkg1
To start a package on a node : # cmrunpkg -n ndoename pkg1
To halt a package : # cmhaltpkg pkg1
Configuration Files :-
/etc/cmcluster/cmclnodelist – Contains the list of nodes in the cluster
/etc/cmcluster/cluster_config.ascii - cluster configuration file.
/etc/cmcluster/package_name/package_config.ascii - package configuration file
/etc/cmcluster/package_name/package.cntl - package control script
Thursday, January 28, 2010
Tuesday, January 5, 2010
LVM - Logical Volume
Naming Convention:
Logical Volume's can have a name of max. 255 chars.
It can be assigned by the admin or done by the system.
Default names of the form /dev/vgxx/lvoln (for block device) and /dev/vgxx/rlvoln (for raw device).
Few Points to remember :
1. A logical volume can be used for swap, dump, raw data or a file system.
Here are the mostly used commands for managing LV's :
To create a LV :
# lvcreate
To change the characteristics of a LV :
# lvchange
To display info about LVs :
# lvdisplay
To increase the size of a LV :
# lvextend
To decrease the size of a LV :
# lvreduce
To remove a LV :
# lvremove
To prepare a LV to be a root, primary swap or dump volume, updating the boot info on a boot PV :
# lvlnboot
To remove the link that makes a LV a root, primary swap or dump volume :
# lvrmboot
To split a mirrored LV into 2 LVs :
# lvsplit
To merge 2 LVs into 1 mirrored LV :
# lvmerge
To sync the mirrored copies of a mirrored LV :
# lvsync
Few Examples,
1. To display the properties of a LV :
# lvdisplay /dev/vg01/lvol8
2. To display the detailed properties of a LV :
# lvdisplay -v /dev/vg01/lvol8
3. To create a LV of size 100MB in vg01 :
# lvcreate -L 100 /dev/vg01
4. To create a LV named myvol in vg01 of size 100MB :
# lvcreate -n myvol -L 100 /dev/vg01
5. To extend the size of a LV to 200MB :
# lvextend -L 200 /dev/vg01/lvol8
6. To extend the size of a LV by 12 LE's from disk8 :
# lvextend -l 12 /dev/vg01/myvol /dev/disk/disk8
7. To extend the size of a LV to 120MB by taking space from disk8 :
# lvextend -L 120 /dev/vg01/myvol /dev/disk/disk8
8. To list out the processes using a LV :
# fuser -cu /dev/vg01/myvol
9. To add additional copy (mirror) for a LV :
# lvextend -m 1 /dev/vg01/myvol
10. To do the same as above but using a specific PV :
# lvextend -m 1 /dev/vg01/myvol /dev/disk/disk9
11. To remove the mirror copies from a LV :
# lvreduce -m 0 /dev/vg01/myvol
This will remove all the mirror copies. I mean only the original copy is left on the LV.
12. To do the same as above but mentioning a specific PV where to remove the copy :
# lvreduce -m 0 /dev/vg01/myvol /dev/disk/disk9
13. To rename a LV :
a. Rename both the block and raw device files of the LV :
# mv /dev/vg01/myvol /dev/vg01/newvol
# mv /dev/vg01/rmyvol /dev/vg01/rnewvol
b. Finally change the lv names in other config files like /etc/fstab
14. To remove a logical volume :
First of all make sure the LV is not in use.I mean if it got any file system, then unmount the file system.
Then remove the lv using the below command.
# lvremove /dev/vg01/myvol
Logical Volume's can have a name of max. 255 chars.
It can be assigned by the admin or done by the system.
Default names of the form /dev/vgxx/lvoln (for block device) and /dev/vgxx/rlvoln (for raw device).
Few Points to remember :
1. A logical volume can be used for swap, dump, raw data or a file system.
Here are the mostly used commands for managing LV's :
To create a LV :
# lvcreate
To change the characteristics of a LV :
# lvchange
To display info about LVs :
# lvdisplay
To increase the size of a LV :
# lvextend
To decrease the size of a LV :
# lvreduce
To remove a LV :
# lvremove
To prepare a LV to be a root, primary swap or dump volume, updating the boot info on a boot PV :
# lvlnboot
To remove the link that makes a LV a root, primary swap or dump volume :
# lvrmboot
To split a mirrored LV into 2 LVs :
# lvsplit
To merge 2 LVs into 1 mirrored LV :
# lvmerge
To sync the mirrored copies of a mirrored LV :
# lvsync
Few Examples,
1. To display the properties of a LV :
# lvdisplay /dev/vg01/lvol8
2. To display the detailed properties of a LV :
# lvdisplay -v /dev/vg01/lvol8
3. To create a LV of size 100MB in vg01 :
# lvcreate -L 100 /dev/vg01
4. To create a LV named myvol in vg01 of size 100MB :
# lvcreate -n myvol -L 100 /dev/vg01
5. To extend the size of a LV to 200MB :
# lvextend -L 200 /dev/vg01/lvol8
6. To extend the size of a LV by 12 LE's from disk8 :
# lvextend -l 12 /dev/vg01/myvol /dev/disk/disk8
7. To extend the size of a LV to 120MB by taking space from disk8 :
# lvextend -L 120 /dev/vg01/myvol /dev/disk/disk8
8. To list out the processes using a LV :
# fuser -cu /dev/vg01/myvol
9. To add additional copy (mirror) for a LV :
# lvextend -m 1 /dev/vg01/myvol
10. To do the same as above but using a specific PV :
# lvextend -m 1 /dev/vg01/myvol /dev/disk/disk9
11. To remove the mirror copies from a LV :
# lvreduce -m 0 /dev/vg01/myvol
This will remove all the mirror copies. I mean only the original copy is left on the LV.
12. To do the same as above but mentioning a specific PV where to remove the copy :
# lvreduce -m 0 /dev/vg01/myvol /dev/disk/disk9
13. To rename a LV :
a. Rename both the block and raw device files of the LV :
# mv /dev/vg01/myvol /dev/vg01/newvol
# mv /dev/vg01/rmyvol /dev/vg01/rnewvol
b. Finally change the lv names in other config files like /etc/fstab
14. To remove a logical volume :
First of all make sure the LV is not in use.I mean if it got any file system, then unmount the file system.
Then remove the lv using the below command.
# lvremove /dev/vg01/myvol
LVM - Physical Volume
Naming Convention:
Here is a set of examples for pv naming convention.
/dev/disk/disk1 - Persistent block device file for disk1
/dev/disk/disk1_p1 - Persistent block device file for partition 2 belonging to disk1
/dev/rdisk/disk1 - Persistent character/raw device file for disk1
/dev/rdisk/disk1 - Persistent character/raw device file for partition 2 belonging to disk1
/dev/dsk/c1t1d1 - Legacy block device file for disk1 located in target 1 of controller 1
/dev/dsk/c1t1d1s1 - Legacy block device file for the partition 1 belonging to the above disk
/dev/rdsk/c1t1d1 - Legacy character/raw device file for disk1 located in target 1 of controller 1
/dev/rdsk/c1t1d1s1 - Legacy character/raw device file for the partition 1 belonging to the above disk
Here are the mostly used commands for managing PV's :
To create a PV:
# pvcreate
To change the characteristics :
# pvchange
To display the info on PV :
# pvdisplay
To move data between PVs :
# pvmove
To remove a PV from LVM control :
# pvremove
To check or repair a PV :
# pvck
To check if a disk is under LVM control :
# lvmchk
Few Examples,
1. To initialize a disk for LVM [ To create a PV out of a disk] :
# pvcreate /dev/rdisk/disk12
2. To initialize a disk for LVM to use as a boot device :
# pvcreate -B /dev/rdisk/disk2_p2
3. To display the properties of a PV :
# pvdisplay /dev/disk/disk12
4. To display the detailed properties of a PV :
# pvdisplay -v /dev/disk/disk12
5. To move the data between PVs :
# pvmove /dev/disk/disk12:2 /dev/disk/disk13
Here is a set of examples for pv naming convention.
/dev/disk/disk1 - Persistent block device file for disk1
/dev/disk/disk1_p1 - Persistent block device file for partition 2 belonging to disk1
/dev/rdisk/disk1 - Persistent character/raw device file for disk1
/dev/rdisk/disk1 - Persistent character/raw device file for partition 2 belonging to disk1
/dev/dsk/c1t1d1 - Legacy block device file for disk1 located in target 1 of controller 1
/dev/dsk/c1t1d1s1 - Legacy block device file for the partition 1 belonging to the above disk
/dev/rdsk/c1t1d1 - Legacy character/raw device file for disk1 located in target 1 of controller 1
/dev/rdsk/c1t1d1s1 - Legacy character/raw device file for the partition 1 belonging to the above disk
Here are the mostly used commands for managing PV's :
To create a PV:
# pvcreate
To change the characteristics :
# pvchange
To display the info on PV :
# pvdisplay
To move data between PVs :
# pvmove
To remove a PV from LVM control :
# pvremove
To check or repair a PV :
# pvck
To check if a disk is under LVM control :
# lvmchk
Few Examples,
1. To initialize a disk for LVM [ To create a PV out of a disk] :
# pvcreate /dev/rdisk/disk12
2. To initialize a disk for LVM to use as a boot device :
# pvcreate -B /dev/rdisk/disk2_p2
3. To display the properties of a PV :
# pvdisplay /dev/disk/disk12
4. To display the detailed properties of a PV :
# pvdisplay -v /dev/disk/disk12
5. To move the data between PVs :
# pvmove /dev/disk/disk12:2 /dev/disk/disk13
LVM - Physical Extent
Few Points to remember :
1. Default size of PE is 4MB
It can take a value from 1 MB to 256 MB.
2. PE size can be set when you create the volume group.
If you want to change it the only way is to recreate the VG with a newer PE value.
1. Default size of PE is 4MB
It can take a value from 1 MB to 256 MB.
2. PE size can be set when you create the volume group.
If you want to change it the only way is to recreate the VG with a newer PE value.
LVM - Volume Group
Naming Convention:
Volume group's name is unique and can have a max. 255 chars.
Default names of the form /dev/vgxx
Few Points to remember :
1. Max VGs per system can be changed thru the kernel tunable 'maxvgs'.
Minimum value is 0
Default Value is 16
Maximum value is 256
This tunable has been removed in version 11.31.
2. A Volume group can contain minimum 1 PV and maximum 255 PVs.
3. A VG can contain maximum 255 LVs.
Here is the list of mostly used commands for managing VG's :
To create a volume group :
# vgcreate
To remove a volume group :
# vgremove
To activate, deactivate, change the chars of a VG :
# vgchange
To modify the config parameters of a VG :
# vgmodify
To backup the VG config details :
# vgcfgbackup
To restore the VG config details from a config file :
# vgcfgrestore
To display the info for all or a particular VG :
# vgdisplay
To export a VG and its associated LVs:
# vgexport
To import a VG into the system as well as adding an existing VG into /etc/lvmtab :
# vgimport
To scan all PV s looking for LVs and VGs :
# vgscan
To add a PV to a VG :
# vgextent
To remove a PV from a VG :
# vgreduce
To sync all the mirrored LVs in a VG :
# vgsync
To modify the VGID on a PV :
# vgchgid
To migrate a VG from legacy to persistent device files :
# vgdsf
Here are few Examples,
1. To create a volume group :
a. Create a directory under /dev,
# mkdir /dev/vg01
b. Create a group device file
# mknod /dev/vg01/group c 64 0xnn0000
where
c -> to mention group is a character device file
64 -> is the major number for the group file. It should be always 64
0xnn0000 -> is the monir number for the group file in hexadecimal and nn is the unique vg number
c. Finally create the vg using a pv
# vgcreate /dev/vgname /dev/disk/disk12
2. To display all the volume groups :
# vgdisplay
3. To display the properties of a volume group :
# vgdisplay vg00
4. To display the detailed properties of a volume group :
# vgdisplay -v vg00
5. To add a PV to a VG :
# vgextend /dev/vg01 /dev/disk/disk13
6. To remove a PV from a VG :
# vgreduce /dev/vg01 /dev/disk/disk13
Before executing this command, make sure the PV disk13 doesnot hold any LV.
Otherwise vgreduce command wont work.
7. To deactivate a VG :
# vgchange -a n vg01
8. To activate a VG :
# vgchange -a y vg01
9. To export a VG :
# vgexport -s -v -m /tmp/vg01.map vg01
where /tmp/vg01.map is the map file whicj will hold PE-LE mappings and other config details.
10. To import a VG :
You need to create the VG dir and the group device file as like in the VG creation process.
Then you can import the VG using the below command,
# vgimport -s -v -N -m /tmp/vg01.map /dev/vg01
11. To change the "Max PV" attribtue to 255 for a VG :
# vgchange -a n vg01
# vgmodify -p 255 -n vg01
# vgchange -a y vg01
12. To change the "Max PE per PV" attribtue to 8128 for a VG :
# vgchange -a n vg01
# vgmodify -e 8128 -n vg01
# vgchange -a y vg01
13. To hold the write operation on a VG for 400 secs :
# vgchange -Q w -t 400 vg01
This operation is called as quiescing a VG.
14. To hold both read and write operation on a VG untill it is explicitly resumed :
# vgchange -Q rw vg01
15. To resume a quiesced VG :
# vgchange -R vg01
16. To rename a VG :
a. Deactivate the VG :
# vgchange -a n vg01
b. Find out the minor number of the Vg's group file :
# ls -l /dev/vg01/group
c. Export the VG :
# vgexport -m /tmp/vg01.map vg01
d. Create the vg dir in the new name and create its group file with the same minor number
# mkdir /dev/dbvg
# mknod /dev/dbvg/group c 64 0x010000
e. Import the VG
# vgimport -m /tmp/vg01.map /dev/dbvg
f. Backup the VG config info :
# vgcfgbackup /dev/dbvg
g. Activate the VG :
# vgchange -a y /dev/dbvg
h. Remove the saved conf information file for the old vg name :
# rm /etc/lvmconf/vg01.conf
i. Modify all the references in other config files like /etc/fstab
Volume group's name is unique and can have a max. 255 chars.
Default names of the form /dev/vgxx
Few Points to remember :
1. Max VGs per system can be changed thru the kernel tunable 'maxvgs'.
Minimum value is 0
Default Value is 16
Maximum value is 256
This tunable has been removed in version 11.31.
2. A Volume group can contain minimum 1 PV and maximum 255 PVs.
3. A VG can contain maximum 255 LVs.
Here is the list of mostly used commands for managing VG's :
To create a volume group :
# vgcreate
To remove a volume group :
# vgremove
To activate, deactivate, change the chars of a VG :
# vgchange
To modify the config parameters of a VG :
# vgmodify
To backup the VG config details :
# vgcfgbackup
To restore the VG config details from a config file :
# vgcfgrestore
To display the info for all or a particular VG :
# vgdisplay
To export a VG and its associated LVs:
# vgexport
To import a VG into the system as well as adding an existing VG into /etc/lvmtab :
# vgimport
To scan all PV s looking for LVs and VGs :
# vgscan
To add a PV to a VG :
# vgextent
To remove a PV from a VG :
# vgreduce
To sync all the mirrored LVs in a VG :
# vgsync
To modify the VGID on a PV :
# vgchgid
To migrate a VG from legacy to persistent device files :
# vgdsf
Here are few Examples,
1. To create a volume group :
a. Create a directory under /dev,
# mkdir /dev/vg01
b. Create a group device file
# mknod /dev/vg01/group c 64 0xnn0000
where
c -> to mention group is a character device file
64 -> is the major number for the group file. It should be always 64
0xnn0000 -> is the monir number for the group file in hexadecimal and nn is the unique vg number
c. Finally create the vg using a pv
# vgcreate /dev/vgname /dev/disk/disk12
2. To display all the volume groups :
# vgdisplay
3. To display the properties of a volume group :
# vgdisplay vg00
4. To display the detailed properties of a volume group :
# vgdisplay -v vg00
5. To add a PV to a VG :
# vgextend /dev/vg01 /dev/disk/disk13
6. To remove a PV from a VG :
# vgreduce /dev/vg01 /dev/disk/disk13
Before executing this command, make sure the PV disk13 doesnot hold any LV.
Otherwise vgreduce command wont work.
7. To deactivate a VG :
# vgchange -a n vg01
8. To activate a VG :
# vgchange -a y vg01
9. To export a VG :
# vgexport -s -v -m /tmp/vg01.map vg01
where /tmp/vg01.map is the map file whicj will hold PE-LE mappings and other config details.
10. To import a VG :
You need to create the VG dir and the group device file as like in the VG creation process.
Then you can import the VG using the below command,
# vgimport -s -v -N -m /tmp/vg01.map /dev/vg01
11. To change the "Max PV" attribtue to 255 for a VG :
# vgchange -a n vg01
# vgmodify -p 255 -n vg01
# vgchange -a y vg01
12. To change the "Max PE per PV" attribtue to 8128 for a VG :
# vgchange -a n vg01
# vgmodify -e 8128 -n vg01
# vgchange -a y vg01
13. To hold the write operation on a VG for 400 secs :
# vgchange -Q w -t 400 vg01
This operation is called as quiescing a VG.
14. To hold both read and write operation on a VG untill it is explicitly resumed :
# vgchange -Q rw vg01
15. To resume a quiesced VG :
# vgchange -R vg01
16. To rename a VG :
a. Deactivate the VG :
# vgchange -a n vg01
b. Find out the minor number of the Vg's group file :
# ls -l /dev/vg01/group
c. Export the VG :
# vgexport -m /tmp/vg01.map vg01
d. Create the vg dir in the new name and create its group file with the same minor number
# mkdir /dev/dbvg
# mknod /dev/dbvg/group c 64 0x010000
e. Import the VG
# vgimport -m /tmp/vg01.map /dev/dbvg
f. Backup the VG config info :
# vgcfgbackup /dev/dbvg
g. Activate the VG :
# vgchange -a y /dev/dbvg
h. Remove the saved conf information file for the old vg name :
# rm /etc/lvmconf/vg01.conf
i. Modify all the references in other config files like /etc/fstab
Subscribe to:
Posts (Atom)