172

How can I verify which version of rabbitmq is running on a server?

Is there a command to verify that rabbitmq is running?

Promise Preston
  • 24,334
  • 12
  • 145
  • 143
Hussain Fakhruddin
  • 3,202
  • 4
  • 25
  • 36

13 Answers13

232

Use this command:

sudo rabbitmqctl status

and look for line that looks like this:

{rabbit,"RabbitMQ","2.6.1"},
2240
  • 1,547
  • 2
  • 12
  • 30
Marek
  • 3,471
  • 1
  • 16
  • 15
  • I got this instead on Archlinux - [{rabbit,34362},{rabbitmqctl23794,40359}] though I installed rabbitmq 3.1.3-1 :) – Sian Lerk Lau Dec 03 '13 at 06:18
  • 1
    And if rabbitmq services are stopped? It doesn't works. How can I retrieve version of a "shut down" rabbitmq? – andPat Jul 29 '15 at 14:00
  • 1
    In Windows this is very similar. "C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5\sbin\rabbitmqctl status" Folder name may vary with your version of Rabbit. – dylanT Nov 10 '16 at 23:58
40

You can simply execute from the command line:

sudo rabbitmqctl status | grep rabbit
itsjeyd
  • 5,070
  • 2
  • 30
  • 49
Greg Motyl
  • 2,478
  • 17
  • 31
  • 1
    Maybe the format has changed - as of version `3.8.4`, a better search string is `sudo rabbitmqctl status | grep -i "version"`. – Janos May 31 '20 at 17:45
26

If rabbitimq can not start I found the only way to determine version is via installer system.

Eample Debian/Ubuntu:

dpkg -s rabbitmq-server | grep Version
user224767
  • 979
  • 8
  • 4
12

If you have no access to rabbitmqctl or rabbitmq-server is not running, on linux do :

ls /usr/lib/rabbitmq/lib/

I got :

rabbitmq_server-3.5.6
user057827
  • 121
  • 1
  • 2
10

As Marek said on a local server, or, on a remote server (using amqplib):

from amqplib import client_0_8 as amqp
import sys

conn = amqp.Connection(host=sys.argv[1], userid="guest", password="guest", virtual_host="/", insist=False)

for k, v in conn.server_properties.items():
    print k, v

Save as checkVersion.py and run with python checkVersion.py dev.rabbitmq.com:

% python checkVersion.py dev.rabbitmq.com
information Licensed under the MPL.  See http://www.rabbitmq.com/
product RabbitMQ
copyright Copyright (C) 2007-2011 VMware, Inc.
capabilities {}
platform Erlang/OTP
version 2.6.0
scvalex
  • 14,931
  • 2
  • 34
  • 43
3

On debian systems, you can just run:

dpkg-query --showformat='${Version}' --show rabbitmq-server
A T
  • 13,008
  • 21
  • 97
  • 158
2

To get RabbitMQ version using the .NET/C# RabbitMQ Client Library:

using (var connection = connectionFactory.CreateConnection())
{
    if (connection.ServerProperties.ContainsKey("version"))
        Console.WriteLine("Version={0}",
            Encoding.UTF8.GetString((byte[])connection.ServerProperties["version"]));
}

Output:

Version=3.6.3

Pang
  • 9,564
  • 146
  • 81
  • 122
Alex G.
  • 909
  • 1
  • 9
  • 16
1

Since I was looking to do this in C# on a Windows machine and all the current answers are for *nix, I'll post the code that I ended up using:

public string GetRabbitMqVersion()
{
    string prefix = "rabbitmq_server-";
    var dirs = System.IO.Directory.EnumerateDirectories(@"C:\Program Files (x86)\RabbitMQ Server", string.Format("{0}*",prefix));

    foreach (var dir in dirs)
    {
        //Just grab the text after 'rabbitmq_server-' and return the first item found
        var i = dir.LastIndexOf(prefix);
        return dir.Substring(i+16);
    }
    return "Unknown";
}
Pang
  • 9,564
  • 146
  • 81
  • 122
Matt Klein
  • 7,856
  • 6
  • 45
  • 46
1

In the likely event you're using the "management" (web) plug-in, the RabbitMQ version appears in the upper-right corner of every web page, along with the version of the Erlang run-time.

MotownJoe
  • 78
  • 5
1

I use following command to trim output down to version,

rabbitmqctl status | grep "{rabbit,\"RabbitMQ\""

Output:

  {rabbit,"RabbitMQ","3.7.3"},
Sufiyan Ghori
  • 18,164
  • 14
  • 82
  • 110
0

On Centos you can use yum list rabbitmq-server.

Gerard de Visser
  • 7,590
  • 9
  • 50
  • 58
0

MQ serer installation steps

sudo apt update

sudo apt install curl software-properties-common apt-transport-https lsb-release

apt --fix-broken install

sudo apt --fix-broken install

sudo apt install curl software-properties-common apt-transport-https lsb-release

curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/erlang.gpg

echo "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/erlang.list

sudo apt update

sudo apt install erlang

erl

curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash

sudo apt update

sudo apt install rabbitmq-server

systemctl status rabbitmq-server.service

systemctl is-enabled rabbitmq-server.service

sudo rabbitmq-plugins enable rabbitmq_management

sudo ss -tunelp | grep 15672

sudo rabbitmq-plugins list -v

sudo rabbitmq-plugins enable rabbitmq_web_mqtt rabbitmq_web_stomp rabbitmq_amqp1_0

systemctl status rabbitmq-server.service

  • var mqtt = require('mqtt'); var mqttUrl = 'mqtt://localhost'; var device_id = "5"; var mqttOption = { clientId: "52", port: 1883, username: "", password: "", // port: 8883, // username: "iothub.azure-devices.net/"+device_id+"/?api-version=2018-06-30", // password: "sas token", // rejectUnauthorized: false, // reconnecting: true, // reconnectPeriod: 25000, // connectTimeout: 50000 }; var mqttClient = ""; var pubTopic = "devices/" + device_id + "/messages/events/"; var subTopic = "devices/" + device_id + "/messages/devicebound/#"; – testymon Mar 10 '23 at 06:37
  • try { mqttClient = mqtt.connect(mqttUrl, mqttOption); mqttClient.on('connect', function () { console.log("Device connected 12"); setInterval(() => { var data = { id: device_id, temp: RandFunc(15, 20), humid: RandFunc(30, 50), mot: RandFuncFromArray(["ON", "OFF"]), }; console.log(data); mqttClient.publish(pubTopic, JSON.stringify(data)); }, 5000); – testymon Mar 10 '23 at 06:38
  • mqttClient.publish("devices/" + device_id + "/messages/events/", '{"id":123}', qos=1) mqttClient.subscribe(subTopic); }) mqttClient.on("message", function (topic, payload) { console.log("new command :::::::::::::::::::: ", topic, JSON.stringify(JSON.parse(payload)) ); }) mqttClient.on('error', function (err) { console.log("Error => ", err.message); }); mqttClient.on('close', function () { console.log("Connection closed => "); }) – testymon Mar 10 '23 at 06:38
  • } catch (error) { console.log("close => ", error.message); } function RandFunc(min, max) { return (Math.random() * (max - min) + min).toFixed(0); } function RandFuncFromArray(array) { return array[Math.floor(Math.random() * array.length)]; } – testymon Mar 10 '23 at 06:38
-1

Login to management ui and in top right you can find the version. Also use the following command to find the version

# sudo bash

# rabbitmqctl status | grep rabbit