Skip to main content
Matrix42 Self-Service Help Center

Enterprise Service Bus/RabbitMQ

Automatic Server upgrade

Before you start

  • The Uninstallation (will only work if RabbitMQ is configured without SSL)!
  • Be sure all messages are consumed (empty queues). All unprocessed messages will be lost.

Stop Services

  • Stop the following subscribers on this server or where the subscribers are installed:
    • Empirum - Matrix42 Empirum ServiceBus Service" - (if used)
    • Empirum Depot Sync - Matrix42 Universal Agent Framework (UAF)- (inf used)
    • Silverback - Silverback Listener Service (SilverbackListenerService) - (if used)
    • EgoSecure - EgoSecure Service Bus Adapter (Matrix42.EPS_UUX.ServiceBusAdapter) - (if used)
    • FastViewer (can be ignored)
    • Logon to the Enterprise Service Management (ESM)
      Navigate to Administration -> Integration -> Enterprise Service Bus -> Settings and deactivate the option “Is Enabled”.
      Afterwards navigate to Administration -> Services & Processes -> Engine Activations, search for “ESBAdapterActivation” and click on “Activate”.

Download and run uninstall script

The script will automatically uninstall the installed RabbitMQ and Erlang components. The existing RabbitMQ configuration will also be saved for a restore during the subsequent reinstallation.

  • Download and unzip the RabbitMQ package from the Marketplace
  • The downloaded zip file contains the script Uninstall-RabbitMqServer_NonSSL.ps1
  • Run the script Uninstall-RabbitMqServer_NonSSL.ps1 with Powershell as Admin
    (Double click on the script is also supported as long the .ps1 extension is associated with Powershell).

Install new version

  • Run the extracted RabbitMQ_InstallPackage.4.19.1.exe
  • Confirm with Yes
  • Wait until all required packages will be installed
  • Answer the question "Do you want to configure RabbitMQ now? [y/n]" with ”n” or “N”.
    The RabbitMQ configuration previously saved during uninstallation is automatically restored.
  • After successful installation, delete the cache of your favorite browser (Images and Files only).
  • Close your browser and then restart it again.
  • Open the following URL: http://localhost:15672
  • After successful login to RabbitMQ, the entire configuration should still exist.

For security reasons, you can then delete the "guest" user from RabbitMQ (https://www.rabbitmq.com/access-control.html).

Start Services

  • All previously stopped subscribers can now be reactivated.

Manual Server upgrade

Before you start

  • Do not use the automated RabbitMQ installer from Matrix42 Marketplace to upgrade your RabbitMQ server. This will reset your installation to default and configured users and other custom settings will be lost.
  • Download the installation packages directly to your RabbitMQ host or copy the installation packages after downloading them from your client.

Check your current versions

  • Open your RabbitMQ management UI at http://localhost:15672
  • Login with your Username and Password
  • Review your RabbitMQ and Erlang version displayed in the header of the page

RabbitMQ_VersionCheck.png

Upgradability and Binaries Download

Manual Download (recommended)

Once the packages have been downloaded, there should be two installation packages like:

  • otp_win64_26.2.5.2.exe
  • rabbitmq-server-3.13.6.exe

PowerShell Download (optional)

You can use the following PowerShell script to automate the process of downloading the software.

Please note that the URLs and version numbers in the script may be out of date. Review the website for the latest version.

# Download Erlang OTP
$erlangUrl = "https://github.com/erlang/otp/releases/download/OTP-24.3.4.8/otp_win64_26.2.5.2.exe"
$erlangFile = "otp_win64_26.2.5.2.exe"
Invoke-WebRequest -Uri $erlangUrl -OutFile $erlangFile

# Download RabbitMQ Server
$rabbitUrl = "https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.9.27/rabbitmq-server-3.13.6.exe"
$rabbitFile = "rabbitmq-server-3.13.6.exe"
Invoke-WebRequest -Uri $rabbitUrl -OutFile $rabbitFile

You will find the downloaded files into your user profile, e.g. under C:\Users\vvalentine 

Backup

When upgrading a RabbitMQ Server installation on a Windows Server host, it's important to first backup your current configuration files as well as the definitions before proceeding with the upgrade. The default config file location vary between and operating systems and packages. It may also be that your RabbitMQ instance does not have any config files. In this case you can skip the two for backup and restore of the config files.  Please refer to the following link for additional information: How to Find Config File Location

Backup Config Files

  • Open PowerShell as an Administrator
  • Navigate to your RabbitMQ folder, e.g. C:\Program Files\RabbitMQ Server\rabbitmq_server-\3.9.5\sbin
  • Now execute the following command: 
.\rabbitmq-diagnostics status
  • Locate the Config files section that would look like this:
Config files

* /etc/rabbitmq/advanced.config
* /etc/rabbitmq/rabbitmq.conf
  • Navigate to the path(s) and copy your config files to a different location, e.g into your user profile (C:\Users\vvalentine)
  • Keep the paths in mind or note the paths down as you will need them later for restoring the files

The path to the config files is also visible in the management UI in the Overview tab > Nodes

Backup Definitions

  • To create a backup of the definitions (queues and users) execute the following in a PowerShell command line: 
.\rabbitmqctl.bat export_definitions $env:USERPROFILE\rabbitmq.definitions.json​

You will find the downloaded files again in your user profile, e.g. under C:\Users\vvalentine.

Exporting and importing definitions is also available in the management UI in the Overview tab. 

Backup Messages (optional)

Skip the export and later the import of messages as you like, they are considered disposable and if there is no load at the time of the update couple messages get lost, which is fine. To create a backup of all current messages, make an export using the PowerShell script below which is utilizing the RabbitMQ Managment REST API. Replace the username, password, and virtual host ($baseUrl/queues/matrix42) with your current values.

To learn more about options to create and to restore backups, please consider studying the RabbitMQ documentation.

$username = "rabbitmq" 
$password = "Password" 
$baseUrl = "http://localhost:15672/api" 

# Get all queues 
$queues = (Invoke-RestMethod -Uri "$baseUrl/queues" -Credential (New-Object System.Management.Automation.PSCredential($username, (ConvertTo-SecureString $password -AsPlainText -Force)))) 

# Iterate through all queues 
foreach($queue in $queues)
{
    # Get all messages in the queue
    $messages = (Invoke-RestMethod -Method POST -Body '{"count":100000,"ackmode":"ack_requeue_true","encoding":"auto","truncate":5000000}' -Uri "$baseUrl/queues/matrix42/$($queue.name)/get" -Credential (New-Object System.Management.Automation.PSCredential($username, (ConvertTo-SecureString $password -AsPlainText -Force)))) 
    $messages | ConvertTo-Json -Depth 10 | Out-File -FilePath "$env:USERPROFILE\queue_$($queue.name)_messages.json" -Encoding utf8 
    Write-Host "Exported $count messages from queue $($queue.name)"
}

You will find the backup files in a *.json format in your user profile, e.g. under C:\Users\vvalentine  

Execute Upgrade

Stop RabbitMQ Server

  • Run the following command to stop the RabbitMQ node and service on the host:
.\rabbitmqctl.bat shutdown

Upgrade Erlang

  • Run the downloaded Erlang installer, e.g. otp_win64_26.2.5.2.exe
  • Press Next (2x) and Install
  • Wait until the installation is finished and press close
  • Update the Environment Variable
    • Open Control Panel > System > Advanced system settings > Environment Variables
    • Locate the ERLANG_HOME variable and and check that it matches the current installation path (e.g. C:\Program Files\Erlang OTP)
    • In case you need to adjust the variable, press edit and proceed with Browse Directory

In case you get prompted for a reboot, skip the request until everything is installed

Upgrade RabbitMQ

Before starting with the RabbitMQ upgrade, close all explorer windows and command line prompts that access current RabbitMQ directory

  • Run the downloaded RabbitMQ installer, e.g. rabbitmq-server-3.13.6.exe
  • Press OK to confirm to remove the previous version
  • Press Next and press Install
  • Wait until the installation is finished and press Next
  • Press Finish
  • Update the Environment Variable
    • Open Control Panel > System > Advanced system settings > Environment Variables
    • Locate the RABBITMQ_BASE variable and and check that it matches the current installation path (e.g. C:\Program Files\RabbitMQ Server\rabbitmq_server-3.13.6)
    • In case you need to adjust the variable, press edit and  proceed with Browse Directory
  • Reboot your server

Restore

After the upgrade, you can restore your configuration by first stopping and removing the RabbitMQ service, copying the backup file to the directory of the new installation and finally installing and starting the RabbitMQ service. 

Restore Config Files

  • Open PowerShell as an Administrator
  • Navigate to your updated RabbitMQ folder, e.g. C:\Program Files\RabbitMQ Server\rabbitmq_server-\3.13.6\sbin
  • Now execute the following commands and take actions step by step:
.\rabbitmq-service stop
.\rabbitmq-service remove
  • Now copy your config files back to the path(s) locations
.\rabbitmq-service install
.\rabbitmq-service start
  • Enable Management UI
.\rabbitmq-plugins enable rabbitmq_management

Restore Definitions

  • Import Definitions (attention: PowerShell syntax is used here)
.\rabbitmqctl import_definitions $env:USERPROFILE\rabbitmq.definitions.json

In case you get a bad argument that file does not exist, copy the rabbitmq.definitions.json to your current sbin folder of RabbitMQ and execute the command without $env:USERPROFILE or use the Import Definition action in the management UI from the Overview tab. 

Restore Messages

Skip the import of messages as you like, they are considered disposable and if there is no load at the time of the update couple messages get lost, which is fine.

  • Import Messages using the PowerShell script below:
$username = "vvalentine" 
$password = "Matrix42" 
$baseUrl = "http://localhost:15672/api" 

# Get all queues
$queues = (Invoke-RestMethod -Uri "$baseUrl/queues" -Credential (New-Object System.Management.Automation.PSCredential($username, (ConvertTo-SecureString $password -AsPlainText -Force))))

# Iterate through all queues
foreach($queue in $queues)
{
    $messages = Get-Content "$env:USERPROFILE\queue_$($queue.name)_messages.json" | ConvertFrom-Json
    foreach($message in $messages)
    {
        Invoke-RestMethod -Method Post -Uri "$baseUrl/exchanges/matrix42/$($message.exchange)/publish" -Body ($message | ConvertTo-Json -Depth 10) -Credential (New-Object System.Management.Automation.PSCredential($username, (ConvertTo-SecureString $password -AsPlainText -Force))) | Out-Null    
    }
}

Review Exchanges and Queues

  • Open your management console at http://localhost:15672
  • Navigate to Exchanges and review if everything is present
  • Navigate to Queues and review if everything is present

When opening Queues and selecting one Queue, you might get an Reference Error. In this case clear your browser cache. 

Check the Status

  • Now run the following commands to verify the status:
.\rabbitmq-diagnostics ping​
.\rabbitmq-diagnostics status​
  • Was this article helpful?