Verifying a server-to-server installation using the command line

You 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.
  • 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

This procedure provides instructions for Windows, UNIX and Linux® systems only.

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

  1. On the receiver server:
    1. If the receiver server is a UNIX or Linux system, log in as a user in the mqm group.
    2. 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 h. 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.

    3. Set up the environment for the installation you are using by entering one of the following commands at the command prompt:
      • On Windows:
        
         MQ_INSTALLATION_PATH\bin\setmqenv -s
        
        where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.
      • On UNIX and Linux systems:
        
        . MQ_INSTALLATION_PATH/bin/setmqenv -s
        
        where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.
    4. Create a queue manager called QMB by entering the following command at the command prompt:
      
      crtmqm QMB
      
      Messages tell you that the queue manager has been created, and that the default IBM MQ objects have been created.
    5. Start the queue manager by entering the following command:
      
      strmqm QMB
      
      A message tells you when the queue manager has started.
    6. Start MQSC by entering the following command:
      
      runmqsc QMB
      
      A message tells you that MQSC has started. MQSC has no command prompt.
    7. 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.
    8. 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.
    9. 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.
    10. 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.
    11. End MQSC by typing:
      
      end
      
      Some messages are displayed, followed by the command prompt.
  2. On the sender server:
    1. If the sender server is a UNIX or Linux system, log in as a user in the mqm group.
    2. Set up the environment for the installation you are using by entering one of the following commands at the command prompt:
      • On Windows:
        
         MQ_INSTALLATION_PATH\bin\setmqenv -s
        
        where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.
      • On UNIX and Linux systems:
        
        . MQ_INSTALLATION_PATH/bin/setmqenv -s
        
        where MQ_INSTALLATION_PATH refers to the location where IBM MQ is installed.
    3. Create a queue manager called QMA by entering the following command at the command prompt:
      
      crtmqm QMA
      
      Messages tell you that the queue manager has been created, and that the default IBM MQ objects have been created.
    4. Start the queue manager, by entering the following command:
      
       strmqm QMA
      
      A message tells you when the queue manager has started.
    5. Start MQSC by entering the following command:
      
       runmqsc QMA
      
      A message tells you that an MQSC session has started. MQSC had no command prompt.
    6. 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.
    7. Define a local definition of the remote queue with by entering the following command:
      DEFINE QREMOTE (LOCAL.DEF.OF.REMOTE.QUEUE) RNAME (RECEIVER.Q) 
      RQMNAME ('QMB') XMITQ (QMB)
      
    8. Define a sender channel by entering one of the following commands:
      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 b. If you do not specify a port, the default value of 1414 is used.
      DEFINE CHANNEL (QMA.QMB) CHLTYPE (SDR) 
      CONNAME ('CON-NAME(PORT)') XMITQ (QMB) TRPTYPE (TCP)
      
    9. 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.
    10. Stop MQSC by entering the following command:
      
      end
      
      Some messages are displayed, followed by the command prompt.
    11. If the sender server is a UNIX or Linux system, change into the MQ_INSTALLATION_PATH/samp/bin directory. This directory contains the sample programs. MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.
    12. 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 installation
      
      If 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.
    13. Put a message on the local definition of the remote queue, which in turn specifies the name of the remote queue. Enter one of the following commands:
      • On Windows:
        
        amqsput LOCAL.DEF.OF.REMOTE.QUEUE QMA
        
      • On UNIX and Linux systems:
        
        ./amqsput LOCAL.DEF.OF.REMOTE.QUEUE QMA
        
      A message tells you that amqsput has started.
    14. 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.
  3. On the receiver server:
    1. If your receiver server is a UNIX or Linux system, change into the MQ_INSTALLATION_PATH/samp/bin directory. This directory contains the sample programs. MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.
    2. Get the message from the queue on the receiver by entering one of the following commands:
      • On Windows:
        
        amqsget RECEIVER.Q QMB
        
      • On UNIX and Linux systems:
        
        ./amqsget RECEIVER.Q QMB
        
      The 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.