Reference: http://blog.csdn.net/zbw18297786698/article/details/52999940
Description: 192.168.3.81 CentOS release 6.5 apache-activemq-5.10.1
1. Copy the MySQL drive to the ACTIVEMQ environment
Mysql-connector-java-5.1.44-bin.jar
[Email protected] apache-activemq-5.10.1]# ls/home/apache-activemq-5.10.1/lib/ Mysql-connector-java-5.1.44-bin.jar
2. Create a database that holds ACTIVEMQ messages
mysql> CREATE DATABASE test_mq DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
mysql> flush Privileges;
Mysql> Grant all privileges on * * to ' root ' @ ' 192.168.%.% ' identified by '!w2 ';
3. Configuring the Activemq.xml File
[Email protected] apache-activemq-5.10.1]# vim Conf/activemq.xml
Modify the following 2 locations to
4. Restart the ACTIVEMQ service to view the log
[[email protected] apache-activemq-5.10.1]#/bin/activemq start; tail-f./data/activemq.log
At this point, there may be an error, usually the configuration file format (no spaces) is incorrect.
After normal startup, entering the data will result in 3 tables.
Mysql> Show tables;
| TABLES_IN_TEST_MQ |
| Activemq_acks |
| Activemq_lock |
| Activemq_msgs |
Mysql> select * from Activemq_msgs;
Empty Set (0.00 sec)
At this point there is no data in this area.
5. Test data
ACTIVEMQ send data, the receiving end is not open, you can observe that there is a record exists in the ACTIVEMQ_MSGS table.
The following is a test sent 20 records, not receiving the situation
The record value will not be present in the database when the receive is turned on.
ACTIVEMQ Persistent MySQL Configuration