一、在同一台機器上配置多個ActiveMQ(版本apache-activemq-5.4.2)
1.複制一份運作檔案
cp -r apache-activemq-5.4.2 apache-activemq-5.4.2-new
2.修改配置檔案activemq.xml
vi activemq.xml
a)brokerName不能和原來的重複,修改brokerName="activemq-new"
b)資料存放的檔案名稱不能重複,修改kahaDB directory="${activemq.data}/kahadb-new"
c)所有涉及的transportConnector的端口,都要和原來的不一樣。注意不要超出端口的範圍(0-65535)
[html] view plain copy
- <transportConnectors>
- <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
- <transportConnector name="openwire" uri="tcp://0.0.0.0:62626?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
- <transportConnector name="amqp" uri="amqp://0.0.0.0:5772?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
- <transportConnector name="stomp" uri="stomp://0.0.0.0:62623?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
- <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1993?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
- <transportConnector name="ws" uri="ws://0.0.0.0:62624?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
- </transportConnectors>
3.修改配置檔案jetty.xml
vim jetty.xml
a)管理頁面端口不能重複,把裡面的預設端口号8161改成别的,如8262
[html] view plain copy
- <bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
- <!-- the default port number for the web console -->
- <property name="host" value="0.0.0.0"/>
- <property name="port" value="8262"/>
- </bean>
4.到bin下面,複制一個activemq
cp -r activemq activemq-new
vim activemq-new
a)修改程式的id,不能和原來的重複,ACTIVEMQ_PIDFILE="$ACTIVEMQ_DATA/activemq-new.pid"
b)修改配置檔案路徑ACTIVEMQ_CONF="$ACTIVEMQ_BASE/conf-new"
cp -r env env-new
vim env-new
修改Activemq操作端口
if [ -z "$ACTIVEMQ_QUEUEMANAGERURL" ]; then
ACTIVEMQ_QUEUEMANAGERURL="--amqurl tcp://localhost:62626"
fi
c)修改bin/activemq-new可執行檔案 對env的引用改成env-new
ACTIVEMQ_CONFIGS="/etc/default/activemq $HOME/.activemqrc $ACTIVEMQ_HOME/bin/env-new"
5.啟動ActiveMQ
cd apache-activemq-5.12.1/bin
./activemq-new start
6.檢視ActiveMQ啟動狀态
./activemq-new status
7.通過管理頁面通路
http://ip:8262/admin
轉自:http://47.98.145.144/notes/html/0d4ab1e56ace4d249e454a9a7ffa5b58.html