[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可能已经消失,所以需要重新滚创建用户