一、安装
Apache ActiveMQ ™ is the most popular and powerful open source messaging and Integration Patterns server.
Apache ActiveMQ is fast, supports many Cross Language Clients and Protocols, comes with easy to use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License
[root@master ~]# cd /opt
[root@master opt]# ls -l
total 133244
drwxr-xr-x 9 52583 users 4096 Mar 28 2015 alibaba-rocketmq
-rw-r--r-- 1 root root 11830603 Oct 13 06:14 alibaba-rocketmq-3.2.6.tar.gz
-rw-r--r-- 1 root root 47362127 Nov 1 04:02 apache-activemq-5.8.0-bin.tar.gz
-rw-r--r-- 1 root root 2253345 Jan 4 2016 cacti-0.8.8b.tar.gz
drwxr-xr-x 7 root root 4096 Nov 24 2015 flume1.6
drwxr-xr-x 7 root root 4096 Nov 23 2015 grafana-2.5.0
-rw-r--r-- 1 root root 23029152 Nov 22 2015 grafana-2.5.0.linux-x64.tar.gz
drwxr-xr-x 16 root root 4096 Dec 8 2015 hadoop
drwxr-xr-x 3 root root 4096 Dec 8 2015 hadoop_data
drwxr-xr-x 12 hadoop hadoop 4096 Jan 4 2016 httpd-2.2.23
-rw-r--r-- 1 root root 7374712 Sep 11 2012 httpd-2.2.23.tar.gz
drwxr-xr-x 8 nagios games 4096 Jan 1 2016 libevent-1.4.14b-stable
-rw-r--r-- 1 root root 474874 Jun 20 2010 libevent-1.4.14b-stable.tar.gz
drwxrwxr-x 7 1000 1000 4096 Jan 1 2016 memcached
-rw-r--r-- 1 root root 359709 Nov 19 2015 memcached-1.4.25.tar.gz
drwxr-xr-x 5 hadoop hadoop 4096 Jan 3 2016 mongodb
-rw-r--r-- 1 root root 25376376 Nov 9 2015 mongodb-linux-x86_64-1.6.3.tgz
drwxrwxr-x 16 nagios nagios 4096 Jan 4 2016 nagios
-rw-r--r-- 1 root root 1784746 Nov 30 2012 nagios-3.4.3.tar.gz
drwxrwxrwx 16 10002 10002 4096 Jan 4 2016 nagios-plugins-1.4.13
-rw-r--r-- 1 root root 2279556 Dec 25 2015 nagios-plugins-1.4.13.tar.gz
drwxr-xr-x 17 nagios games 4096 Jan 23 2016 php-5.4.10
-rw-r--r-- 1 root root 14053991 Dec 25 2015 php-5.4.10.tar.gz
drwxr-xr-x 9 root root 4096 Jan 19 2016 tomcat
[root@master opt]# tar -zxvf apache-activemq-5.8.0-bin.tar.gz
[root@master opt]# ls
alibaba-rocketmq cacti-0.8.8b.tar.gz hadoop libevent-1.4.14b-stable mongodb nagios-plugins-1.4.13 tomcat
alibaba-rocketmq-3.2.6.tar.gz flume1.6 hadoop_data libevent-1.4.14b-stable.tar.gz mongodb-linux-x86_64-1.6.3.tgz nagios-plugins-1.4.13.tar.gz
apache-activemq-5.8.0 grafana-2.5.0 httpd-2.2.23 memcached nagios php-5.4.10
apache-activemq-5.8.0-bin.tar.gz grafana-2.5.0.linux-x64.tar.gz httpd-2.2.23.tar.gz memcached-1.4.25.tar.gz nagios-3.4.3.tar.gz php-5.4.10.tar.gz
[root@master opt]# cd a
alibaba-rocketmq/ alibaba-rocketmq-3.2.6.tar.gz apache-activemq-5.8.0/ apache-activemq-5.8.0-bin.tar.gz
[root@master opt]# cd apache-activemq-5.8.0
[root@master apache-activemq-5.8.0]# ls
activemq-all-5.8.0.jar bin conf data docs example lib LICENSE NOTICE README.txt user-guide.html webapps webapps-demo WebConsole-README.txt
[root@master apache-activemq-5.8.0]# cd bin/
[root@master bin]# ls
activemq activemq-admin activemq.jar diag linux-x86-32 linux-x86-64 macosx wrapper.jar
[root@master bin]# sh activemq
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /root/.activemqrc)
INFO: Invoke the following command to create a configuration file
activemq setup [ /etc/default/activemq | /root/.activemqrc ]
INFO: Using java '/usr/java/jdk1.7.0_67/bin/java'
Java Runtime: Oracle Corporation 1.7.0_67 /usr/java/jdk1.7.0_67/jre
Heap sizes: current=1013632k free=1002447k max=1013632k
JVM args: -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Dactivemq.classpath=/opt/apache-activemq-5.8.0/conf; -Dactivemq.home=/opt/apache-activemq-5.8.0 -Dactivemq.base=/opt/apache-activemq-5.8.0 -Dactivemq.conf=/opt/apache-activemq-5.8.0/conf -Dactivemq.data=/opt/apache-activemq-5.8.0/data
Extensions classpath:
[/opt/apache-activemq-5.8.0/lib,/opt/apache-activemq-5.8.0/lib/camel,/opt/apache-activemq-5.8.0/lib/optional,/opt/apache-activemq-5.8.0/lib/web,/opt/apache-activemq-5.8.0/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq-5.8.0
ACTIVEMQ_BASE: /opt/apache-activemq-5.8.0
ACTIVEMQ_CONF: /opt/apache-activemq-5.8.0/conf
ACTIVEMQ_DATA: /opt/apache-activemq-5.8.0/data
Usage: Main [--extdir <dir>] [task] [task-options] [task data]
Tasks:
browse - Display selected messages in a specified destination.
bstat - Performs a predefined query that displays useful statistics regarding the specified broker
create - Creates a runnable broker instance in the specified path.
decrypt - Decrypts given text
encrypt - Encrypts given text
export - Exports a stopped brokers data files to an archive file
list - Lists all available brokers in the specified JMX context
purge - Delete selected destination's messages that matches the message selector
query - Display selected broker component's attributes and statistics.
start - Creates and starts a broker using a configuration file, or a broker URI.
stop - Stops a running broker specified by the broker name.
Task Options (Options specific to each task):
--extdir <dir> - Add the jar files in the directory to the classpath.
--version - Display the version information.
-h,-?,--help - Display this help information. To display task specific help, use Main [task] -h,-?,--help
Task Data:
- Information needed by each specific task.
JMX system property options:
-Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')
-Dactivemq.jmx.user=<user name>
-Dactivemq.jmx.password=<password>
Tasks provided by the sysv init script:
restart - stop running instance (if there is one), start new instance
console - start broker in foreground, useful for debugging purposes
status - check if activemq process is running
setup - create the specified configuration file for this init script
(see next usage section)
Configuration of this script:
The configuration of this script can be placed on /etc/default/activemq or /root/.activemqrc.
To use additional configurations for running multiple instances on the same operating system
rename or symlink script to a name matching to activemq-instance-<INSTANCENAME>.
This changes the configuration location to /etc/default/activemq-instance-<INSTANCENAME> and
$HOME/.activemqrc-instance-<INSTANCENAME>. Configuration files in /etc have higher precedence.
[root@master bin]# sh activemq-admin
Java Runtime: Oracle Corporation 1.7.0_67 /usr/java/jdk1.7.0_67/jre
Heap sizes: current=7296k free=6863k max=124736k
JVM args: -Dactivemq.classpath=/opt/apache-activemq-5.8.0/conf; -Dactivemq.home=/opt/apache-activemq-5.8.0 -Dactivemq.base=/opt/apache-activemq-5.8.0 -Dactivemq.conf=/opt/apache-activemq-5.8.0/conf -Dactivemq.data=/opt/apache-activemq-5.8.0/data -Djava.io.tmpdir=/opt/apache-activemq-5.8.0/tmp
Extensions classpath:
[/opt/apache-activemq-5.8.0/lib,/opt/apache-activemq-5.8.0/lib/camel,/opt/apache-activemq-5.8.0/lib/optional,/opt/apache-activemq-5.8.0/lib/web,/opt/apache-activemq-5.8.0/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq-5.8.0
ACTIVEMQ_BASE: /opt/apache-activemq-5.8.0
ACTIVEMQ_CONF: /opt/apache-activemq-5.8.0/conf
ACTIVEMQ_DATA: /opt/apache-activemq-5.8.0/data
Usage: Main [--extdir <dir>] [task] [task-options] [task data]
Tasks:
browse - Display selected messages in a specified destination.
bstat - Performs a predefined query that displays useful statistics regarding the specified broker
create - Creates a runnable broker instance in the specified path.
decrypt - Decrypts given text
encrypt - Encrypts given text
export - Exports a stopped brokers data files to an archive file
list - Lists all available brokers in the specified JMX context
purge - Delete selected destination's messages that matches the message selector
query - Display selected broker component's attributes and statistics.
start - Creates and starts a broker using a configuration file, or a broker URI.
stop - Stops a running broker specified by the broker name.
Task Options (Options specific to each task):
--extdir <dir> - Add the jar files in the directory to the classpath.
--version - Display the version information.
-h,-?,--help - Display this help information. To display task specific help, use Main [task] -h,-?,--help
Task Data:
- Information needed by each specific task.
JMX system property options:
-Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')
-Dactivemq.jmx.user=<user name>
-Dactivemq.jmx.password=<password>
[root@master bin]# sh activemq start
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /root/.activemqrc)
INFO: Invoke the following command to create a configuration file
activemq setup [ /etc/default/activemq | /root/.activemqrc ]
INFO: Using java '/usr/java/jdk1.7.0_67/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/opt/apache-activemq-5.8.0/data/activemq-master.pid' (pid '3693')
[root@master bin]# netstat -tnpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:930 0.0.0.0:* LISTEN 2868/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2827/portmap
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3142/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3200/sendmail: acce
tcp 0 0 :::59779 :::* LISTEN 3693/java
tcp 0 0 :::22 :::* LISTEN 3107/sshd
[root@master bin]#
二、验证
http://192.168.1.104/:8161/admin/
In the default configuration ActiveMQ automatically starts the web console in the
same VM as the broker. The console is accessibly under http://localhost:8161/admin/.
1)、输入密码口令 admin/admin
2)、打开页面