Deploy your Bitnami ActiveMQ Stack on 1&1 Cloud Platform now! Launch Now

Bitnami ActiveMQ for 1&1 Cloud Platform

Description

Apache ActiveMQ is an open source message broker written in Java together with a full Java Message Service (JMS) client.

First steps with the Bitnami ActiveMQ Stack

Welcome to your new Bitnami application running on 1&1! Here are a few questions (and answers!) you might need when first starting with your application.

What credentials do I need?

You need two sets of credentials:

  • The application credentials, consisting of a username and password. These credentials allow you to log in to your new Bitnami application.

  • The server credentials, consisting of an SSH username and password. These credentials allow you to log in to your 1&1 Cloud Platform server using an SSH client and execute commands on the server using the command line.

What is the administrator username set for me to log in to the application for the first time?

Username: admin

What is the administrator password?

What SSH username should I use for secure shell access to my application?

SSH username: root

How do I get my SSH key or password?

What are the default ports?

A port is an endpoint of communication in an operating system that identifies a specific process or a type of service. Bitnami stacks include several services or servers that require a port.

Remember that if you need to open some ports you can follow the instructions given in the FAQ to learn how to open the server ports for remote access.

Port 22 is the default port for SSH connections.

The ActiveMQ access port is 8161. This port is closed by default, you must open it to enable remote access.

How to start or stop the services?

Each Bitnami stack includes a control script that lets you easily stop, start and restart services. The script is located at /opt/bitnami/ctlscript.sh. Call it without any service name arguments to start all services:

$ sudo /opt/bitnami/ctlscript.sh start

Or use it to restart a single service, such as Apache only, by passing the service name as argument:

$ sudo /opt/bitnami/ctlscript.sh restart apache

Use this script to stop all services:

$ sudo /opt/bitnami/ctlscript.sh stop

Restart the services by running the script without any arguments:

$ sudo /opt/bitnami/ctlscript.sh restart

Obtain a list of available services and operations by running the script without any arguments:

$ sudo /opt/bitnami/ctlscript.sh

How to upload files to the server with SFTP?

NOTE: Bitnami applications can be found in /opt/bitnami/apps.
  • If you are using the Bitnami Launchpad for 1&1 Cloud Platform, obtain your SSH credentials by following these steps:

    • Browse to the Bitnami Launchpad for 1&1 and sign in if required using your Bitnami account.
    • Select the "Virtual Machines" menu item.
    • Select your cloud server from the resulting list.
    • Note the server IP address and SSH credentials on the resulting page.

      SSH credentials

  • If you are using the 1&1 Control Panel, obtain your SSH credentials by following these steps:

    • Log in to the 1&1 Control Panel.
    • Navigate to the "Infrastructure -> Servers" section.
    • Look through the list of servers until you find the server you wish to modify. Click the server name.
    • In the "Features -> Server access" section, note the SSH username and click the "Show Password" link to obtain the corresponding SSH password.

      SSH credentials

Although you can use any SFTP/SCP client to transfer files to your server, this guide documents FileZilla (Windows, Linux and Mac OS X), WinSCP (Windows) and Cyberduck (Mac OS X).

Using a Password

Once you have your server's SSH credentials, choose your preferred application and follow the steps below to connect to the server using SFTP.

FileZilla

Follow these steps:

  • Download and install FileZilla.
  • Launch FileZilla and use the "File -> Site Manager -> New Site" command to bring up the FileZilla Site Manager, where you can set up a connection to your server.
  • Enter your server host name.
  • Select "SFTP" as the protocol and "Ask for password" as the logon type. Specify root as the user name and enter the server password.

    FileZilla configuration

  • Use the "Connect" button to connect to the server and begin an SFTP session. You might need to accept the server key, by clicking "Yes" or "OK" to proceed.

You should now be logged into the /root directory on the server. You can now transfer files by dragging and dropping them from the local server window to the remote server window.

If you have problems accessing your server, get extra information by use the "Edit -> Settings -> Debug" menu to activate FileZilla's debug log.

FileZilla debug log

WinSCP

Follow these steps:

  • Download and install WinSCP.
  • Launch WinSCP and in the "Session" panel, select "SFTP" as the file protocol.
  • Enter your server host name and specify root as the user name.

    WinSCP configuration

  • From the "Session" panel, use the "Login" button to connect to the server and begin an SCP session. Enter the password when prompted.

    WinSCP configuration

You should now be logged into the /root directory on the server. You can now transfer files by dragging and dropping them from the local server window to the remote server window.

Cyberduck

Follow these steps:

  • Select the "Open Connection" command and specify "SFTP" as the connection protocol.

    Cyberduck configuration

  • In the connection details panel, enter the server IP address, the username root and the SSH password.

    Cyberduck configuration

  • Use the "Connect" button to connect to the server and begin an SFTP session.

You should now be logged into the /root directory on the server. You can now transfer files by dragging and dropping them from the local server window to the remote server window.

How to change the ActiveMQ administration panel password?

You can modify the ActiveMQ admin panel password in the file /opt/bitnami/activemq/conf/jetty-realm.properties:

admin: NEWPASSWORD, admin

How to change the ActiveMQ connector password?

To change the connector password, follow these steps:

  • Generate a new secret-password pair:

     $ /opt/bitnami/activemq/bin/activemq encrypt --password NEWSECRET --input NEWPASSWORD
    
  • Substitute the encrypted password (from the last line of the previous command output) in /opt/bitnami/activemq/conf/credentials-enc.properties:

     activemq.password=ENC(NEWENCRYPTEDPASSWORD)
    
  • Change the value of the secret in the file /opt/bitnami/activemq/conf/activemq.xml:

     <bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEnc\    ryptor">
        <property name="algorithm" value="PBEWithMD5AndDES"/>
        <property name="password" value="NEWSECRET"/>
     </bean>
    

How to connect to the ActiveMQ admin panel?

In order to connect to the ActiveMQ admin panel, you have two options:

  • (Recommended): Access the ActiveMQ admin panel through an SSH tunnel (refer to the FAQ for more information about SSH tunnels).
  • Open the port 8161 for remote access (refer to the FAQ for more information about opening ports).

IMPORTANT: Making this application's network ports public is a significant security risk. You are strongly advised to only allow access to those ports from trusted networks. If, for development purposes, you need to access from outside of a trusted network, please do not allow access to those ports via a public IP address. Instead, use a secure channel such as a VPN or an SSH tunnel. Follow these instructions to remotely connect safely and reliably.

Once you have an active SSH tunnel or you opened the port for remote access, you can then connect to ActiveMQ admin panel by browsing to:

  • Access through an SSH tunnel: http://127.0.0.1:SOURCE-PORT/
  • Access opening ports: http://SERVER-IP:8161/

Access ActiveMQ admin panel

Enter the following credentials to log in:

How to connect to ActiveMQ from a different machine?

For security reasons, the ActiveMQ ports in this solution cannot be accessed over a public IP address. To connect to ActiveMQ from a different machine, you must open ports 61616 and 8161 for remote access. Refer to the FAQ for more information on this.

IMPORTANT: Making this application's network ports public is a significant security risk. You are strongly advised to only allow access to those ports from trusted networks. If, for development purposes, you need to access from outside of a trusted network, please do not allow access to those ports via a public IP address. Instead, use a secure channel such as a VPN or an SSH tunnel. Follow these instructions to remotely connect safely and reliably.

By default, all ActiveMQ transport connectors are enabled. To disable one of them, edit the /opt/bitnami/activemq/conf/activemq.xml file, and remove the line related to that connector:

<transportConnectors>
   <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
   <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
   <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
   <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
   <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
   <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
</transportConnectors>

In case of changes to the configuration file, restart the server to have the changes take effect:

$ sudo /opt/bitnami/ctlscript.sh restart activemq

To test the server connectivity, run one of the ActiveMQ examples from a different machine using these instructions.

How to run an ActiveMQ example?

The following steps walk you through running an ActiveMQ example using the Java source code.

  • First, ensure that you have Maven installed on the server. If you don't, install it following these instructions:
    • Debian:

      $ sudo apt-get install maven
      
    • CentOS:

      $ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
      $ sudo yum install apache-maven
      
  • Next, activate a Maven profile. To do this, modify the Maven settings.xml file (usually located in /etc/maven/settings.xml or /etc/maven2/settings.xml, although the path might differ on your server) and include the following:

     <profiles>
       ...  
       <profile>
         <id>env-dev</id>
         <activation>
           <property>
             <name>target-env</name>
             <value>dev</value>
           </property>
         </activation>
         <properties>
           <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
           <maven.compiler.fork>true</maven.compiler.fork>
         </properties>
       </profile>
     </profiles>
    
      <activeProfiles>
       <activeProfile>env-dev</activeProfile>
     </activeProfiles> 
    
  • Go to the examples/ folder and install it using maven:

     $ cd /opt/bitnami/activemq/examples/amqp/java
     $ sudo mvn install
    
  • Export the environment variables you need and run the example. Note that you can obtain your server's private IP address by using the /sbin/ifconfig command.

     $ export ACTIVEMQ_USER=admin
     $ export ACTIVEMQ_PASSWORD=PASSWORD
     $ export ACTIVEMQ_HOST=SERVER-IP
     $ java -cp target/amqp-example-0.1-SNAPSHOT.jar example.Listener &
     $ java -cp target/amqp-example-0.1-SNAPSHOT.jar example.Publisher
    

Execute the Listener and Publisher on different machines. You should now see the example running.

How to run the ActiveMQ web demos?

ActiveMQ comes with a number of Web demos that illustrate how to use the ActiveMQ broker with REST and AJAX. The Web demos are not activated in the default configuration, so you must follow the steps below to get them running:

  • Edit the /opt/bitnami/activemq/examples/conf/activemq-demo.xml file and change the 'locations' property to reflect the location of the encrypted credentials file, located at /opt/bitnami/activemq/conf/credentials-enc.properties:

     <property name="locations">
           <value>file:${activemq.conf}/credentials-enc.properties</value>
     </property>
    
  • If the ActiveMQ server is currently running, stop it:

     $ sudo /opt/bitnami/ctlscript.sh stop activemq
    
  • Run the example:

     $ cd /opt/bitnami/activemq
     $ sudo ./bin/activemq console xbean:/opt/bitnami/activemq/examples/conf/activemq-demo.xml
    

    The ActiveMQ broker should now start.

  • Log in to the Web administration panel and view the demos by browsing to http://DOMAIN:8161/demo. If needed, use the credentials obtained from the server dashboard to log in.

How to debug ActiveMQ errors?

The main ActiveMQ log file is created at /opt/bitnami/activemq/data/activemq.log.

oneone