RabbitMQ: 从配置文件创建集群
2011-04-19 23:22
309 查看
作者:Hily
原始链接:http://hily.me/blog/2010/05/rabbitmq-cluster-from-configfile/
版权声明:可以转载,转载时务必以超链接形式标明文章原始出处
和作者信息
及版权声明
前一篇日志简单演示了下手动创建集群的过程,可能你已经发现以命令行的方式创建集群多少有些繁琐。
RabbitMQ 提供了一种创建集群的便捷方法——从配置文件创建集群。
环境变量 RABBITMQ_CLUSTER_CONFIG_FILE 指定了集群配置文件所在路径,默认为:/etc/rabbitmq/rabbitmq_cluster.config。
如果需要,可以在启动 RabbitMQ Server 前设置它来改变配置文件路径。
只需要把要组成集群的各个节点以数组的方式写在配置文件中即可,示例:
['test1@gentoo', 'test2@gentoo', 'test3@gentoo'].
清除上篇文章中创建的3个节点:
# ./rabbitmqctl -n test1@gentoo stop_app
Stopping node test1@gentoo ...
...done.
# ./rabbitmqctl -n test1@gentoo reset
Resetting node test1@gentoo ...
...done.
# ./rabbitmqctl -n test1@gentoo stop
Stopping and halting node test1@gentoo ...
...done.
# ./rabbitmqctl -n test2@gentoo stop_app
Stopping node test2@gentoo ...
...done.
# ./rabbitmqctl -n test2@gentoo reset
Resetting node test2@gentoo ...
...done.
# ./rabbitmqctl -n test2@gentoo stop
Stopping and halting node test2@gentoo ...
...done.
# ./rabbitmqctl -n test3@gentoo stop_app
Stopping node test3@gentoo ...
...done.
# ./rabbitmqctl -n test3@gentoo reset
Resetting node test3@gentoo ...
...done.
# ./rabbitmqctl -n test3@gentoo stop
Stopping and halting node test3@gentoo ...
...done.
然后分别启动 RabbitMQ Server 即可(启动时,以上集群配置就会被加载到节点上)。
# export RABBITMQ_NODENAME=test1
# export RABBITMQ_NODE_PORT=5672
# ./rabbitmq-server -detached
# export RABBITMQ_NODENAME=test2
# export RABBITMQ_NODE_PORT=5673
# ./rabbitmq-server -detached
# export RABBITMQ_NODENAME=test3
# export RABBITMQ_NODE_PORT=5674
# ./rabbitmq-server -detached
查看下3个节点的状态:
# ./rabbitmqctl -n test1@gentoo status
Status of node test1@gentoo ...
[...,
{nodes,[test3@gentoo,test2@gentoo,test1@gentoo]},
{running_nodes,[test3@gentoo,test2@gentoo,test1@gentoo]}]
...done.
# ./rabbitmqctl -n test2@gentoo status
Status of node test2@gentoo ...
[...,
{nodes,[test3@gentoo,test2@gentoo,test1@gentoo]},
{running_nodes,[test3@gentoo,test1@gentoo,test2@gentoo]}]
...done.
# ./rabbitmqctl -n test3@gentoo status
Status of node test3@gentoo ...
[...,
{nodes,[test3@gentoo,test2@gentoo,test1@gentoo]},
{running_nodes,[test2@gentoo,test1@gentoo,test3@gentoo]}]
...done.
集群创建完毕!
你可能会问,如何指定某个节点为 ram node 还是 disk node。
通过这种方式创建出来的节点,都是 disk node。
如果需要修改为 ram node,目前只能通过命令来完成了。
原始链接:http://hily.me/blog/2010/05/rabbitmq-cluster-from-configfile/
版权声明:可以转载,转载时务必以超链接形式标明文章原始出处
和作者信息
及版权声明
前一篇日志简单演示了下手动创建集群的过程,可能你已经发现以命令行的方式创建集群多少有些繁琐。
RabbitMQ 提供了一种创建集群的便捷方法——从配置文件创建集群。
环境变量 RABBITMQ_CLUSTER_CONFIG_FILE 指定了集群配置文件所在路径,默认为:/etc/rabbitmq/rabbitmq_cluster.config。
如果需要,可以在启动 RabbitMQ Server 前设置它来改变配置文件路径。
只需要把要组成集群的各个节点以数组的方式写在配置文件中即可,示例:
['test1@gentoo', 'test2@gentoo', 'test3@gentoo'].
清除上篇文章中创建的3个节点:
# ./rabbitmqctl -n test1@gentoo stop_app
Stopping node test1@gentoo ...
...done.
# ./rabbitmqctl -n test1@gentoo reset
Resetting node test1@gentoo ...
...done.
# ./rabbitmqctl -n test1@gentoo stop
Stopping and halting node test1@gentoo ...
...done.
# ./rabbitmqctl -n test2@gentoo stop_app
Stopping node test2@gentoo ...
...done.
# ./rabbitmqctl -n test2@gentoo reset
Resetting node test2@gentoo ...
...done.
# ./rabbitmqctl -n test2@gentoo stop
Stopping and halting node test2@gentoo ...
...done.
# ./rabbitmqctl -n test3@gentoo stop_app
Stopping node test3@gentoo ...
...done.
# ./rabbitmqctl -n test3@gentoo reset
Resetting node test3@gentoo ...
...done.
# ./rabbitmqctl -n test3@gentoo stop
Stopping and halting node test3@gentoo ...
...done.
然后分别启动 RabbitMQ Server 即可(启动时,以上集群配置就会被加载到节点上)。
# export RABBITMQ_NODENAME=test1
# export RABBITMQ_NODE_PORT=5672
# ./rabbitmq-server -detached
# export RABBITMQ_NODENAME=test2
# export RABBITMQ_NODE_PORT=5673
# ./rabbitmq-server -detached
# export RABBITMQ_NODENAME=test3
# export RABBITMQ_NODE_PORT=5674
# ./rabbitmq-server -detached
查看下3个节点的状态:
# ./rabbitmqctl -n test1@gentoo status
Status of node test1@gentoo ...
[...,
{nodes,[test3@gentoo,test2@gentoo,test1@gentoo]},
{running_nodes,[test3@gentoo,test2@gentoo,test1@gentoo]}]
...done.
# ./rabbitmqctl -n test2@gentoo status
Status of node test2@gentoo ...
[...,
{nodes,[test3@gentoo,test2@gentoo,test1@gentoo]},
{running_nodes,[test3@gentoo,test1@gentoo,test2@gentoo]}]
...done.
# ./rabbitmqctl -n test3@gentoo status
Status of node test3@gentoo ...
[...,
{nodes,[test3@gentoo,test2@gentoo,test1@gentoo]},
{running_nodes,[test2@gentoo,test1@gentoo,test3@gentoo]}]
...done.
集群创建完毕!
你可能会问,如何指定某个节点为 ram node 还是 disk node。
通过这种方式创建出来的节点,都是 disk node。
如果需要修改为 ram node,目前只能通过命令来完成了。
相关文章推荐
- Swarm创建docker集群:服务发现-配置文件法
- linux创建用户 限制权限-用户(User)和用户组(Group)配置文件详解
- Java API 自带的日志管理,可配置文件路径,并自动创建不存在的目录
- RabbitMQ集群配置
- 通过spring tool 直接创建spring的配置文件
- mysql cluster 集群配置文件
- SCVMM2012功能测试(3)―创建来宾OS配置文件和硬件配置文件
- Hadoop集群中hosts文件配置问题
- CentOS下torque集群配置(二)集群中配置NFS实现文件共享
- vue-cli创建的项目不需要再创建webpack-config.js文件,因为已经配置过了
- 文件服务器的配置与管理(3) 共享文件夹的创建与使用
- 创建maven项目,将该配置文件运行即可生成 sql 语句
- 若要使他人能够在远程计算机上查看此特定错误消息的详细信息,请在位于当前 Web 应用程序根目录下的“web.config”配置文件中创建一个 <customErrors> 标记。然后应将此 <cust
- CentOS linux 下rabbitmq基于单机的集群配置
- IOS开发创建开发证书及发布App应用(四)——创建配置概要文件
- 读取与创建配置文件
- 【VMCloud云平台】SCVMM配置(七)创建SQL服务模板之SQL配置文件
- ios中pch文件的创建与配置
- RabbitMQ的安装,配置,监控 ,集群安装 心得
- HUE配置文件hue.ini 的liboozie和oozie模块详解(图文详解)(分HA集群)