How can I verify which version of rabbitmq is running on a server?
Is there a 开发者_StackOverflowcommand to verify that rabbitmq is running?
Use this command:
sudo rabbitmqctl status
and look for line that looks like this:
{rabbit,"RabbitMQ","2.6.1"},
You can simply execute from the command line:
sudo rabbitmqctl status | grep rabbit
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
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
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
On debian systems, you can just run:
dpkg-query --showformat='${Version}' --show rabbitmq-server
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
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.
I use following command to trim output down to version,
rabbitmqctl status | grep "{rabbit,\"RabbitMQ\""
Output:
{rabbit,"RabbitMQ","3.7.3"},
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";
}
On Centos you can use yum list rabbitmq-server
.
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
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
精彩评论