前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >RabbitMQ集群II1

RabbitMQ集群II1

作者头像
franket
发布2022-05-03 11:04:54
2950
发布2022-05-03 11:04:54
举报
文章被收录于专栏:技术杂记

单机集群

在同一个OS中运行多个RabbitMQ node主要要满足以下两个条件:

  • 1 每一个node使用的名字不能重复
  • 2 每一个node使用的port / IP不能重复
代码语言:javascript
复制
[root@h101 ~]# rabbitmqctl  status
Status of node rabbit@h101 ...
Error: unable to connect to node rabbit@h101: nodedown

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

attempted to contact: [rabbit@h101]

rabbit@h101:
  * connected to epmd (port 4369) on h101
  * epmd reports: node 'rabbit' not running at all
                  no other nodes on h101
  * suggestion: start the node

current node details:
- node name: 'rabbitmq-cli-2840@h101'
- home dir: /var/lib/rabbitmq
- cookie hash: FkPvQU6k3zuamsY9Ow+9Og==

[root@h101 ~]# 
[root@h101 ~]# free -m 
             total       used       free     shared    buffers     cached
Mem:          3824        659       3165          0         20         84
-/+ buffers/cache:        553       3271
Swap:         3999          0       3999
[root@h101 ~]# 

使用不同名字,不同端口,分别从后台启动两个服务进程

代码语言:javascript
复制
[root@h101 ~]# RABBITMQ_NODE_PORT=5672 RABBITMQ_NODENAME=rabbit rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
[root@h101 ~]# ps faux | grep mq 
root      3054  0.0  0.0 103252   828 pts/0    S+   14:21   0:00          \_ grep mq
rabbitmq  2888  0.0  0.0  10828   468 ?        S    14:14   0:00 /usr/lib64/erlang/erts-5.8.5/bin/epmd -daemon
rabbitmq  2975 22.7  0.8 1088040 33292 ?       Sl   14:21   0:02 /usr/lib64/erlang/erts-5.8.5/bin/beam.smp -W w -A 64 -P 1048576 -K erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.6/sbin/../ebin -noshell -noinput -st -boot start_sasl -kernel inet_default_connect_options [{nodelay,true}] -rabbit tcp_listeners [{"auto",5672}] -sasl errlog_type errr false -rabbit error_logger {file,"/var/log/rabbitmq/rabbit.log"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/rabbit-sasl.lons_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/lib/rabbitmq/lib/rabbitmq_server-3.5.6/sbin/../plugins" -rabbit plb/rabbitmq/mnesia/rabbit-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia esia/rabbit" -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672 -noshell -noinput
rabbitmq  3050  0.0  0.0  10792   508 ?        Ss   14:21   0:00  \_ inet_gethost 4
rabbitmq  3051  0.0  0.0  12896   648 ?        S    14:21   0:00      \_ inet_gethost 4
[root@h101 ~]# RABBITMQ_NODE_PORT=5673 RABBITMQ_NODENAME=hare rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
[root@h101 ~]# ps faux | grep mq 
root      3196  0.0  0.0 103252   824 pts/0    S+   14:22   0:00          \_ grep mq
rabbitmq  2888  0.0  0.0  10828   468 ?        S    14:14   0:00 /usr/lib64/erlang/erts-5.8.5/bin/epmd -daemon
rabbitmq  2975  8.6  0.8 1088040 33292 ?       Sl   14:21   0:02 /usr/lib64/erlang/erts-5.8.5/bin/beam.smp -W w -A 64 -P 1048576 -K erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.6/sbin/../ebin -noshell -noinput -st -boot start_sasl -kernel inet_default_connect_options [{nodelay,true}] -rabbit tcp_listeners [{"auto",5672}] -sasl errlog_type errr false -rabbit error_logger {file,"/var/log/rabbitmq/rabbit.log"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/rabbit-sasl.lons_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/lib/rabbitmq/lib/rabbitmq_server-3.5.6/sbin/../plugins" -rabbit plb/rabbitmq/mnesia/rabbit-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia esia/rabbit" -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672 -noshell -noinput
rabbitmq  3050  0.0  0.0  10792   508 ?        Ss   14:21   0:00  \_ inet_gethost 4
rabbitmq  3051  0.0  0.0  12896   648 ?        S    14:21   0:00      \_ inet_gethost 4
rabbitmq  3116 29.8  0.8 1087524 33684 ?       Sl   14:21   0:01 /usr/lib64/erlang/erts-5.8.5/bin/beam.smp -W w -A 64 -P 1048576 -K erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.5.6/sbin/../ebin -noshell -noinput -s-boot start_sasl -kernel inet_default_connect_options [{nodelay,true}] -rabbit tcp_listeners [{"auto",5673}] -sasl errlog_type errorfalse -rabbit error_logger {file,"/var/log/rabbitmq/hare.log"} -rabbit sasl_error_logger {file,"/var/log/rabbitmq/hare-sasl.log"} -re "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/lib/rabbitmq/lib/rabbitmq_server-3.5.6/sbin/../plugins" -rabbit plugins_itmq/mnesia/hare-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/vae" -kernel inet_dist_listen_min 25673 -kernel inet_dist_listen_max 25673 -noshell -noinput
rabbitmq  3191  0.0  0.0  10792   508 ?        Ss   14:21   0:00  \_ inet_gethost 4
rabbitmq  3192  0.0  0.0  12896   648 ?        S    14:21   0:00      \_ inet_gethost 4
[root@h101 ~]#

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 单机集群
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档