RabbitMQ 监控7

2022-02-09 19:53:03 浏览数 (2)

打开防火墙

需要打开以下端口以供访问

  • 5672 : for amqp
  • 25672 : for clustering
  • 15672 : RabbitMQ Management for web
代码语言:javascript复制
[root@new-mq-node rabbitmq]# iptables -L -nv | grep 5672
[root@new-mq-node rabbitmq]# grep 5672 /etc/sysconfig/iptables 
[root@new-mq-node rabbitmq]# vim /etc/sysconfig/iptables
[root@new-mq-node rabbitmq]# grep 5672 /etc/sysconfig/iptables 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 25672 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 15672 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5672 -j ACCEPT
[root@new-mq-node rabbitmq]# /etc/init.d/iptables  reload 
iptables: Trying to reload firewall rules:                 [  OK  ]
[root@new-mq-node rabbitmq]# iptables -L -nv | grep 5672
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:25672 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:15672 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:5672 
[root@new-mq-node rabbitmq]#

Tip: 其实只要目标节点,也就是指向(join_cluster to xx)的那个节点(xx) 25672打开了,就可以加入了,也能正常运行,只是这种情况下,自己就不能被加入,也无法提供服务


加入集群

当前状态

代码语言:javascript复制
[root@new-mq-node rabbitmq]# rabbitmqctl  cluster_status
Cluster status of node 'rabbit@new-mq-node' ...
[{nodes,[{disc,['rabbit@new-mq-node']}]},
 {running_nodes,['rabbit@new-mq-node']},
 {cluster_name,<<"rabbit@new-mq-node">>},
 {partitions,[]}]
[root@new-mq-node rabbitmq]# 

停止应用

代码语言:javascript复制
[root@new-mq-node rabbitmq]# rabbitmqctl  stop_app
Stopping node 'rabbit@new-mq-node' ...
[root@new-mq-node rabbitmq]#

加入集群

代码语言:javascript复制
[root@new-mq-node rabbitmq]# rabbitmqctl join_cluster rabbit@rabbitmq
Clustering node 'rabbit@new-mq-node' with 'rabbit@rabbitmq' ...
[root@new-mq-node rabbitmq]#
[root@new-mq-node rabbitmq]# rabbitmqctl  cluster_status
Cluster status of node 'rabbit@new-mq-node' ...
[{nodes,[{disc,['rabbit@new-mq-node','rabbit@rabbitmq']}]}]
[root@new-mq-node rabbitmq]# 

启动应用

代码语言:javascript复制
[root@new-mq-node rabbitmq]# rabbitmqctl start_app
Starting node 'rabbit@new-mq-node' ...
[root@new-mq-node rabbitmq]# rabbitmqctl  cluster_status
Cluster status of node 'rabbit@new-mq-node' ...
[{nodes,[{disc,['rabbit@new-mq-node','rabbit@rabbitmq']}]},
 {running_nodes,['rabbit@rabbitmq','rabbit@new-mq-node']},
 {cluster_name,<<"rabbit@rabbitmq">>},
 {partitions,[]}]
[root@new-mq-node rabbitmq]#

0 人点赞