远程关闭 RabbitMQ 服务器
Remotely shut down RabbitMQ server
我一直在尝试远程杀死 rabbitmq 服务器,但到目前为止还不太幸运。我可以轻松连接到它并使用 pika 库发布和接收消息。
到目前为止我尝试过的步骤:
使用 RabbitMQ 的 HTTP API 删除连接
/api/connections/name
An individual connection. DELETEing it
willclose the connection. Optionally set the "X-Reason"
header when DELETEing to provide a reason.'
当我尝试类似 http://localhost:15672/api/connection/127.0.0.1:31332 的操作时,出现错误:
{"error":"Object Not Found","reason":"\"Not Found\"\n"}
- 在本地使用 rabbitmqadmin
- 尝试使用rabbitmqctl远程关闭rabbitmq服务器
rabbitmqctl
这是使用 rabbitmqctl
的方法
set RABBITMQ_CTL_ERL_ARGS=-setcookie FWQUGISFBWECSKWFVFRP
rabbitmqctl.bat -n rabbit@gabriele-VirtualBox stop
二郎
这是使用 Erlang
杀死远程节点的一种方法:
erl -setcookie FXQUEISFFRECSKWCVB -sname thekiller@gabriele-VirtualBox
Eshell V6.4 (abort with ^G)
(thekiller@gabriele-VirtualBox)1> net_adm:ping('rabbit@gabriele-VirtualBox').
pong
(thekiller@gabriele-VirtualBox)2> rpc:call('rabbit@gabriele-VirtualBox', init, stop, []).
ok
(thekiller@gabriele-VirtualBox)3>
- 使用您的
.erlang.cookie
和 -sname
启动 erl
控制台
具有相同的 rabbitmq 域(在我的例子中 gabriele-VirtualBox
)。
- 使用 ping 测试是否到达节点
- 呼叫
rpc:call('rabbit@gabriele-VirtualBox', init, stop, [])
.
完成,您杀死了远程节点。
再次进行一些故障排除后,我能够使用 HTTP API 终止活动连接。诀窍是整个连接名称将被 url 编码。
在我的例子中,连接名称是:
127.0.0.1:31332 -> 127.0.0.1:15672
所以当我尝试以下操作时出现错误:
http://localhost:15672/api/connection/127.0.0.1:31332 ==> object not found error
只有在我 URL 编码连接名称并发送 CURL DELETE 后它才起作用,如下所示:
http://localhost:15672/api/connection/127.0.0.1%3A31332%20-%3E%20127.0.0.1%3A15672
我一直在尝试远程杀死 rabbitmq 服务器,但到目前为止还不太幸运。我可以轻松连接到它并使用 pika 库发布和接收消息。
到目前为止我尝试过的步骤:
使用 RabbitMQ 的 HTTP API 删除连接
/api/connections/name An individual connection. DELETEing it willclose the connection. Optionally set the "X-Reason" header when DELETEing to provide a reason.'
当我尝试类似 http://localhost:15672/api/connection/127.0.0.1:31332 的操作时,出现错误:
{"error":"Object Not Found","reason":"\"Not Found\"\n"}
- 在本地使用 rabbitmqadmin
- 尝试使用rabbitmqctl远程关闭rabbitmq服务器
rabbitmqctl
这是使用 rabbitmqctl
set RABBITMQ_CTL_ERL_ARGS=-setcookie FWQUGISFBWECSKWFVFRP
rabbitmqctl.bat -n rabbit@gabriele-VirtualBox stop
二郎
这是使用 Erlang
杀死远程节点的一种方法:
erl -setcookie FXQUEISFFRECSKWCVB -sname thekiller@gabriele-VirtualBox
Eshell V6.4 (abort with ^G)
(thekiller@gabriele-VirtualBox)1> net_adm:ping('rabbit@gabriele-VirtualBox').
pong
(thekiller@gabriele-VirtualBox)2> rpc:call('rabbit@gabriele-VirtualBox', init, stop, []).
ok
(thekiller@gabriele-VirtualBox)3>
- 使用您的
.erlang.cookie
和-sname
启动erl
控制台 具有相同的 rabbitmq 域(在我的例子中gabriele-VirtualBox
)。 - 使用 ping 测试是否到达节点
- 呼叫
rpc:call('rabbit@gabriele-VirtualBox', init, stop, [])
.
完成,您杀死了远程节点。
再次进行一些故障排除后,我能够使用 HTTP API 终止活动连接。诀窍是整个连接名称将被 url 编码。
在我的例子中,连接名称是:
127.0.0.1:31332 -> 127.0.0.1:15672
所以当我尝试以下操作时出现错误:
http://localhost:15672/api/connection/127.0.0.1:31332 ==> object not found error
只有在我 URL 编码连接名称并发送 CURL DELETE 后它才起作用,如下所示:
http://localhost:15672/api/connection/127.0.0.1%3A31332%20-%3E%20127.0.0.1%3A15672