copyright | lastupdated | subcollection | keywords | ||
---|---|---|---|---|---|
|
2018-07-06 |
mqcloud |
admin, administration, cli, runmqsc, queue, manager |
{:new_window: target="_blank"} {:shortdesc: .shortdesc} {:screen: .screen} {:codeblock: .codeblock} {:pre: .pre}
{: #mqoc_admin_mqcli}
Part of the "MQ clients" bundle, runqmsc is a command-line interface (CLI) tool that allows you to automate the configuration of MQ queue managers by executing a series of pre-defined steps at the command-line or in a script file. It is supported on a range of operating systems including Windows and Linux (but is not currently supported on Mac OS).
There are many actions you can perform by using runmqsc from an MQ client. You can
- Connect to a queue manager
- Create a new queue
- Put a message onto a queue
- Get a message from a queue
- Delete a queue {:shortdesc}
{: #prereq_mqoc_admin_mqcli}
- An existing queue manager (for instructions, follow the creating a queue manager guide).
- You have been granted permissions to access queue managers within your IBM MQ service instance (for instructions, follow the configuring administrator access for a queue manager guide).
- An existing installation of IBM MQ Client on your own machine.
- Download the client from here.
- Clicking the HTTP link next to the latest available version of the CD Clients will take you to Fix Central. From there you can search for and select the appropriate Redist (redistributable) client bundle for your operating system platform. This will include the sample applications and runmqsc.
- Once downloaded, unpack the bundle into a location of your choosing.
- Make a note of the full path to the
bin
directory, the location of which will depend upon where you chose to unpack the bundle. This path will be referenced as<PATH_TO_BIN_DIR>
for the rest of this task. - Make a note of the full path to the directory containing the sample applications. This path will be referenced as
<PATH_TO_SAMPLE_BIN_DIR>
for the rest of this task.- For Windows, this will be the
bin
directory unpacked in the previous step, the location of which will depend upon where you chose to unpack the bundle. - For Linux, this will be the
samp/bin
directory unpacked in the previous step, the location of which will depend upon where you chose to unpack the bundle.
- For Windows, this will be the
{: #getdetails_mqoc_admin_mqexp}
- Log in to the IBM Cloud console.
- Click on the 'hamburger menu'.
- Click Dashboard.
- Ensure that RESOURCE GROUP is set to All Resources.
- Locate and click on your IBM MQ service instance, found under the 'Services' heading.
- From the list of your queue managers, click on the one you want to administer.
- Make note of the Queue manager name, Hostname and Port values for use in the next steps.
- If you already know your MQ Username and IBM Cloud API Key, you can skip to the next section of this task. Otherwise, Click the Administration tab.
- Make a note of your MQ Username for future use.
- Note that you can edit your MQ Username at any time by following the Editing or removing the MQ username for an existing user or application guide.
- If you do not already have an existing IBM Cloud API key:
- Click Create IBM Cloud API Key.
- Click Show to display the API key to copy and save it for later, or click Download to store the API key in a file.
- Note that the API key generated in these steps is used to authenticate with IBM Cloud as the user who created it. Therefore, it should not be shared with any other users and should be stored securely.
- An API key created through the IBM MQ service can be reset from the queue manager Administration tab.
- Click Close.
{: #connect_mqoc_admin_mqcli}
Note: Please ensure that you have carried out the prerequisite steps listed above.
- Open a command shell to use in the next steps.
- Export the 'MQSERVER' variable:
- Linux:
export MQSERVER="CLOUD.ADMIN.SVRCONN/TCP/<Hostname>(<Port>)"
- Windows (Command prompt):
set MQSERVER=CLOUD.ADMIN.SVRCONN/TCP/<Hostname>(<Port>)
- Windows (PowerShell):
$env:MQSERVER="CLOUD.ADMIN.SVRCONN/TCP/<Hostname>(<Port>)"
- Run
<PATH_TO_BIN_DIR>/runmqsc -c -u <your MQ username> -w60 <QUEUE_MANAGER_NAME>
- Enter your platform API key when prompted for a password.
{: #createq_mqoc_admin_mqcli}
Note: queue names should start with DEV.* (example: DEV.myQueue) as application users have been configured with access to this prefix only.
In the same shell used in the previous steps:
- Run
DEFINE QLOCAL (DEV.TEST.1)
- Run
DISPLAY QLOCAL(DEV.TEST.1)
- Details of queue 'DEV.TEST.1' are displayed.
- Run
end
- The runmqsc session is closed.
- Retain the prompt to use in the next steps.
{: #put_mqoc_admin_mqcli}
In the same shell used in the previous steps:
- Export the 'MQSAMP_USER_ID' variable:
- Linux:
export MQSAMP_USER_ID="<your MQ username>"
- Windows (Command prompt):
set MQSAMP_USER_ID=<your MQ username>
- Windows (PowerShell):
$env:MQSAMP_USER_ID="<your MQ username>"
- Run
<PATH_TO_SAMPLE_BIN_DIR>/amqsputc DEV.TEST.1 <your QMGR name>
- Enter your platform API key when prompted for a password.
- Type in a test message.
- Hit
Enter
twice to exit the amqsputc sample.
{: #get_mqoc_admin_mqcli}
In the same shell used in the previous steps:
- Run
<PATH_TO_SAMPLE_BIN_DIR>/amqsgetc DEV.TEST.1 <your QMGR name>
- Enter your platform API key when prompted for a password.
Your test message is displayed.
After a short period, the amqsputc sample program should end after finding no more messages.
{: #deleteq_mqoc_admin_mqcli}
In the same shell used in the previous steps:
- Run
<PATH_TO_BIN_DIR>/runmqsc -c -u <your MQ username> -w60 <QUEUE_MANAGER_NAME>
- Enter your platform API key when prompted for a password.
- Run
DELETE QLOCAL(DEV.TEST.1)
- You receive a message stating that the queue has been deleted.
- Run
DISPLAY QLOCAL(DEV.TEST.1)
to prove the queue has been deleted.
- You receive a message stating that the queue was not found.
- Run
end
- The runmqsc session is closed.
{: #conc_mqoc_admin_mqcli}
You've successfully:
- Connected to a queue manager using
runmqsc
and have created a new test queue - Used
amqsputc
to put a test message onto the test queue and have then usedamqsgetc
to get the test message - Deleted the test queue to clean up
{: #next_mqoc_admin_mqcli}