ActiveMQ 消息持久化到Mysql数据库
Posted 深海蓝精灵
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActiveMQ 消息持久化到Mysql数据库相关的知识,希望对你有一定的参考价值。
[[email protected] local]# tar -zxvf apache-activemq-5.15.8-bin.tar.gz
[[email protected] local]# mv apache-activemq-5.15.8 activemq
[[email protected] activemq]# cd conf/
[[email protected] conf]# pwd
/usr/local/activemq/conf
[[email protected] conf]# cp activemq.xml activemq.xml.bak
[[email protected] conf]# vim activemq.xml
<persistenceAdapter>
<!--<kahaDB directory="${activemq.data}/kahadb"/>-->
<jdbcPersistenceAdapter dataSource="#mysql-ds"/>
</persistenceAdapter>
<bean id="mysql-ds" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test_mq?relaxAutoCommit=true"/>
<property name="username" value="root"/>
<property name="password" value="2018"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
[[email protected] conf]# cd ..
[[email protected] activemq]# cd bin/linux-x86-64/
[[email protected] linux-x86-64]# ./activemq restart
Stopping ActiveMQ Broker...
Stopped ActiveMQ Broker.
Starting ActiveMQ Broker...
[[email protected] linux-x86-64]# systemctl stop firewalld
http://ip:8161/admin/
用户名和密码默认是:admin
以上是关于ActiveMQ 消息持久化到Mysql数据库的主要内容,如果未能解决你的问题,请参考以下文章
JMS服务器ActiveMQ的初体验并持久化消息到MySQL数据库中
JMS学习八(ActiveMQ的消息持久化到Mysql数据库)