修改node类型
一个集群中运行着的node,可以动态地切换类型
代码语言:javascript复制[root@h101 ~]# rabbitmqctl -n rabbit cluster_status
Cluster status of node rabbit@h101 ...
[{nodes,[{disc,[hare@h101]},{ram,[rabbit@h101]}]},
{running_nodes,[hare@h101,rabbit@h101]},
{cluster_name,<<"hare@h101.temp">>},
{partitions,[]}]
[root@h101 ~]# rabbitmqctl -n rabbit stop_app
Stopping node rabbit@h101 ...
[root@h101 ~]# rabbitmqctl -n hare cluster_status
Cluster status of node hare@h101 ...
[{nodes,[{disc,[hare@h101]},{ram,[rabbit@h101]}]},
{running_nodes,[hare@h101]},
{cluster_name,<<"hare@h101.temp">>},
{partitions,[]}]
[root@h101 ~]# rabbitmqctl -n rabbit change_cluster_node_type disc
Turning rabbit@h101 into a disc node ...
[root@h101 ~]# rabbitmqctl -n rabbit start_app
Starting node rabbit@h101 ...
[root@h101 ~]# rabbitmqctl -n rabbit cluster_status
Cluster status of node rabbit@h101 ...
[{nodes,[{disc,[hare@h101,rabbit@h101]}]},
{running_nodes,[hare@h101,rabbit@h101]},
{cluster_name,<<"hare@h101.temp">>},
{partitions,[]}]
[root@h101 ~]# rabbitmqctl -n hare stop_app
Stopping node hare@h101 ...
[root@h101 ~]# rabbitmqctl -n hare change_cluster_node_type ram
Turning hare@h101 into a ram node ...
[root@h101 ~]# rabbitmqctl -n hare start_app
Starting node hare@h101 ...
[root@h101 ~]# rabbitmqctl -n rabbit cluster_status
Cluster status of node rabbit@h101 ...
[{nodes,[{disc,[rabbit@h101]},{ram,[hare@h101]}]},
{running_nodes,[hare@h101,rabbit@h101]},
{cluster_name,<<"hare@h101.temp">>},
{partitions,[]}]
[root@h101 ~]#
一个node 停止应用后,会对集群中剩余node的负载产生一定的影响,所以最好是在业务低峰进行以上操作
命令汇总
- rabbitmqctl -n hare stop_app
- rabbitmqctl -n hare reset
- rabbitmqctl -n hare start_app
- rabbitmqctl -n hare status
- rabbitmqctl -n hare cluster_status
- rabbitmqctl -n rabbit join_cluster –ram hare@h101
- rabbitmqctl -n rabbit change_cluster_node_type disc
- rabbitmqctl -n hare change_cluster_node_type ram
原文地址