activemq持久化之mysql配置

來源:互聯網
上載者:User

標籤:ant   lock   .com   儲存   磁碟機   empty   col   修改   tab   

參考:http://blog.csdn.net/zbw18297786698/article/details/52999940

說明:192.168.3.81 CentOS release 6.5 apache-activemq-5.10.1

 

1、拷貝mysql磁碟機到activemq環境下

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、建立儲存activemq訊息的資料庫

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、配置activemq.xml檔案

[[email protected] apache-activemq-5.10.1]# vim conf/activemq.xml

修改以下2個位置即可,

 

4、重啟activemq服務,查看日誌

[[email protected] apache-activemq-5.10.1]# ./bin/activemq start ;tail -f ./data/activemq.log

此時可能會有報錯,一般是設定檔格式(沒有空格)不對。

正常啟動後,進入資料,會產生3張表。

mysql> show tables;

| Tables_in_test_mq |

| ACTIVEMQ_ACKS |

| ACTIVEMQ_LOCK |

| ACTIVEMQ_MSGS |

mysql> select * from ACTIVEMQ_MSGS;

Empty set (0.00 sec)

此時這裡面都是沒有資料的。

 

5、測試資料

activemq發送資料,接收端暫不開啟,可以觀察到有記錄存在ACTIVEMQ_MSGS表中。

以下是測試發送20條記錄,不接收的情況

 

開啟接收,資料庫中將不會存在記錄值。

 

 

activemq持久化之mysql配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.