activemq-artemis/docs/user-manual/en/tools.md

4.1 KiB

Tools

Apache ActiveMQ Artemis ships with several helpful command line tools. All tools are available from the activemq-tools-<version>-jar-with-dependencies.jar. As the name suggests, this Java archive contains ActiveMQ along with all of its dependencies. This is done to simplify the execution of the tools by eliminating the need so specify a classpath. These tools are:

  • print-data. Used for low-level inspection of the bindings and message journals. It takes two parameters - bindings-directory and journal-directory. These are the paths to the directories where the bindings and message journals are stored, respectively. For example:
java -jar activemq-tools-<version>-jar-with-dependencies.jar print-data /home/user/activemq/data/bindings /home/user/activemq/data/journal
  • print-pages. Used for low-level inspection of paged message data. It takes two parameters - paging-directory and journal-directory. These are the paths to the directories where paged messages and the message journals are stored, respectively. For example:
java -jar activemq-tools-<version>-jar-with-dependencies.jar print-pages /home/user/activemq/data/paging-directory /home/user/activemq/data/journal
  • export. Used for exporting all binding and message data (including paged and large messages) as well as JMS destinations and connection factories (including JNDI bindings). The export is structured as XML. This data can then be imported to another server even if the server is a different version than the original. It takes 4 parameters:

    • bindings-directory - the path to the bindings directory.

    • journal-directory - the path to the journal directory.

    • paging-directory - the path to the paging directory.

    • large-messages-directory - the path to the large-messages directory.

    Here's an example:

java -jar activemq-tools-<version>-jar-with-dependencies.jar export /home/user/activemq/data/bindings-directory /home/user/activemq/data/journal-directory /home/user/activemq/data/paging-directory /home/user/activemq/data/large-messages
This tool will export directly to standard out so if the data needs
to be stored in a file please redirect as appropriate for the
operation system in use. Also, please note that the `export` tool is
single threaded so depending on the size of the journal it could
take awhile to complete.
  • import. Used for importing data from an XML document generated by the export tool. The import tool reads the XML document and connects to an Apache ActiveMQ Artemis server via Netty to import all the data. It takes 5 parameters:

    • input-file - the path to the XML file generated by the export tool.

    • host - the IP address or hostname of the server where the data should be imported.

    • port - the port where ActiveMQ is listening.

    • transactional - a boolean flag to indicate whether or not to send all the message data in a single transaction. Valid values are true or false.

    • application-server-compatibility - a boolean flag to indicate whether or not JNDI bindings need special treatment to account for the way JBoss AS7, Wildfly, and JBoss EAP 6 handle JNDI for remote clients. Each of these application servers require a special JNDI binding to allow access from remote clients. If this is true then every JNDI binding in the XML will be duplicated in the "java:jboss/exported/" namespace thus allowing both local and remote clients to use the same name when accessing resources via JNDI. Valid values are true or false.

    Here's an example:

    java -jar activemq-tools-<version>-jar-with-dependencies.jar import /home/user/exportData.xml 127.0.0.1 61616 false false
    

    Like the export tool the import tool is single threaded so depending on the size of the XML file it may take awhile for the process to complete.