记一次搭建rabbitmq 单机多实例的集群

[root@localhost ~]# RABBITMQ_NODE_PORT=5672 RABBITMQ_NODENAME=rabbit1 RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15672}]" rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
[root@localhost ~]#  RABBITMQ_NODE_PORT=5673 RABBITMQ_NODENAME=rabbit2 RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15673}]" rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
[root@localhost ~]#  RABBITMQ_NODE_PORT=5674 RABBITMQ_NODENAME=rabbit3 RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15674}]" rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
[root@localhost ~]# rabbitmqctl -n rabbit2@192.168.206.128 stop_app
Stopping rabbit application on node rabbit2@192.168.206.128 ...

21:56:12.695 [error] ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.206.128 is illegal **


21:56:12.711 [error] ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.206.128 is illegal **

Error: unable to perform an operation on node 'rabbit2@192.168.206.128'. Please see diagnostics information and suggestions below.

Most common reasons for this are:

 * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
 * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
 * Target node is not running

In addition to the diagnostics info below:

 * See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
 * Consult server logs on node rabbit2@192.168.206.128

DIAGNOSTICS
===========

attempted to contact: ['rabbit2@192.168.206.128']

rabbit2@192.168.206.128:
  * connected to epmd (port 4369) on 192.168.206.128
  * epmd reports node 'rabbit2' uses port 25673 for inter-node and CLI tool traffic 
  * TCP connection succeeded but Erlang distribution failed 
  * suggestion: check if the Erlang cookie identical for all server nodes and CLI tools
  * suggestion: check if all server nodes and CLI tools use consistent hostnames when addressing each other
  * suggestion: check if inter-node connections may be configured to use TLS. If so, all nodes and CLI tools must do that
   * suggestion: see the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more


Current node details:
 * node name: rabbitmqcli44@localhost
 * effective user's home directory: /root
 * Erlang cookie hash: YHeAMZvCS0UbdKLimlBlCA==

[root@localhost ~]# rabbitmqctl -n rabbit2@localhost stop_app
Stopping rabbit application on node rabbit2@localhost ...
[root@localhost ~]# hostname
localhost.centos8
[root@localhost ~]# rabbitmqctl -n rabbit2@localhost reset
Resetting node rabbit2@localhost ...
[root@localhost ~]# rabbitmqctl -n rabbit2@localhost join_cluster rabbit1@localhost
Clustering node rabbit2@localhost with rabbit1@localhost
[root@localhost ~]# rabbitmqctl -n rabbit2@localhost start_app
Starting node rabbit2@localhost ...
 completed with 3 plugins.
[root@localhost ~]# rabbitmqctl -n rabbit3@localhost stop_app
Stopping rabbit application on node rabbit3@localhost ...
[root@localhost ~]# rabbitmqctl -n rabbit3@localhost reset
Resetting node rabbit3@localhost ...
[root@localhost ~]# rabbitmqctl -n rabbit3@localhost join_cluster rabbit1@localhost
Clustering node rabbit3@localhost with rabbit1@localhost
[root@localhost ~]# rabbitmqctl -n rabbit3@localhost start_app
Starting node rabbit3@localhost ...
 completed with 3 plugins.
[root@localhost ~]# rabbitmqctl -n rabbit1@localhost cluster_status
Cluster status of node rabbit1@localhost ...
[{nodes,[{disc,[rabbit1@localhost,rabbit2@localhost,rabbit3@localhost]}]},
 {running_nodes,[rabbit3@localhost,rabbit2@localhost,rabbit1@localhost]},
 {cluster_name,<<"rabbit1@localhost">>},
 {partitions,[]},
 {alarms,[{rabbit3@localhost,[]},
          {rabbit2@localhost,[]},
          {rabbit1@localhost,[]}]}]

不知道为什么localhost和我本机的192.168.206.128的IP不是一样的吗,但是报错,首先说一下我遇到的坑就是如果按照大多数教程中去rabbitmqctl -n rabbit2 stop_app,我第一个是成功的,但是第二个就不成功了,一直报错,连接不到,并且第二个加上localhost也没有用,可能是跟rabbit1 reset有关系吧,这里我是直接启动三个节点但是只stopapp,reset第二个和第三个了,
然后注意我们单机版创建的用户在集群模式下由于reset可能已经消失,所以需要重新滚创建用户

谢谢大佬的文章

再推荐一篇文章

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值