ActiveMQ Part 1: Basic Installation configuration (Windows version)

Source: Internet
Author: User
Tags stomp

1. Install the start-up service

A) First download and install the latest JDK (this article uses: Jdk-8u66-windows-x64.exe)

B) Download the latest installation package from the official website (this download version is: http://activemq.apache.org/activemq-5143-release.html)

C) after unpacking the installation package, locate it in the Decompression directory: \bin\win64\activemq.bat (32-bit machine executes the corresponding Activemq.bat file in the Win32 directory)

Running Activemq.bat as Administrator, the ACTIVEMQ service has been successfully launched with the following complete interface;

Open a browser to access ActiveMQ WEB Management console: http://localhost:8161/admin/(default login username password: admin/admin)

2. Basic Configuration

A) Enable Debug logging (easy to install configuration process to find more detailed questions): Open \conf\log4j.properties, add: Log4j.logger.org.apache.activemq=debug in File, Restart the console program to take effect;

This will output the DEBUG type log in the log.

B) WEB Console permissions configuration: Open the \conf\jetty-realm.properties file, you can modify the role, user name, password, or add the user, after the change to restart the console to take effect;

1 # defines users that can access the Web (console, demo, etc.) 2 [, rolename ... ]3 admin:admin, admin4 user:user, user
View Code

According to management needs, self-configuration, this article is configured to follow the following use.

1 # defines users that can access the Web (console, demo, etc.) 2 [, rolename ... ]3 webadmin:web.admin, admin4 webuser1:user.1, user5 WEBUSER2:USER.2, user
View Code

C) Configure the Boot protocol: default all ActiveMQ supported protocols will be started, this article mainly launches the MQTT protocol, open file: \conf\activemq.xml;

Locate the following configuration and remove or comment out the other protocols above, leaving only the MQTT protocol;

1  <!--2 The transport connectors expose ActiveMQ over a given protocol to3 clients and other brokers. For more information, see:4 5 http://activemq.apache.org/configuring-transports.html6          -7         <transportconnectors>8             <!--DOS Protection, limit concurrent connections to $ and frame size to 100MB -9             <Transportconnectorname= "Openwire"URI= "tcp://0.0.0.0:61616?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/>Ten             <Transportconnectorname= "AMQP"URI= "amqp://0.0.0.0:5672?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> One             <Transportconnectorname= "Stomp"URI= "stomp://0.0.0.0:61613?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> A             <Transportconnectorname= "Mqtt"URI= "mqtt://0.0.0.0:1883?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> -             <Transportconnectorname= "ws"URI= "ws://0.0.0.0:61614?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> -         </transportconnectors>
View Code

D) MQTT protocol settings: ActiveMQ initiates the monitoring service based on the protocol configured above, and can enrich the functionality of the MQTT protocol by adding the following configuration;

maximumconnections=1000&wireformat.maxframesize=104857600: to prevent DOS attacks, concurrent connections and maximum transmission capacity limits (Maximum capacity: 256MB);

transport.defaultkeepalive=60000: Configure the default heartbeat of the server, the default is: If the client's heartbeat time is 10s, the service side of the detection time for the connection is: 10*1.5=15s;

Allowlinkstealing=false: If there are two or more connections using the same cilentid, it is considered hotlinking; the server forces the old connection to be closed (the following information can be seen from the log)

WARN | stealing link for clientId PUBSameID-001 from Connection

transport.activemqsubscriptionprefetch=100: If the processing power of the Subscriber is strong, the higher the value, the better, that is, the server will be pre-fetching how much message to the subscriber;

This setting needs to evaluate the minimum processing power of the subscriber and configure it according to the server performance;

The following 4 configurations are the best configurations for many cases:

wireformat.maxinactivityduration=30000: If the server does not receive a message from a connection within 30s, the connection is automatically disconnected;

wireformat.maxinactivitydurationinitaldelay=10000: Specifies the inactive link monitor (InactivityMonitor)" 在多长时间后启动,在需要并发创建许多连接场景非常有效;

transport.useinactivitymonitor=true: enable "Inactive link Monitor", if set to False, the server does not monitor "inactive connection";

transport.usekeepalive=true: If set to False, the server is not forced to close the connection when the data is confiscated outside the heartbeat time;

OK, common configuration to this end, start the AMQ service to start using.

1 <transportConnectors>2<!--DOS protection, limit concurrent connections to 1000and frame size to 100MB --3<transportconnector name= "Mqtt" uri= "mqtt://0.0.0.0:1883?maximumconnections=1000&amp; Wireformat.maxframesize=104857600&amp;transport.defaultkeepalive=60000&amp;allowlinkstealing=false &amp;transport.activeMQSubscriptionPrefetch=100&amp;wireFormat.maxInactivityDuration=30000&amp; wireformat.maxinactivitydurationinitaldelay=10000&amp;transport.useinactivitymonitor=true&amp; Transport.usekeepalive=true "/>4<!--<transportconnector name= "Openwire" uri= "tcp://0.0.0.0:61616?maximumconnections=1000&amp; wireformat.maxframesize=104857600 "/>-->5<!--<transportconnector name= "AMQP" uri= "amqp://0.0.0.0:5672?maximumconnections=1000&amp; wireformat.maxframesize=104857600 "/>-->6<!--<transportconnector name= "Stomp" uri= "stomp://0.0.0.0:61613?maximumconnections=1000&amp; wireformat.maxframesize=104857600 "/>-->7<!--<transportconnector name= "ws" Uri= "ws://0.0.0.0:61614?maximumconnections=1000&amp; wireformat.maxframesize=104857600 "/>-->8</transportConnectors>
View Code

ActiveMQ Part 1: Basic Installation configuration (Windows version)

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.