Verifying a server-to-server installation using the command line on Windows
We can verify a server-to-server installation using two servers, one as a sender and one as a receiver.
Before you begin
- Make sure that TCP/IP and IBM MQ are installed on both servers (see Verifying a server-to-server installation on Windows).
- Make sure that you are a member of the IBM MQ administrators group (mqm) on each server.
- Decide which installation is the sender server and which installation is the receiver server. The installations might be on the same system, or on different systems.
About this task
IBM MQ object definitions are case-sensitive. Any text entered as an MQSC command in lowercase is converted automatically to uppercase unless you enclose it in single quotation marks. Make sure that you type the examples exactly as shown.
Procedure
- On the receiver server:
- Check which ports are free, for example by running netstat. For more information about this command, see the documentation of your operating system.
If port 1414 is not in use, make a note of 1414 to use as the port number in step 2 g. Use the same number for the port for your listener later in the verification. If it is in use, note a port that is not in use; for example 1415.
- Set up the environment for the installation you are using by entering the following command at the command prompt:
MQ_INSTALLATION_PATH\bin\setmqenv -swhere MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.- Create a queue manager called QMB by entering the following command at the command prompt:
crtmqm QMBMessages tell you that the queue manager has been created, and that the default IBM MQ objects have been created.- Start the queue manager by entering the following command:
strmqm QMBA message tells you when the queue manager has started.- Start MQSC by entering the following command:
runmqsc QMBA message tells you that MQSC has started. MQSC has no command prompt.- Define a local queue called RECEIVER.Q by entering the following command:
DEFINE QLOCAL (RECEIVER.Q)A message tells you the queue has been created.- Define a listener by entering the following command:
DEFINE LISTENER (LISTENER1) TRPTYPE (TCP) CONTROL (QMGR) PORT ( PORT_NUMBER )Where port_number is the name of the port the listener runs on. This number must be the same as the number used when defining your sender channel.- Start the listener by entering the following command:
START LISTENER (LISTENER1)Note: Do not start the listener in the background from any shell that automatically lowers the priority of background processes.- Define a receiver channel by entering the following command:
DEFINE CHANNEL (QMA.QMB) CHLTYPE (RCVR) TRPTYPE (TCP)A message tells you when the channel has been created.- End MQSC by typing:
endSome messages are displayed, followed by the command prompt.- On the sender server:
- Set up the environment for the installation you are using by entering the following command at the command prompt:
MQ_INSTALLATION_PATH\bin\setmqenv -swhere MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.- Create a queue manager called QMA by entering the following command at the command prompt:
crtmqm QMAMessages tell you that the queue manager has been created, and that the default IBM MQ objects have been created.- Start the queue manager, by entering the following command:
strmqm QMAA message tells you when the queue manager has started.- Start MQSC by entering the following command:
runmqsc QMAA message tells you that an MQSC session has started. MQSC had no command prompt.- Define a local queue called QMB (to be used as a transmission queue) by entering the following command:
DEFINE QLOCAL (QMB) USAGE (XMITQ)A message tells you when the queue has been created.- Define a local definition of the remote queue by entering the following command:
DEFINE QREMOTE (LOCAL.DEF.OF.REMOTE.QUEUE) RNAME (RECEIVER.Q) RQMNAME ('QMB') XMITQ (QMB)- Define a sender channel by entering the following command:
DEFINE CHANNEL (QMA.QMB) CHLTYPE (SDR) CONNAME ('CON-NAME(PORT)') XMITQ (QMB) TRPTYPE (TCP)con-name is the TCP/IP address of the receiver system. If both installations are on the same system, the con-name is localhost. port is the port you noted in 1 a. If we do not specify a port, the default value of 1414 is used.
- Start the sender channel by entering the following command:
START CHANNEL(QMA.QMB)The receiver channel on the receiver server starts automatically when the sender channel starts.- Stop MQSC by entering the following command:
endSome messages are displayed, followed by the command prompt.- If both the sender server and receiver server are installations on the same system, check that the queue managers have been created on different installations by entering the following command:
dspmq -o installationIf the queue managers are on the same installation, move either QMA to the sender installation or QMB to the receiver installation by using the setmqm command. For more information, see setmqm.- Put a message on the local definition of the remote queue, which in turn specifies the name of the remote queue. Enter the following command:
amqsput LOCAL.DEF.OF.REMOTE.QUEUE QMAA message tells you that amqsput has started.- Type some message text on one or more lines, followed by a blank line. A message tells you that amqsput has ended. Your message is now on the queue and the command prompt is displayed again.
- On the receiver server:
- Get the message from the queue on the receiver by entering the following command:
amqsget RECEIVER.Q QMBThe sample program starts, and your message is displayed. After a pause, the sample ends. Then the command prompt is displayed.
Results
You have now successfully verified the server-to-server installation.