Install and use MySQL in activemq 5.5 in centos 6

Source: Internet
Author: User

Copy the file from .tar.gz to the/home/software/Apache-activemq directory and run the following command:

 

# Cd/home/software/Apache-activemq

# Tar zxvf apache-activemq-5.5.0-bin .tar.gz

# Cp-A apache-activemq-5.5.0/usr/local/activemq

# Cd/usr/local/activemq

 

I use MySQL as the storage of messages. Modify/usr/local/activemq/CONF/activemq. XML as follows:

<! --

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. see the notice file distributed with this work for additional information regarding copyright ownership. the ASF licenses this file to you under the Apache license, version 2.0 (the "License"); you may not use this file license t in compliance with the license. you may obtain a copy of the license at htt P: // specify unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "as is" basis, without warranties or conditions of kinany, either express or implied. see the license for the specific language governing permissions and limitations under the license. --> <! -- Start snippet: Example --> <beans xmlns = "http://www.springframework.org/schema/beans" xmlns: AMQ = "http://activemq.apache.org/schema/core" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/a Ctivemq-core.xsd "> <! -- Allows us to use system properties as variables in this configuration file --> <Bean class = "org. springframework. beans. factory. config. propertyplaceholderconfigurer "> <property name =" locations "> <value> file :$ {activemq. base}/CONF/credentials. properties </value> </property> </bean> <Bean id = "mysql-ds" class = "org. Apache. commons. DBCP. basicdatasource" Destroy-method = "close"> <Property name = "driverclassname" value = "com. MySQL. JDBC. Driver"/> <Property name = "url" value = "JDBC: mysql: // localhost/activemq? Relaxautocommit = true "/> <Property name = "username" value = "root"/> <Property name = "password" value = "devterry"/> <Property name = "maxactive" value = "200"/> </bean> <! -- The <broker> element is used to configure the activemq broker. --> <broker xmlns = "http://activemq.apache.org/schema/core" brokername = "localhost" datadirectory = "$ {activemq. base}/Data "destroyapplicationcontextonstop =" true "> <! -- For better performances use VM cursor and small memory limit. For more information, see: http://activemq.apache.org/message-cursors.html also, if your producer is "hanging", it's probably due to producer flow control. for more information, see: http://activemq.apache.org/producer-flow-control.html --> <destinationpolicy> <policymap> <policyentries> <policyentry topic = ">" producerflowcontrol = "true" memorylimit = "1 MB"> <pendingsubscriberpolicy> <vmcursor/> </ PE Ndingsubscriberpolicy> </policyentry> <policyentry queue = ">" producerflowcontrol = "true" memorylimit = "1 MB"> <! -- Use VM cursor for better latency for more information, see: http://activemq.apache.org/message-cursors.html <pendingqueuepolicy> <vmqueuecursor/> </pendingqueuepolicy> --> </policyentry> </policyentries> </policymap> </destinationpolicy> <! -- The managementcontext is used to configure how activemq is exposed in JMX. by default, activemq uses the mbean server that is started by the JVM. for more information, see: http://activemq.apache.org/jmx.html --> <managementcontext createconnector = "false"/> </managementcontext> <! -- Configure message persistence for the broker. The default persistence mechanic is the kahadb store (identified by the kahadb tag). For more information, see: http://activemq.apache.org/persistence.html --> <! -- <Persistenceadapter> <kahadb directory = "$ {activemq. Base}/data/kahadb"/> </persistenceadapter> --> <Persistenceadapter> <jdbcpersistenceadapter datasource = "# mysql-ds"/> </persistenceadapter> <! -- The systemusage controls the maximum amount of space the broker will use before slowing down producers. for more information, see: http://activemq.apache.org/producer-flow-control.html <systemusage> <memoryusage Limit = "20 mb"/> </memoryusage> <storeusage Limit = "1 GB"/> </storeusage> <tempusage Limit = "100 Mbit/s"/> </tempusage> </systemusage> --> <! -- The transport connectors expose activemq over a given protocol to clients and other brokers. for more information, see: http://activemq.apache.org/configuring-transports.html --> <transportors ors> <transportctor name = "openwire" uri = "TCP: // 0.0.0.0: 61616 "/> </transportconnectors> </broker> <! -- Enable Web tracking les, rest and Ajax APIs and Demos it also supported des camel (with its Web Console), see $ {activemq_home}/CONF/camel. XML for more info Take A Look At $ {activemq_home}/CONF/jetty. XML for more details --> <import resource = "jetty. XML "/> </beans> <! -- End snippet: Example -->

Before starting, you need to create the database activemq and do not configure <property name = "poolpreparedstatements" value = "true"/> with reference to the activemq-jdbc.xml.

# Bin/activemq start

Open it in the browser: Send it to the message for testing. If the message can be sent normally, there should be no major problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.