`
longgangbai
  • 浏览: 7332222 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

ActiveMQ 持久化消息数据库信息

阅读更多

       最近有网友问我,ActiveMQ持久化的中表结构是什么,表需要人工创建吗?我告诉他们不需要,ActiveMQ会帮助我们生成的。只需要制定采用的数据库名称并,创建数据库即可。以为为ActiveMQ采用MySQL5.1持久化产生的SQL语句:

持久化的代码实现为:

http://topmanopensource.iteye.com/blog/1066383

持久化mysql数据库的3张表;

activemq_acks:ActiveMQ的签收信息。

activemq_lock:ActiveMQ的锁信息。

activemq_msgs:ActiveMQ的消息的信息

# MySQL-Front 5.1  (Build 4.2)

/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE */;
/*!40101 SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES */;
/*!40103 SET SQL_NOTES='ON' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS */;
/*!40014 SET FOREIGN_KEY_CHECKS=0 */;


# Host: localhost    Database: activemq
# ------------------------------------------------------
# Server version 5.1.40-community

DROP DATABASE IF EXISTS `activemq`;
CREATE DATABASE `activemq` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `activemq`;

#
# Source for table activemq_acks
#

DROP TABLE IF EXISTS `activemq_acks`;
CREATE TABLE `activemq_acks` (
  `CONTAINER` varchar(250) NOT NULL,
  `SUB_DEST` varchar(250) DEFAULT NULL,
  `CLIENT_ID` varchar(250) NOT NULL,
  `SUB_NAME` varchar(250) NOT NULL,
  `SELECTOR` varchar(250) DEFAULT NULL,
  `LAST_ACKED_ID` bigint(20) DEFAULT NULL,
  `PRIORITY` bigint(20) NOT NULL DEFAULT '5',
  PRIMARY KEY (`CONTAINER`,`CLIENT_ID`,`SUB_NAME`,`PRIORITY`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

#
# Dumping data for table activemq_acks
#

LOCK TABLES `activemq_acks` WRITE;
/*!40000 ALTER TABLE `activemq_acks` DISABLE KEYS */;
/*!40000 ALTER TABLE `activemq_acks` ENABLE KEYS */;
UNLOCK TABLES;

#
# Source for table activemq_lock
#

DROP TABLE IF EXISTS `activemq_lock`;
CREATE TABLE `activemq_lock` (
  `ID` bigint(20) NOT NULL,
  `TIME` bigint(20) DEFAULT NULL,
  `BROKER_NAME` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

#
# Dumping data for table activemq_lock
#

LOCK TABLES `activemq_lock` WRITE;
/*!40000 ALTER TABLE `activemq_lock` DISABLE KEYS */;
INSERT INTO `activemq_lock` VALUES (1,NULL,NULL);
/*!40000 ALTER TABLE `activemq_lock` ENABLE KEYS */;
UNLOCK TABLES;

#
# Source for table activemq_msgs
#

DROP TABLE IF EXISTS `activemq_msgs`;
CREATE TABLE `activemq_msgs` (
  `ID` bigint(20) NOT NULL,
  `CONTAINER` varchar(250) DEFAULT NULL,
  `MSGID_PROD` varchar(250) DEFAULT NULL,
  `MSGID_SEQ` bigint(20) DEFAULT NULL,
  `EXPIRATION` bigint(20) DEFAULT NULL,
  `MSG` longblob,
  `PRIORITY` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `ACTIVEMQ_MSGS_MIDX` (`MSGID_PROD`,`MSGID_SEQ`),
  KEY `ACTIVEMQ_MSGS_CIDX` (`CONTAINER`),
  KEY `ACTIVEMQ_MSGS_EIDX` (`EXPIRATION`),
  KEY `ACTIVEMQ_MSGS_PIDX` (`PRIORITY`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

#
# Dumping data for table activemq_msgs
#

LOCK TABLES `activemq_msgs` WRITE;
/*!40000 ALTER TABLE `activemq_msgs` DISABLE KEYS */;
INSERT INTO `activemq_msgs` VALUES (1,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',1,0,X'0000010C1C0000000501017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000001000000000000000400000000000000010000000000000000040000000130450E28660001000000120000000E74657374206D657373616765203100000000000000000000000000000000000000000000000130450E28950000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (2,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',2,0,X'0000010C1C0000000601017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000002000000000000000500000000000000010000000000000000040000000130450E29020001000000120000000E74657374206D657373616765203200000000000000000000000000000000000000000000000130450E29020000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (3,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',3,0,X'0000010C1C0000000701017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000003000000000000000600000000000000010000000000000000040000000130450E29310001000000120000000E74657374206D657373616765203300000000000000000000000000000000000000000000000130450E29310000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (4,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',4,0,X'0000010C1C0000000801017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000004000000000000000700000000000000010000000000000000040000000130450E29500001000000120000000E74657374206D657373616765203400000000000000000000000000000000000000000000000130450E29500000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (5,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',5,0,X'0000010C1C0000000901017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000005000000000000000800000000000000010000000000000000040000000130450E298F0001000000120000000E74657374206D657373616765203500000000000000000000000000000000000000000000000130450E298F0000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (6,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',6,0,X'0000010C1C0000000A01017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000006000000000000000900000000000000010000000000000000040000000130450E29AE0001000000120000000E74657374206D657373616765203600000000000000000000000000000000000000000000000130450E29AE0000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (7,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',7,0,X'0000010C1C0000000B01017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000007000000000000000A00000000000000010000000000000000040000000130450E29ED0001000000120000000E74657374206D657373616765203700000000000000000000000000000000000000000000000130450E29ED0000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (8,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',8,0,X'0000010C1C0000000C01017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000008000000000000000B00000000000000010000000000000000040000000130450E2A0C0001000000120000000E74657374206D657373616765203800000000000000000000000000000000000000000000000130450E2A0C0000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (9,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',9,0,X'0000010C1C0000000D01017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A31000000000000000100000000000000010000000000000009000000000000000C00000000000000010000000000000000040000000130450E2A2B0001000000120000000E74657374206D657373616765203900000000000000000000000000000000000000000000000130450E2A2B0000000000000000',4);
INSERT INTO `activemq_msgs` VALUES (10,'queue://ActiveMQ.QUEUE','ID:EASYWAY-SYSDEPARTMENT-1198-1306828613359-2:1:1:1',10,0,X'0000010D1C0000000E01017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001016401000E4163746976654D512E51554555450000016E017B01002F49443A454153595741592D5359534445504152544D454E542D313139382D313330363832383631333335392D323A3100000000000000010000000000000001000000000000000A000000000000000D00000000000000010000000000000000040000000130450E2A3B0001000000130000000F74657374206D65737361676520313000000000000000000000000000000000000000000000000130450E2A3B0000000000000000',4);
/*!40000 ALTER TABLE `activemq_msgs` ENABLE KEYS */;
UNLOCK TABLES;

/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

 

分享到:
评论

相关推荐

    activemq持久化jdbc所需jar包.zip

    标题中的"activemq持久化jdbc所需jar包.zip"指的是Apache ActiveMQ消息中间件在使用JDBC(Java Database Connectivity)进行消息持久化时所需的库文件集合。ActiveMQ是一款开源、高性能、跨语言的企业级消息代理,它...

    activeMQ mysql 持久化

    标题中的“ActiveMQ MySQL 持久化”指的是在使用ActiveMQ消息中间件时,将消息数据存储到MySQL数据库中以实现数据的持久化。ActiveMQ是Apache软件基金会的一个开源项目,它是一个功能丰富的消息代理,支持多种消息...

    linux环境下ActiveMQ持久化、集群环境搭建详解

    ActiveMQ 持久化是指将消息队列持久化到数据库或文件中,以便在断电或崩溃后恢复消息队列。可以使用 Apache ActiveMQ 的持久化机制,例如使用 KahaDB 或 AMQP 等。 集群环境 ActiveMQ 集群环境是指多个 ActiveMQ ...

    ActiveMQ的持久化(数据库)[归类].pdf

    4. **持久化级别**:ActiveMQ 允许用户选择不同的消息持久化级别,例如,可以选择仅持久化消息头,或者同时持久化消息头和正文。这可以根据性能和数据完整性需求进行调整。 5. **事务管理**:在 ActiveMQ 中,可以...

    activemq消息持久化所需Jar包

    3. **数据库连接驱动**:ActiveMQ支持多种持久化策略,其中一种是使用关系型数据库(如MySQL、PostgreSQL)来存储消息。因此,根据你选择的数据库,需要引入相应的数据库驱动Jar包,例如`mysql-connector-java.jar`...

    ActiveMQ配置Mysql8为持久化方式所需Jar包.rar

    - ActiveMQ允许用户选择不同的持久化机制,包括文件系统(KahaDB)和关系数据库(如MySQL)。 - 持久化确保了消息在服务器崩溃或重启时不会丢失,增强了系统的可靠性。 2. **配置MySQL8**: - 首先,你需要在...

    activemq-5.15.15 JDBC持久化mysql8.0+的activemq.xml.pdf

    总结来说,这个配置文件展示了如何配置ActiveMQ 5.15.15使用JDBC和MySQL 8.0+进行消息持久化,以及解决XML中特殊字符转义的问题,以确保ActiveMQ能够正确地连接并使用MySQL数据库存储和检索消息。这种配置适用于需要...

    spring集成activemq演示queue和topic 持久化

    你可以通过修改`activemq.xml`配置文件来设置持久化存储,比如将消息存储到MySQL数据库。在配置中指定数据源,如下所示: ```xml ${activemq.data} <driverClassName>...

    activeMQ使用JDBC所需要的jar包

    在ActiveMQ中,为了实现消息持久化,我们通常会利用JDBC(Java Database Connectivity)来存储消息数据。这确保了即使在服务器重启或故障后,消息依然能够被恢复,从而保持系统的高可用性和可靠性。本主题将详细讲解...

    自己写的ActiveMQ的Demo例子

    2. **持久化到数据库**:为了提高可靠性,ActiveMQ 还可以配置为将消息存储在关系型数据库(如 MySQL 或 PostgreSQL)中。同样,这需要在 `activemq.xml` 配置文件中进行设置,包括连接数据库的详细信息以及具体的...

    ActiveMQ消息服务器 v6.0.1.zip

    同时,它提供多种持久化机制,如文件系统、数据库存储,确保即使在服务中断后也能恢复消息。 5. 安全性:ActiveMQ内置了用户认证和授权机制,可以通过SSL/TLS加密传输,保障数据的安全性。 二、ActiveMQ应用场景 1....

    Active mq jdbc持久化所需要的包.rar

    总之,"Active mq jdbc持久化所需要的包.rar"提供了使用MySQL数据库进行ActiveMQ消息持久化的必要组件。正确配置并使用这些组件,可以在保持消息可靠性的同时,利用数据库的优势来管理和保护消息数据。

    3.1 JDBC消息存储持久化jdbc persistenceFactory高速缓存1

    在ActiveMQ中,消息持久化和高速缓存是两个关键概念,它们确保了即使在服务器重启或网络故障等情况下,消息仍然能够被正确地存储和检索。本篇将详细讲解如何利用JDBC实现ActiveMQ的消息存储持久化以及高速缓存。 1....

    ActiveMQ消息服务器 v5.17.6.zip

    2. **持久化机制**:ActiveMQ提供基于文件的持久化,确保即使在服务器重启后,消息也不会丢失。此外,还支持JDBC和JPA等数据库持久化,增强系统的可靠性。 3. **高可用性**:通过集群和复制策略,ActiveMQ可以实现...

    最新稳定版ActiveMQ5.15.0

    8. **持久化机制**:ActiveMQ支持多种持久化机制,包括本地文件系统、LevelDB、JDBC数据库等,可以根据需求选择适合的策略。 9. **消息优先级**:在某些应用场景中,消息的优先级是重要的。ActiveMQ允许为消息分配...

    activemq-oracle.rar

    描述中提到的“ActiveMQ持久化所需jar包”意味着这些jar文件是用于确保ActiveMQ的消息持久化的关键组件。持久化是确保即使在系统崩溃或断电后,消息仍然能够被正确处理的重要特性。以下是每个jar文件的功能: 1. **...

    activemq-5.15+mysqljdbc配置.zip

    总结来说,"activemq-5.15+mysqljdbc配置.zip"提供了ActiveMQ的一个定制化版本,它集成了MySQL数据库作为持久化存储,并使用Durid作为连接池。这种配置适用于那些需要强大数据持久化和恢复能力的场景,但也需要对...

    ActiveMQ的activemq.xml详细配置讲解

    对于与数据库的集成,如`activemq数据库,验证持久化标准配置.txt`所示,ActiveMQ支持使用JDBC进行持久化,确保在故障恢复时数据的完整性。 总之,`activemq.xml`配置文件是管理ActiveMQ核心行为的核心,通过细致地...

    ActiveMQ Master/Slave 主从配置

    配置Master/Slave环节中,需要修改ActiveMQ配置文件activemq.xml,在其中添加数据源配置,并调整persistenceAdapter的设置以适应JDBC方式的持久化。配置文件修改完成后,需要将修改后的配置文件复制到另一台虚拟机的...

Global site tag (gtag.js) - Google Analytics