Websphere MQ 7.1 Installation on Linux & Windows.
Introduction
Websphere MQ has many components which are available as part of the core or as support pacs or add- ons. They are available for a wide variety of platforms we will focus on Linux here.
As MQ is all about integrating components so you will need a set or machines in a network to play around with it. Or you could use virtualization software to create a virtual network of machines. You would preferably need 2 Linux boxes and a Windows box.
The setup used in this HowTo is shown below
The First machine Server 1 hosts the Qmanager1 (TEST1). The Second machine Server 2 hosts the Qmanager2 (TEST2) and Qmanager3. The Qmanager1 has a Listener listening on the default port 1414 and will receive messages from Qmanager2 thru the Channel1.
Qmanager3 in Server2 is there just to show that multiple queue managers can co-exist.
Download WMQ
First decide on the version of MQ that you want to install
Before you install check if your system requirements are compliant to the list provided in
http://www-01.ibm.com/support/docview.wss?uid=swg27006467
· Download the WMQ 7.1 software from IBM website or locate a DVD.
The latest trial version (currently v7.5) can be downloaded from http://www.ibm.com/developerworks/downloads/ws/wmq/
The trial licence is for 90 days, so use it well.
While you download the software download support pac MQ Explorer for windows. This will be useful to as an admin tool.
Also download other support pac’s that you might be interested in.
Create user and group mqm
User and group mqm are created by default as part of the installation. However you might want to create them manually so that the UID and GID are the same across multiple installations (this is useful in case of multi instance queue manager).
· Create a group called mqm
· Create a user called mqm
In the above commands we have created a group call mqm with a gid as specified. Then we are creating a user with uid as specified and root folder /var/mqm and tagged to the group mqm.
· Type the below command to verify if the user has been added properly
Any other user who needs MQ admin privilege needs to be a part of mqm group.
· Use the user mod command to add user to the mqm group
Product directory structure
The MQ executables are created under the folder /opt/mqm/ during the installation.
The directory /var/mqm/ contains the working data and logs.
Remember that the logs and data need to go to high speed storage, if you want good performance.
And the errors should always be on local storage (not on network storage) as otherwise MQ will not be able to report any network issues.
Decide on disk space based on your requirements, recommended values are started below
OS Consideration
The values given below are the recommended values for a single queue manager. If you are running more than one queue manager then increase fs.file-max to a bigger value. The kernel settings can be changed by changing /etc/sysctl.conf file.
· If you change /etc/sysctl.conf file, execute the command given below to bring changes to effect immediately
PAM module sets limits on the system resources that can be obtained in a user-session. By default, limits are taken from the /etc/security/limits.conf config file.
Install Server
· Unzip and untar the downloaded WMQ 7.1 installable files to a temp location
The tar contains the below files
· Execute the command given below. Hit 1 to accept the license agreement.
· Install the minimum components needed for a server by executing rpm command as shown below
The default directory for the installation are
· Set the Envrionment variables using setmqenv (you can use crtmqenv to manually specify variables)
Note the “.” In front
You might want to add the above setmqenv to ~/.bashrc if you want the setmqenv to be triggered every time you start the command prompt.
· Install the sample application to test the deployment
Verify installation
· Switch to mqm user by typing “su mqm”
· To confirm mq version installed, type dspmqver
· If you get the error shown above, you have not set the mq environment so type the following command
· Now retry dspmqver
· Create and start Queue manager
· Define a local queue using MQSC commands
Now that we have created a Queue manager and a queue local we can put and get messages out of the queue using the sample program (MQSeriesSamples installed above).
· Execute the sample program amqsput to put a message
· Execute the sample program amqsget to get a message from the queue
Note that when the message is retrieved, it is also removed from the queue.
Server to Server verify
In a server to server communication we need a the following
In Sender, Server 1
1. Local queue for the remote queue
2. Transmission queue (we would name it with the destination server queue manager)
3. Sender Channel (name needs to match receiver channel)
In Receiver, Server 2
1. Listener
2. Receiver Channel (name needs to match sender channel)
3. Local queue
Here if you drop a message to the remote queue in server 1, you will receive the message in Local queue in server 2.
· Add the MQSC commands given below to a file in Server 1
· Execute the MQSC script file and redirect the output to a file
· Add the MQSC commands given below to a file in Server 2
· Execute the MQSC script file and redirect the output to a file
Now you should be able to communicate between the 2 queue managers i.e. send messages from server 2 to server 1 and not vice versa.
You could expand this to a 2 way communication. That would be an exercise for you.
MQExplorer
You can install this on a number of platforms. Install MQExplorer both on the server and a client windows machine.
You need JRE for MQExplorer, so install MQSeriesJRE before you proceed.
In windows
· Download, unzip and install using the wizard which is self-explanatory
· C onnect to the queue managers you have created as part of the server to server verification by launching the MQ Explorer and right clicking Queue Manager.
However you will not be able to connect to the remote queue manager until you open up the security for remote administration. We will cover this as part of Subsequent topics on Security.
In Linux
· cd to the directory containing the rpm files
· Install MQExplorer (with dependency JRE) by executing rpm command as root
You can start MQExplorer by using start menu or by typing MQExplorer in the installed directory
Support Pacs
MSL1: WebSphere MQ for Linux - Automatic Startup
· Download MSL1, unzip and install the rpm
As part of the install the following is done.
1. Create a init script in /etc/init.d folder
2. Create a configuration file for the init script
3. Create man pages for the script
4. Add the script to various run levels
So now when your machine starts or stops the settings in the /etc/conf.d/ibm.com-WebSphere_MQ are executed. By default all queue managers are started when the machine is started and quiesced when the machine is stopped.
· Test if the support pac is installed fine by restarting the machine
MO03: WebSphere MQ Queue Load / Unload Utility
· Download, unzip and untar the package mo03_unix.tar.Z
The tar contains qload program for a range of operating systems. So pick yours and copy it to a location of your choice.
In my case I am picking qload from location mo03/V1.9/Linux Intel 64
· Change the permissions to provide execute access to the user which needs access to this file.
· Now login into the user who need to use the utility and execute the below command
Uninstall Server
To uninstall MQ installation, follow the instructions given below.
· Check the queue managers in the server
· Check the mq processes currently running in the machine
· Stop the listener
· Stop the Queue Manager
Now if you run “ps -ef | grep -i mq”
You should not see the processes that you saw before i.e. /opt/mqm/bin/* processes.
You can find the installed components using the command given below
The dependencies of the installed components can be found by
· Uninstall by executing rpm command with “-ev” options as shown below
You can reclaim the used space by deleting /var/mqm and its contents. Note that uninstalling the server/runtime does not remove the queue manager details, however if you delete the /var/mqm/ you will lose all queue manager data.
Introduction
Websphere MQ has many components which are available as part of the core or as support pacs or add- ons. They are available for a wide variety of platforms we will focus on Linux here.
As MQ is all about integrating components so you will need a set or machines in a network to play around with it. Or you could use virtualization software to create a virtual network of machines. You would preferably need 2 Linux boxes and a Windows box.
The setup used in this HowTo is shown below
The First machine Server 1 hosts the Qmanager1 (TEST1). The Second machine Server 2 hosts the Qmanager2 (TEST2) and Qmanager3. The Qmanager1 has a Listener listening on the default port 1414 and will receive messages from Qmanager2 thru the Channel1.
Qmanager3 in Server2 is there just to show that multiple queue managers can co-exist.
Download WMQ
First decide on the version of MQ that you want to install
Before you install check if your system requirements are compliant to the list provided in
http://www-01.ibm.com/support/docview.wss?uid=swg27006467
· Download the WMQ 7.1 software from IBM website or locate a DVD.
The latest trial version (currently v7.5) can be downloaded from http://www.ibm.com/developerworks/downloads/ws/wmq/
The trial licence is for 90 days, so use it well.
While you download the software download support pac MQ Explorer for windows. This will be useful to as an admin tool.
Also download other support pac’s that you might be interested in.
Create user and group mqm
User and group mqm are created by default as part of the installation. However you might want to create them manually so that the UID and GID are the same across multiple installations (this is useful in case of multi instance queue manager).
· Create a group called mqm
· Create a user called mqm
groupadd –g <gid> mqm useradd -u <uid> -d /var/mqm -G mqm mqm |
In the above commands we have created a group call mqm with a gid as specified. Then we are creating a user with uid as specified and root folder /var/mqm and tagged to the group mqm.
· Type the below command to verify if the user has been added properly
id mqm |
Any other user who needs MQ admin privilege needs to be a part of mqm group.
· Use the user mod command to add user to the mqm group
usermod -G mqm <userId> |
Product directory structure
The MQ executables are created under the folder /opt/mqm/ during the installation.
The directory /var/mqm/ contains the working data and logs.
Remember that the logs and data need to go to high speed storage, if you want good performance.
/var/mqm/qmgrs /var/mqm/log |
And the errors should always be on local storage (not on network storage) as otherwise MQ will not be able to report any network issues.
/var/mqm/errors |
Decide on disk space based on your requirements, recommended values are started below
Platforms | Software (MB) | Working Space (GB) | Logs (GB) |
Linux on x86 | 201 | 10 | 40 |
Linux on x86-64 | 201 | 10 | 40 |
Linux on POWER | 312 | 10 | 40 |
Linux on System z | 183 | 10 | 40 |
OS Consideration
The values given below are the recommended values for a single queue manager. If you are running more than one queue manager then increase fs.file-max to a bigger value. The kernel settings can be changed by changing /etc/sysctl.conf file.
$ vi /etc/sysctl.conf kernel.msgmni = 1024 kernel.shmmni = 4096 kernel.shmall = 2097152 kernel.shmmax = 268435456 kernel.sem = 500 256000 250 1024 fs.file-max = 524288 net.ipv4.tcp_keepalive_time = 300 |
· If you change /etc/sysctl.conf file, execute the command given below to bring changes to effect immediately
sysctl –p |
PAM module sets limits on the system resources that can be obtained in a user-session. By default, limits are taken from the /etc/security/limits.conf config file.
vi /etc/security/limits.conf mqm hard nproc 10240 mqm soft nproc 10240 |
Install Server
· Unzip and untar the downloaded WMQ 7.1 installable files to a temp location
gunzip CI510ML.tar.gz tar -xvf CI510ML.tar |
The tar contains the below files
copyright crtmqpkg lap licenses mqlicense.sh MQSeriesClient-7.1.0-0.x86_64.rpm MQSeriesExplorer-7.1.0-0.x86_64.rpm MQSeriesGSKit-7.1.0-0.x86_64.rpm MQSeriesJava-7.1.0-0.x86_64.rpm MQSeriesJRE-7.1.0-0.x86_64.rpm MQSeriesMan-7.1.0-0.x86_64.rpm MQSeriesMsg_cs-7.1.0-0.x86_64.rpm MQSeriesMsg_de-7.1.0-0.x86_64.rpm MQSeriesMsg_es-7.1.0-0.x86_64.rpm MQSeriesMsg_fr-7.1.0-0.x86_64.rpm MQSeriesMsg_hu-7.1.0-0.x86_64.rpm MQSeriesMsg_it-7.1.0-0.x86_64.rpm MQSeriesMsg_ja-7.1.0-0.x86_64.rpm MQSeriesMsg_ko-7.1.0-0.x86_64.rpm MQSeriesMsg_pl-7.1.0-0.x86_64.rpm MQSeriesMsg_pt-7.1.0-0.x86_64.rpm MQSeriesMsg_ru-7.1.0-0.x86_64.rpm MQSeriesMsg_Zh_CN-7.1.0-0.x86_64.rpm MQSeriesMsg_Zh_TW-7.1.0-0.x86_64.rpm MQSeriesRuntime-7.1.0-0.x86_64.rpm MQSeriesSamples-7.1.0-0.x86_64.rpm MQSeriesSDK-7.1.0-0.x86_64.rpm MQSeriesServer-7.1.0-0.x86_64.rpm MQSeriesTXClient-7.1.0-0.x86_64.rpm MQSeriesXRClients-7.1.0-0.x86_64.rpm MQSeriesXRService-7.1.0-0.x86_64.rpm PreReqs READMEs Repackage |
· Execute the command given below. Hit 1 to accept the license agreement.
./mqlicense.sh -text_only |
· Install the minimum components needed for a server by executing rpm command as shown below
rpm -ivh MQSeriesRuntime-*.rpm MQSeriesServer-*.rpm |
The default directory for the installation are
/var/mqm /opt/mqm |
· Set the Envrionment variables using setmqenv (you can use crtmqenv to manually specify variables)
. /opt/mqm/bin/setmqenv -s |
Note the “.” In front
You might want to add the above setmqenv to ~/.bashrc if you want the setmqenv to be triggered every time you start the command prompt.
· Install the sample application to test the deployment
rpm -ivh MQSeriesSamples-*.rpm |
Verify installation
· Switch to mqm user by typing “su mqm”
· To confirm mq version installed, type dspmqver
sh-4.2$ dspmqver sh: dspmqver: command not found |
· If you get the error shown above, you have not set the mq environment so type the following command
sh-4.2$ . /opt/mqm/bin/setmqenv -s |
· Now retry dspmqver
sh-4.2$ dspmqver Name: WebSphere MQ Version: 7.1.0.0 Level: p000-L111024 BuildType: IKAP - (Production) Platform: WebSphere MQ for Linux (x86-64 platform) Mode: 64-bit O/S: Linux 3.2.0-29-generic InstName: Installation1 InstDesc: InstPath: /opt/mqm DataPath: /var/mqm Primary: No MaxCmdLevel: 710 |
· Create and start Queue manager
$ crtmqm TEST1 There are 73 days left in the trial period for this copy of WebSphere MQ. WebSphere MQ queue manager created. Directory '/var/mqm/qmgrs/TEST1' created. The queue manager is associated with installation 'Installation1'. Creating or replacing default objects for queue manager 'TEST1'. Default objects statistics : 71 created. 0 replaced. 0 failed. Completing setup. Setup completed. $ strmqm TEST1 There are 73 days left in the trial period for this copy of WebSphere MQ. WebSphere MQ queue manager 'TEST1' starting. The queue manager is associated with installation 'Installation1'. 5 log records accessed on queue manager 'TEST1' during the log replay phase. Log replay for queue manager 'TEST1' complete. Transaction manager state recovered for queue manager 'TEST1'. WebSphere MQ queue manager 'TEST1' started using V7.1.0.0. |
· Define a local queue using MQSC commands
runmqsc TEST1 DEFINE QLOCAL (TMS.BOOK.WAS.V1) 1 : DEFINE QLOCAL (TMS.BOOK.WAS.V1) AMQ8006: WebSphere MQ queue created. |
Now that we have created a Queue manager and a queue local we can put and get messages out of the queue using the sample program (MQSeriesSamples installed above).
· Execute the sample program amqsput to put a message
· Execute the sample program amqsget to get a message from the queue
Note that when the message is retrieved, it is also removed from the queue.
cd $MQ_INSTALLATION_PATH/samp/bin $ ./amqsput TMS.BOOK.WAS.V1 TEST1 Sample AMQSPUT0 start target queue is TMS.BOOK.WAS.V1 Hi, this is a test message ^C $ ./amqsget TMS.BOOK.WAS.V1 TEST1 Sample AMQSGET0 start message <Hi, this is a test message> no more messages Sample AMQSGET0 end |
Server to Server verify
In a server to server communication we need a the following
In Sender, Server 1
1. Local queue for the remote queue
2. Transmission queue (we would name it with the destination server queue manager)
3. Sender Channel (name needs to match receiver channel)
In Receiver, Server 2
1. Listener
2. Receiver Channel (name needs to match sender channel)
3. Local queue
Here if you drop a message to the remote queue in server 1, you will receive the message in Local queue in server 2.
· Add the MQSC commands given below to a file in Server 1
* Define local queue which will receive the message DEFINE QLOCAL (TMS.BOOK.PROCESS) REPLACE * Define local queue which will receive the message DEFINE LISTENER (TEST1LSTN) + TRPTYPE (TCP) + CONTROL (QMGR) + PORT (1414) + REPLACE * Start listener START LISTENER (TEST1LSTN) * Define receiver channel - Note that the channel name needs to match the sender channel in second queue manager DEFINE CHANNEL (TEST2.TEST1) + CHLTYPE (RCVR) + TRPTYPE (TCP) + REPLACE * start channel START CHANNEL(TEST2.TEST1) |
· Execute the MQSC script file and redirect the output to a file
runmqsc TEST1 < server1-objects > output.txt |
· Add the MQSC commands given below to a file in Server 2
* Define local transmission queue - remember match Qlocal name with destination queue manager DEFINE QLOCAL (TEST1) + USAGE (XMITQ) + REPLACE * Define local reference of remote queue - provide details of target QM and queue DEFINE QREMOTE (LOCAL.DEF.OF.REMOTE.QUEUE) + RNAME (TMS.BOOK.PROCESS) + RQMNAME ('TEST1') + XMITQ (TEST1) + REPLACE * Define sending channel - Two key things to remember, provide listener details of target queue manager and the channel name here should match target queue manager DEFINE CHANNEL (TEST2.TEST1) + CHLTYPE (SDR) + CONNAME ('192.168.1.2(1414)') + XMITQ (TEST1) + TRPTYPE (TCP) + REPLACE * Start Channel defined above START CHANNEL (TEST2.TEST1) |
· Execute the MQSC script file and redirect the output to a file
runmqsc TEST2 < server2-objects > output.txt |
Now you should be able to communicate between the 2 queue managers i.e. send messages from server 2 to server 1 and not vice versa.
You could expand this to a 2 way communication. That would be an exercise for you.
MQExplorer
You can install this on a number of platforms. Install MQExplorer both on the server and a client windows machine.
You need JRE for MQExplorer, so install MQSeriesJRE before you proceed.
In windows
· Download, unzip and install using the wizard which is self-explanatory
· C onnect to the queue managers you have created as part of the server to server verification by launching the MQ Explorer and right clicking Queue Manager.
However you will not be able to connect to the remote queue manager until you open up the security for remote administration. We will cover this as part of Subsequent topics on Security.
In Linux
· cd to the directory containing the rpm files
· Install MQExplorer (with dependency JRE) by executing rpm command as root
rpm –ivh MQSeriesJRE-7.1.0-0.x86_64.rpm MQSeriesExplorer-7.1.0-0.x86_64.rpm |
You can start MQExplorer by using start menu or by typing MQExplorer in the installed directory
2. The owner of all mq executables is mqm:mqm. If you are having any issues double check if the owner is mqm:mqm. |
Support Pacs
MSL1: WebSphere MQ for Linux - Automatic Startup
· Download MSL1, unzip and install the rpm
gunzip msl1.tar.gz tar –xvf msl1.tar rpm -ivh MSL1-1.0.1-1.noarch.rpm |
As part of the install the following is done.
1. Create a init script in /etc/init.d folder
2. Create a configuration file for the init script
3. Create man pages for the script
4. Add the script to various run levels
So now when your machine starts or stops the settings in the /etc/conf.d/ibm.com-WebSphere_MQ are executed. By default all queue managers are started when the machine is started and quiesced when the machine is stopped.
If you see the below message warning: %post(MSL1-1.0.1-1.noarch) scriptlet failed, exit status 1 Then the run scripts might not be added to the run levels. Do the following to rectify the situation
2. Check if the configuration file ibm.com-WebSphere_MQ is present in /etc/conf.d folder. If it is there then check the configurations. 3. Check if the scripts are added to the proper run levels by using the below commands If there no entries in the above command the post script has failed
/usr/lib/lsb/install_initd /etc/init.d/ibm.com-WebSphere_MQ echo $? If the exit status is 1 and not 0. Then the pre-checks have potentially failed. Edit the script /etc/init.d/ibm.com-WebSphere_MQ look for the section between begin init info and end init info and replace # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs With # Required-Start: # Required-Stop: Run the command given below and set again and check the exit status /usr/lib/lsb/install_initd /etc/init.d/ibm.com-WebSphere_MQ echo $? |
· Test if the support pac is installed fine by restarting the machine
MO03: WebSphere MQ Queue Load / Unload Utility
· Download, unzip and untar the package mo03_unix.tar.Z
The tar contains qload program for a range of operating systems. So pick yours and copy it to a location of your choice.
In my case I am picking qload from location mo03/V1.9/Linux Intel 64
· Change the permissions to provide execute access to the user which needs access to this file.
· Now login into the user who need to use the utility and execute the below command
./qload -m TEST2 -i TEST1 -f filename |
Uninstall Server
To uninstall MQ installation, follow the instructions given below.
· Check the queue managers in the server
Dspmq QMNAME(TEST1) STATUS(Running) |
· Check the mq processes currently running in the machine
$ ps -ef | grep -i mq mqm 28405 1 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzxma0 -m TEST1 mqm 28410 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzfuma -m TEST1 mqm 28415 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzmuc0 -m TEST1 mqm 28430 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzmur0 -m TEST1 mqm 28431 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzmuf0 -m TEST1 mqm 28438 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqrrmfa -m TEST1 -t2332800 -s2592000 -p2592000 -g5184000 -c3600 mqm 28439 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzdmaa -m TEST1 mqm 28452 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzmgr0 -m TEST1 mqm 28457 28431 0 22:56 ? 00:00:00 /opt/mqm/bin/amqfqpub -mTEST1 mqm 28463 28405 0 22:56 ? 00:00:00 /opt/mqm/bin/amqzlaa0 -mTEST1 -fip0 mqm 28464 28452 0 22:56 ? 00:00:00 /opt/mqm/bin/runmqchi -m TEST1 -q SYSTEM.CHANNEL.INITQ -r mqm 28465 28452 0 22:56 ? 00:00:00 /opt/mqm/bin/amqpcsea TEST1 mqm 28479 28457 0 22:56 ? 00:00:00 /opt/mqm/bin/amqfcxba -m TEST1 |
· Stop the listener
endmqlsr -m TEST1 A WebSphere MQ listener will end shortly. |
· Stop the Queue Manager
$ endmqm TEST1 Quiesce request accepted. The queue manager will stop when all outstanding work is complete. |
Now if you run “ps -ef | grep -i mq”
You should not see the processes that you saw before i.e. /opt/mqm/bin/* processes.
You can find the installed components using the command given below
rpm -q -a|grep 'MQSeries\|gsk' MQSeriesServer-7.1.0-0.x86_64 MQSeriesRuntime-7.1.0-0.x86_64 MQSeriesSamples-7.1.0-0.x86_64 |
The dependencies of the installed components can be found by
rpm -q --requires MQSeriesServer MQSeriesRuntime = 7.1.0-0 |
· Uninstall by executing rpm command with “-ev” options as shown below
rpm -ev MQSeriesSamples MQSeriesServer MQSeriesRuntime |
You can reclaim the used space by deleting /var/mqm and its contents. Note that uninstalling the server/runtime does not remove the queue manager details, however if you delete the /var/mqm/ you will lose all queue manager data.
No comments:
Post a Comment