21 Aralık 2017 Perşembe

ActiveMQ Artemis Installation on Debian 9

This is a base installation of ActiveMQ Artemis.
I am checking cluster and fail over configuration of Artemis. When it is ready I will share on my blog.

OpenJDK of Zulu For JAVA:

$sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9
$sudo apt-add-repository 'deb http://repos.azulsystems.com/debian stable main'
$sudo apt-get update
$sudo apt-get install zulu-8

More about Zulu;
https://www.azul.com/

Artemis Installation :
$wget http://ftp.itu.edu.tr/Mirror/Apache/activemq/activemq-artemis/2.4.0/apache-artemis-2.4.0-bin.tar.gz
$ sudo tar -zxvf apache-artemis-2.4.0-bin.tar.gz -C /opt/
$cd /opt

The most commonly used artemis commands are:
    address     Address tools group (create|delete|update|show) (example ./artemis address create)
    browser     It will browse messages on an instance
    consumer    It will consume messages from an instance
    create      creates a new broker instance
    data        data tools group (print) (example ./artemis data print)
    help        Display help information
    mask        mask a password and print it out
    migrate1x   Migrates the configuration of a 1.x Artemis Broker
    producer    It will send messages to an instance
    queue       Queue tools group (create|delete|update|stat) (example ./artemis queue create)

sudo ./bin/artemis create /opt/broker-name
You can now start the broker by executing:

   "/opt/broker-name/bin/artemis" run

Or you can run the broker in the background using:

   "/opt/broker-name/bin/artemis-service" start

Base Configuration of Artemis:
If you want access the web-ui from any where ,you have to change as below of the "web bind" in the <broker>/etc/bootstrap.xml.

<web bind="http://0.0.0.0:8161" path="web">
       <app url="activemq-branding" war="activemq-branding.war"/>
       <app url="artemis-plugin" war="artemis-plugin.war"/>
       <app url="console" war="console.war"/>
   </web>
If you do not set the jolokia, you can not reach the stats of artemis.
Below configuration that is enough for your access..
Jolokia settings:
<broker>/etc/jolokia-access.xml

<allow-origin>*://<ipaddressorfqdnofartemis>*</allow-origin>

Create a Systemd File for Artemis:
$sudo nano /etc/systemd/system/artemis.service

#############################################
[Unit]
Description=Apache ActiveMQ Artemis
After=network-online.target

[Service]
Type=forking
WorkingDirectory=/opt/broker-name/bin
ExecStart=/opt/broker-name/bin/artemis-service start
ExecStop=/opt/broker-name/bin/artemis-service stop
Restart=on-abort
User=root
Group=root

[Install]
WantedBy=multi-user.target
################################################

$sudo systemctl daemon-reload

Now you can start via systemd as a be service of Artemis.
$sudo systemctl start artemis.service

You can reach the web admin panel:
http://ipaddressorfqdnofartemis:8161