主机 集群端口 消息端口 管控台端口 节点安装目录
192.168.3.3 62621 51511 8161 /usr/local/actibemq
192.168.3.5 62621 51511 8161 /usr/local/actibemq
192.168.3.6 62621 51511 8161 /usr/local/actibemq
高可用:
Node-01 管控台端口:
修改conf/jetty.xml
<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="8161"/> </bean>
Node-02 管控台端口:
<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="8161"/> </bean>
Node-03 管控台端口:
<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="8161"/> </bean>
在 3 个 ActiveMQ 节点中配置 conf/activemq.xml 中的持久化适配器。修改其中 bind、 zkAddress、hostname 和 zkPath。 注意: 每个 ActiveMQ 的 BrokerName 必须相同,否则不能加入集群。
Node-01 中的持久化配置:
修改 conf/activemq.xml
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="DubboEdu" dataDirectory="${activemq.data}"> <persistenceAdapter> <!-- kahaDB directory="${activemq.data}/kahadb"/ --> <replicatedLevelDB directory="${activemq.data}/leveldb" replicas="3" bind="tcp://0.0.0.0:62621" zkAddress="192.168.3.3:2181,192.168.3.5:2181,192.168.3.6:2181" hostname="edu-zk-01" zkPath="/activemq/leveldb-stores"/> </persistenceAdapter> </broker>
Node-02 中的持久化配置:
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="DubboEdu" dataDirectory="${activemq.data}"> <persistenceAdapter> <!-- kahaDB directory="${activemq.data}/kahadb"/ --> <replicatedLevelDB directory="${activemq.data}/leveldb" replicas="3" bind="tcp://0.0.0.0:62621" zkAddress="192.168.3.3:2181,192.168.3.5:2181,192.168.3.6:2181" hostname="edu-zk-02" zkPath="/activemq/leveldb-stores"/> </persistenceAdapter> </broker>
Node-03 中的持久化配置:
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="DubboEdu" dataDirectory="${activemq.data}"> <persistenceAdapter> <!-- kahaDB directory="${activemq.data}/kahadb"/ --> <replicatedLevelDB directory="${activemq.data}/leveldb" replicas="3" bind="tcp://0.0.0.0:62621" zkAddress="192.168.3.3:2181,192.168.3.5:2181,192.168.3.6:2181" hostname="edu-zk-03" zkPath="/activemq/leveldb-stores"/> </persistenceAdapter> </broker>
修改各节点的消息端口(注意,避免端口冲突):
Node-01 中的消息端口配置:
<transportConnectors> <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> <transportConnector name="openwire" uri="tcp://0.0.0.0:51511?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> </transportConnectors>
Node-02 中的消息端口配置:
<transportConnectors> <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> <transportConnector name="openwire" uri="tcp://0.0.0.0:51511?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> </transportConnectors>
Node-03 中的消息端口配置:
<transportConnectors> <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> <transportConnector name="openwire" uri="tcp://0.0.0.0:51511?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/> </transportConnectors>
负载均衡集群
<!--集群1连接集群2-->
<managementContext> <managementContext createConnector="false"/> </managementContext> 在下面加上: <networkConnectors> <networkConnector uri="static:(tcp://192.168.3.7:51511,tcp://192.168.3.8:51511,tcp://192.168.3.9:51511)" duplex="false"/> </networkConnectors>
集群2上作相应配置
<managementContext> <managementContext createConnector="false"/> </managementContext> 在下面加上: <networkConnectors> <networkConnector uri="static:(tcp://192.168.3.3:51511,tcp://192.168.3.5:51511,tcp://192.168.3.6:51511)" duplex="false"/> </networkConnectors>