Friday, December 21, 2012

AIX WPAR Configuration and Administration


AIX WPAR Configuration and Administration


IBM introduced work load partitions (WPAR) in AIX from v6.1. WAPR enables virtuvalization features in Logical partition i.e nothing but LPAR.

The main difference between LPAR and WPAR is, every LPAR required its own Operating system and certain amount hardware resources like CPU, memory ,disks ... 

whereas WPAR is independent of all these.

Advantage of WPAR:
  1. AIX admin can create a WPAR through a single command  or SMIT menu within 30 Minutes (quick deployment).
  2. You can create individual WPAR for each of your application.
  3. WPAR is independent of your rootvg and you can maintain individual environment for each WPAR (like file systems, configurations, users, network, tuning settings..etc).
  4. You can maintain WPAR image for each of your environment like Prod/Test/Dev/Non-prod/Lab. 

Disadvantage of WPAR:
  1. If any hardware/Network failures at LPAR level it will affect all WPAR’s on that box.
  2. WPAR is not capable of high load / high I/O applications and data bases.
  3. WPAR is not recommended for Production environment so far..
  4. WPAR is not recommended for highly security environments.
  5. No Support for physical devices on WAPR point (You can’t add storage..etc).

WPAR’s categorized as two types:
  1. System Workload Partition: This type of WPAR’s is much closer to complete version of AIX. The system WPAR has its own dedicated, completely writable file systems along with its own inetd and cron.
  2. Application Workload Partitions: Application WPARs are real, lightweight versions of virtualized OS environments. They are extremely limited and can only run application processes, not system daemons such as inetd or cron. One cannot even define remote access to this environment.

WPAR Administration:
Here I will be creating a System wpar named testwpar that is independent of my LPAR rootvg.

To accommodate this request I will create a separate VG named wparvg for all my WPAR's and under that VG I will create base file system (/wpar) for my testwpar.

1. Create wparvg on hdisk0
subha:/ # mkvg -B -s 128M -y wparvg hdisk0
wparvg
subha:/ #

2. Create a base File system for testwpar install.
subha:/ #  crfs -v jfs2 -g wparvg -a size=20G -m /wpar
File system created successfully.
20970676 kilobytes total disk space.
New File System size is 41943040

subha:/ #
subha:/ # mount /wpar

3. Change FS permissions to 700 for security
subha:/ # chmod -R 700 /wpar

4. Create a system wpar named testwpar with IP 10.x.x.x under wparvg and base file system is /wpar/testwpar …

-A for to add WPAR info to /etc/rc.wpars and add to global /etc/inittab to start wpar at LPAR Boot.
-s to start WPAR after creation (Here I havn’t user –s, I will start WPAR with startwpar command).

subha:/ # mkwpar -A -n testwpar -N address=10.x.x.x -g wparvg -d /wpar/testwpar
mkwpar: Creating file systems...
 /
 /home
 /opt
 /proc
 /tmp
 /usr
 /var

subha:/ # lswpar
Name      State  Type  Hostname  Directory       RootVG WPAR
-------------------------------------------------------------
testwpar  D      S     testwpar  /wpar/testwpar  no
subha:/ #

To Start WPAR with #startwpar

subha:/ # startwpar testwpar
Starting workload partition 'testwpar'.
Mounting all workload partition file systems.
Loading workload partition.
Exporting workload partition devices.
Starting workload partition subsystem 'cor_testwpar'.
0513-059 The cor_testwpar Subsystem has been started. Subsystem PID is 14024940.
Verifying workload partition startup.

To login to WPAR use command #clogin
subha:/ # clogin testwpar
*******************************************************************************
*  Welcome to AIX Version 6.1!                                                *
*                                                                             *
*                                                                             *
*  Please see the README file in /usr/lpp/bos for information pertinent to    *
*  this release of the AIX Operating System.                                  *                                                                             ********************************************************************************

# hostname
testwpar
#

To list all WPAR’s running on given LPAR #lswpar
Use –L option for WPAR detailed information including all configurations.

To get WPAR resource limit usage you can use below command
subha:/ # lswpar -a Name,State,Hostname,CPU,memory,Shares_CPU,Shares_memory
Name      State  Hostname  CPU Limits    Memory Limits  CPU Shares  Memory Shares
----------------------------------------------------------------------------------
testwpar  A      testwpar  0%-100%,100%  0%-100%,100%   unlimited   unlimited
subha:/ #

To change CPU & Memory allocations to WPAR use #chwpar
subha:/ # chwpar -R CPU=5%-40%,60% testwpar
subha:/ # chwpar -R memory=10%-30%,40% testwpar
subha:/ #
subha:/ # lswpar -a Name,State,Hostname,CPU,memory,Shares_CPU,Shares_memory
Name      State  Hostname  CPU Limits  Memory Limits  CPU Shares  Memory Shares
--------------------------------------------------------------------------------
testwpar  A      testwpar  5%-40%,60%  10%-30%,40%    unlimited   unlimited
subha:/ # lswpar
Name      State  Type  Hostname  Directory    RootVG WPAR
----------------------------------------------------------
testwpar  A      S     testwpar  /wpar/wpars  no
subha:/ #

Here State –A (Active), type –S (System WPAR), Hostname =WPAR Name, Directory=WPAR Base FS, Rootvg=no (Independent of LPAR rootvg).

To stop running WAPR #stopwpar
subha:/ # stopwpar testwpar
Stopping workload partition 'testwpar'.
Stopping workload partition subsystem 'cor_testwpar'.
0513-044 The cor_testwpar Subsystem was requested to stop.
stopwpar: 0960-261 Waiting up to 600 seconds for workload partition to halt.
Shutting down all workload partition processes.
wio0 Defined
Unmounting all workload partition file systems.

Here you can see State of WPAR is D – Deactivated.

subha:/ # lswpar
Name      State  Type  Hostname  Directory    RootVG WPAR
----------------------------------------------------------
testwpar  D      S     testwpar  /wpar/wpars  no
subha:/ #

To remove WPAR including its local file systems #rmwpar
If you don’t want remove FS’s use –p and –s options.

subha:/ # rmwpar testwpar
rmwpar: Removing file system /wpar/wpars/var.
rmlv: Logical volume fslv07 is removed.
rmwpar: Removing file system /wpar/wpars/usr.
rmwpar: Removing file system /wpar/wpars/tmp.
rmlv: Logical volume fslv06 is removed.
rmwpar: Removing file system /wpar/wpars/proc.
rmwpar: Removing file system /wpar/wpars/opt.
rmwpar: Removing file system /wpar/wpars/home.
rmlv: Logical volume fslv05 is removed.
rmwpar: Removing file system /wpar/wpars.
rmlv: Logical volume fslv04 is removed.
subha:/ #

subha:/ # lswpar --------------------------------------------No WPARS.
subha:/ #

Will Be adding more on WPAR Soon until then keep rocking with AIX :) (: