IBM Support

Change default ports of activemq.

Question & Answer


Question

How to change the default ports for activemq 8161 and 61616?

Answer

ActiveMQ is an open source message broker written in Java together with a full Java Message Service(JMS) client. It provides "Enterprise Features" which in this case means fostering the communication from more than one client or server. It's a messaging queue for internal component communication.

Sometimes we may want to use the ports, used by activemq, for any other application.

Here are the steps to change the default activemq ports :

1. Changing port 61616 :

a. Stop activemq and pcmd service
# egosh service stop ACTIVEMQ PCMD

b. Change the port number in /opt/pcm/activemq/conf/activemq.xml, line 122-125 :


122 <transportConnectors>
123 <transportConnector name="openwire" uri="tcp://0.0.0.0:51616"/> --> this line, the default port number is 61616
124 </transportConnectors>
The value should be bigger than 1024 and less than 65535, and please ensure the port is not in use.

c. change the port number in /opt/pcm/pcmd/conf/pcmdConfig.xml, line 19 :
19 <Parameter desc="Port to connect to message broker. Must match the port defined for the message broker. Changing this requries a restart of the pcmd service" name=" messageBroker.port">51616</Parameter> --> default is 61616

d. Start activemq and pcmd
# egosh service start ACTIVEMQ PCMD

e. Check pcmd and activemq :
# egosh service list

2. Changing port 8161 (though we strongly suggest not to change it) :

a. Stop WEBGUI, PCMD, ACTIVEMQ
# egosh service stop WEBGUI PCMD ACTIVEMQ

b. Change activemq NIO port 8161 to another one in the below file.
# grep 8161 /opt/pcm/activemq/conf/jetty.xml -A 3 -B 2
<list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<!--<property name="port" value="8161" />--> --> comment out old line and change it to 23456
<property name="port" value="23456" />
</bean>
</list>

c. Start webgui,activemq and pcmd services, check their service status and log file.


# egosh service start ACTIVEMQ PCMD WEBGUI

3. Activemq choose a random and non provilege port, which is used to communicate with already connected clients. You can not change it manually.

[{"Product":{"code":"SSZUCA","label":"IBM Spectrum Cluster Foundation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Misc","Platform":[{"code":"PF016","label":"Linux"}],"Version":"4.2","Edition":"Standard","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Product":{"code":"SSZUCA","label":"IBM Spectrum Cluster Foundation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":null,"Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 September 2018

UID

isg3T1022654