WPAR - Best Practise

WPAR (Workload PARtition):

 WPAR is a miniature of the AIX (The AIXs running inside the AIX), Can be moveable from one server to another without disrupting main AIX. We can create more WPARs in the server.


Requirements:

AIX6 and Power6

WPAR Manager,

WPAR Agents,

NFS share with 1GB minimum

Setup:

WPAR Name: App1WPAR

Participating Nodes:
lb511p014_pub (can act as WPAR Manager too)
lpar23ml162f_pub


Increase the size of the /var:

lb511p014_pub[/] > chfs -a size=800000 /var

Filesystem size changed to 1048576

Creating a NFS share for WPAR:

lb511p014_pub[/] > crfs -v jfs2 -g rootvg -m /wpars -A yes -a size=1G

File system created successfully.

1048340 kilobytes total disk space.

New File System size is 2097152

lb511p014_pub[/] > mount /wpars

lb511p014_pub[/] > chmod 700 /wpars

lb511p014_pub[/] > vi /etc/exports

lb511p014_pub[/] > exportfs -a

lb511p014_pub[/] > cat /etc/exports

/wpars -rw,access=lb511p014_pub:lb424p017_pub:App1WPAR,root=lb511p014_pub:lb424p017_pub:App1WPAR



lb511p014_pub [/] > stopsrc -g nfs

0513-044 The biod Subsystem was requested to stop.

0513-044 The rpc.statd Subsystem was requested to stop.

0513-044 The rpc.lockd Subsystem was requested to stop.

lb511p014_pub [/] > stopsrc -s portmap

0513-044 The portmap Subsystem was requested to stop.

lb511p014_pub [/] > startsrc -s portmap

0513-059 The portmap Subsystem has been started. Subsystem PID is 127206.

lb511p014_pub [/] > startsrc -g nfs

0513-059 The biod Subsystem has been started. Subsystem PID is 69842.

0513-059 The nfsd Subsystem has been started. Subsystem PID is 253956.

0513-059 The rpc.mountd Subsystem has been started. Subsystem PID is 458926.

0513-059 The nfsrgyd Subsystem has been started. Subsystem PID is 463000.

0513-059 The gssd Subsystem has been started. Subsystem PID is 446568.

0513-059 The rpc.lockd Subsystem has been started. Subsystem PID is 442608.

0513-059 The rpc.statd Subsystem has been started. Subsystem PID is 393222.



lb511p014_pub [/] > lssrc -g nfs

Subsystem Group PID Status

biod nfs 69842 active

nfsd nfs 253956 active

rpc.mountd nfs 458926 active

rpc.lockd nfs 442608 active

rpc.statd nfs 393222 active

nfsrgyd nfs inoperative

gssd nfs inoperative



lpar23ml162f_pub[/] > lssrc -s portmap

Subsystem Group PID Status

portmap portmap 127206 active

WPAR Package Source:

lb511p014_pub[/] > ls -al /stage/middleware/AIX/WPM/installp/ppc

total 371864

drwx--S--- 2 root system 4096 Mar 26 2009 .

drwx--S--- 3 root system 256 Mar 26 2009 ..

-rwx------ 1 root system 76418 Mar 26 2009 .toc

-rwx------ 1 root system 88062976 Mar 26 2009 cas.agent

-rwx------ 1 root system 7203328 Mar 26 2009 mcr.rte

-rwx------ 1 root system 1559552 Mar 26 2009 tivoli.tivguid

-rwx------ 1 root system 486400 Mar 26 2009 wparmgt.agent

-rwx------ 1 root system 23630848 Mar 26 2009 wparmgt.cas.agentmgr

-rwx------ 1 root system 40960 Mar 26 2009 wparmgt.db

-rwx------ 1 root system 803840 Mar 26 2009 wparmgt.license

-rwx------ 1 root system 39651328 Mar 26 2009 wparmgt.lwi

-rwx------ 1 root system 28839936 Mar 26 2009 wparmgt.mgr

-rwx------ 1 root system 17408 Mar 26 2009 wparmgt.msg.en_US

Installation of WPAR manager:

lb511p014_pub[/] > installp -acXYgd /stage/middleware/AIX/WPM/installp/ppc wparmgt.mgr

Configuration of WPAR manager:

lb511p014_pub[/] > /opt/IBM/WPAR/manager/bin/WPMConfig.sh -i console

Note: Pls choose the good password and remember the same while configuring the agent

Installation of WPAR agent in the WPAR manager:

lb511p014_pub[/] > installp -acXYgd /stage/middleware/AIX/WPM/installp/ppc wparmgt.agent

Configuration of WPAR agent in the WPAR manager:

lb511p014_pub[/] > /opt/IBM/WPAR/agent/bin/configure-agent -amhost lb511p014_pub -prompt

Note: It will prompt the WPAR manager registration password

BTC7861I Checking if the common agent is already registered...done


BTC7866I The common agent registration password...

Enter password: ********
Retype password: ********

BTC7872I Checking the common agent state...the common agent is not running


Resolved configuration:

The common agent connection information:

name = localhost

port = 9510

jport = 9514

nport = 9515

wport = disabled

wsport = disabled

The agent manager information:

Common agent managed by the agent manager

amhost = lb511p014_pub

amport = 9513

ctxroot = /AgentMgr

The common agent service information:

noinstall = false

nostart = false



BTC7878I Validating the resolved configuration of the common agent...done

BTC8623I Validating the connection to the agent manager...done

BTC8624I Validating the registration password...done



BTC7880I Configuring the common agent...done

BTC7881I Installing the common agent service...done

BTC7882I Starting the common agent...done


Installation of WPAR agent in second server:

lb424p017_pub[/] > installp -acXYgd /stage/middleware/AIX/WPM/installp/ppc wparmgt.agent

Configuration of WPAR agent in second server:

lb424p017_pub[/] > /opt/IBM/WPAR/agent/bin/configure-agent -amhost lb511p014_pub -prompt

BTC7861I Checking if the common agent is already registered...done

BTC7866I The common agent registration password...

Enter password: ******
Retype password: ******

BTC7872I Checking the common agent state...the common agent is not running



Resolved configuration:

The common agent connection information:

name = localhost

port = 9510

jport = 9514

nport = 9515

wport = disabled

wsport = disabled

The agent manager information:

Common agent managed by the agent manager

amhost = lb511p014_pub

amport = 9513

ctxroot = /AgentMgr

The common agent service information:

noinstall = false

nostart = false



BTC7878I Validating the resolved configuration of the common agent...done

BTC8623I Validating the connection to the agent manager...done

BTC8624I Validating the registration password...done



BTC7880I Configuring the common agent...done

BTC7881I Installing the common agent service...done

BTC7882I Starting the common agent...done



lb511p014_pub[/] > ls -al /wpars
total 80

drwx------ 19 root system 4096 Oct 23 09:26 .

drwxr-xr-x 25 root system 4096 Oct 23 07:39 ..

drwxr-xr-x 2 root system 256 Oct 23 09:23 App1WPAR

drwxr-xr-x 3 root system 256 Oct 05 2007 admin

drwxr-x--- 2 root audit 256 Oct 05 2007 audit

lrwxrwxrwx 1 bin bin 8 Oct 23 09:23 bin -> /usr/bin

drwxrwxr-x 2 root system 256 Oct 23 09:23 dev

drwxr-xr-x 29 root system 16384 Oct 23 09:28 etc

drwxr-xr-x 4 bin bin 256 Oct 23 09:23 home

lrwxrwxrwx 1 bin bin 8 Oct 23 09:23 lib -> /usr/lib

drwx------ 2 root system 256 Oct 23 06:52 lost+found

drwxr-xr-x 176 bin bin 8192 Oct 23 09:28 lpp

drwxr-xr-x 2 bin bin 256 Oct 05 2007 mnt

drwxr-xr-x 2 root system 256 Oct 23 09:23 opt

drwxr-xr-x 2 root system 256 Oct 23 09:23 proc

drwxr-xr-x 3 bin bin 256 Oct 23 09:24 sbin

drwxrwxr-x 2 root system 256 Oct 23 09:26 tftpboot

drwxrwxrwt 3 bin bin 4096 Oct 23 09:28 tmp

lrwxrwxrwx 1 bin bin 5 Oct 23 09:23 u -> /home

drwxr-xr-x 2 root system 256 Oct 23 09:23 usr

drwxr-xr-x 28 bin bin 4096 Oct 23 09:28 var

drwxr-xr-x 2 root system 256 Oct 23 09:23 wpars



lb511p014_pub[/] > du -sm /wpars

134.92 /wpars

Start WPAR in lb511p014_pub server:

lb511p014_pub[/] > startwpar App1WPAR



After Successful starting of WPAR in lb511p014_pub server,



lb511p014_pub[/] > lswpar

Name State Type Hostname Directory

-------------------------------------------------

App1WPAR A S App1WPAR /wpars/App1WPAR



Finally, 

Login to WPAR,


lb511p014_pub[/] > clogin App1WPAR2



You can move the WPAR to the second server while online by using

“ IBM PowerVM workload partition manager “

URL: https://lb511p014_pub:14443/ibm/console

lb424p017_pub[/] > lsconf |grep -i machine

Machine Serial Number: 108E424

The following resources are installed on the machine.


Hints:

To Uninstall:

installp -ug wparmgt.agent
installp -ug wparmgt.mgr

WPAR Commands:

Most of these commands are only runable by root user for the Global LPAR (Global
Environment).

chwpar Modifies dynamically the configuration options of the WPAR even when it is
running.

clogin Provides a mechanism for the root user to log in or run a command within a workload partition. The “clogin” command uses a pseudo-terminal allocated on the Global Environment (see in the mobility part the impact of this) and creates a login shell running which belongs to the workload partition.

lswpar Prints information about WPARs

mkwpar Specific for System WPAR - Builds the infrastructure and the configuration file. Then it creates and populates the WPARs file systems. Allocate the specified resources as well as the WLM information (if any) and eventually starts it. Specifying whether the workload partitions should be automatically started on system boot or when /etc/rc.wpars is executed.

startwpar Activates the System WPAR defined with mkwpar

wparexec Specific for Application WPAR – Builds, create specification file and eventually starts the Application WPAR

rebootwpar Stops and resumes a System Workload Partition. It cannot be run within a WPAR

rmwpar Deletes the specified Workload Partition from the system as well as its configuration and its WLM profile

stopwpar Kills the WPAR and deallocate all resources belonging to it. It removes the Application WPAR

syncwpar Specific to System WPAR - Synchronizes the software installed in the global shared parts (usually /usr and /opt) with the workload partition's root part

Note: The mkwpar and chwpar can update the global file /etc/wpars:

Note: /etc/rc.wpars: Specific to System WPAR - this script is run at main system boot it invokes the startwpar command on all workload partitions with the autostart option.
Some commands have different or enhanced behavior in a WPAR environment. The list includes acctcom, acctctl, df, domainname, hosted, hostname, ifconfig, ioo, ipcrm, ipcs, mkclass, mount, netstat, nfso, no, projctl, ps , schedo, uname, vmo, wlmstat, wlmtune, wlmcntrl. This change is described in the AIX 6 documentation.

The simplest way to administrate WPARs using command lines (CLI) is to issue the command smitty wpar which will provide the interface to these commands.

On Global Server,

ps –ef -@
pg

ps –ef -@ wparname
pg

topas -@


WPAR Backup and Restore in same workload partition:

savewpar -Nif /backup/app1wpar2.bk app1wpar2 -> to take a WPAR backup while in Active

stopwpar –hN app1wpar2

rm -fr app1wpar1*/* app1wpar1*/.* ; ls -l app1wpar1*

rmwpar app1wpar2 -> to remove the definition

lswpar -> will don’t show the wpar now

lssavewpar –f app1wpar2.bk
pg

restwpar –f /backup/app1wpar2.bk

WPAR Cloning (Backed up wpar restored in different partition:

Source WPAR= app1wpar2

Dest WPAR(Cloned as)=app1wpar3


restwpar -h secondsrv -n app1wpar3 -d /wpars/app1wpar3 -r -U -M "-N address=192.168.0.3 -M directory=/ vfs=nfs host=192.169.0.1 dev=/wpars/app1wpar3root -M directory=/home vfs=nfs host=192.168.0.1 dev=/wpars/app1wpar3home -M directory=/tmp vfs=nfs host=192.168.0.1 dev=/wpars/app1wpar3 -M directory=/var vfs=nfs host=192.168.0.1 dev=wpars/app1wpar3" -f /backup/app1wpar2.bk

WPAR - Beginners

Workload Partitions for Beginners - WPAR

Workload Partitioning is a virtualization technology that utilizes software rather than firmware to isolate users and/or applications.
Note: this introduction to WPAR concepts is based on CLI, or command line interface, to using workload partitions on a single AIX system.
A Workload Partition (WPAR) is a combination of several core AIX technologies. There are differences of course, but here the emphasis is on the similarities. In this essay I shall describe the characteristics of these technologies and how workload partitions are built upon them.

There are two types of WPAR: system and application.My focus is on system WPAR as this more closely resembles a LPAR or a separate system. In other words, a system WPAR behaves as a complete installation of AIX. At a later time application workload partitions will be described in terms of how they differ from a system WPAR. For the rest of this document WPAR and system WPAR are to be considered synonymous.

AIX system software has three components: root, user, and shared. The root component consists of all the software and data that are unique to that system or node. The user (or usr) part consists of all the software and data that is common to all AIX systems at that particular AIX software level (e.g., oslevel AIX 5.3 TL06-01, or AIX 5.3 TL06-02, or AIX 6.1). The shared component is software and data that is common to any UNIX or Linux system.

In it's default configuration a WPAR inherits it's user (/usr) and shared (/usr/share, usually physically included in /usr filesystem) components from the global system. Additionally, the WPAR inherits the /opt filesystem. The /opt filesystem is the normal installation area in the rootvg volume group for RPM and IHS packaged applications and AIX Linux affinity applications and libraries. Because multiple WPAR's are intended to share these file fystems (/usr and /opt) they are read-only by WPAR applications and users. This is very similiar to how NIM (Network Installation Manager) diskless and dataless systems were configured and installed. Since only the unique rootvg volume group file systems need to be created (/, /tmp, /var, /home) creation of a WPAR is a quick process.

The normal AIX boot process is conducted in three phases:
1) boot IPL, or locating and loading the boot block (hd5);
2) rootvg IPL (varyonvg of rootvg),
3) rc.boot 3 or start of init process reading /etc/inittab

A WPAR activation or "booting" skips step 1. Step 2 is the global (is hosting) system mounting the WPAR filesystems - either locally or from remote storage (currently only NFS is officially supported, GPFS is known to work, but not officially supported at this time (September 2007)). The third phase is staring an init process in the global system. This @init@ process does a chroot to the WPAR root filesystem and performs an AIX normal rc.boot 3 phase.

WPAR Management:
WPAR Management in it's simpliest form is simply: Starting, Stopping, and Monitoring resource usage. And, not to forget - creating and deleting WPAR.

Creating a WPAR is a very simple process: the onetime prequistite is the existence of the directory /wpars with mode 700 for root. Obviously, we do not want just anyone wondering in the virtualized rootvg's of the WPAR. And, if the WPAR name you want to create resolves either in /etc/hosts or DNS (and I suspect NIS) all you need to do is enter:
# mkwpar -n
If you want to save the output you could also use:
# nohup mkwpar -n & sleep 2; tail -f nohup.out
and watch the show!

This creates all the wpar filesystems (/, /home, /tmp, /var and /proc)
and read-only entries for /opt and /usr. After these have been made, they are
mounted and "some assembly" is performed, basically installing the root part
of the filesets in /usr. The only "unfortunate" part of the default setup is
that all filesystems are created in rootvg, and using generic logical partition
names (fslv00, fslv01, fslv02, fslv03). Fortunately, there is an argument
(-g) that you can use to get the logical partitions made in a different
volume group. There are many options for changing all of these and they
will be covered in my next document when I'll discuss WPAR mobility.

At this point you should just enter:
# startwpar
wait for prompt and from "anywhere" you can connect to the running WPAR just
as if it was a seperate system. Just do not expect to make any changes in /usr
or /opt (software installation is also a later document).

Summary:
WPAR creation is very similar to the process NIM uses for diskless and dataless installations. This method relies on AIX rootvg software consisting of three components: root, user and share. The normal boot process is emulated by the global system "hosting" the WPAR. Phase 1 is not needed; Phase 2 is the mount of the WPAR filesystem resources; and Phase 3 is a so-called @init@ process that is seen as the regular init in the WPAR environment. This is the process that reads and processes /sbin/rc.boot 3 and /etc/inittab just as a normal AIX system would.

What's next?
Not promising any particular order, but the subject I have in mind at
the moment are:
·    WLM as resource manager....
·    mkwpar options and (my) best practices
·    WPAR mobility
·    WPAR software installation
·    Application WPAR

and I am sure more as I gain more experience.