`
sillycat
  • 浏览: 2542831 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

RabbitMQ(10)Update Version and Cluster Configuration

 
阅读更多

RabbitMQ(10)Update Version and Cluster Configuration

1. Installation and Update Check
Check the erlang version first
>erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4

I have the rabbitmq here rabbitmq -> /opt/rabbitmq-3.1.5

Message Acknowledgment
Message acknowledgments are turned on by default. autoAck=true flag will turned them off. 
boolean autoAck = false; 
channel.basicConsume(TASK_QUEUE_NAME, autoAck, consumer); 

When RabbitMQ quits or crashes it will forget the queues and messages unless you tell it not to. We need to mark both the queue and messages as durable. 
boolean durable = true; 
channel.queueDeclare("hello", durable, false, false, null); 

Set the message to persistent 
channel.basicPublish("", TASK_QUEUE_NAME, 
MessageProperties.PERSISTENT_TEXT_PLAIN, message.getBytes()); 
The persistence guarantees aren't strong, but it's more than enough for our simple task queue. If you need a stronger guarantee you can wrap the publishing code in a transaction. 

Fair dispatch 
In order to defeat that we can use the basicQos method with the prefetchCount = 1 setting. This tells RabbitMQ not to give more than one message to a worker at a time. Or, in other words, don't dispatch a new message to a worker until it has processed and acknowledged the previous one. Instead, it will dispatch it to the next worker that is not still busy. 

int prefetchCount = 1; 
channel.basicQos(prefetchCount); 

Update the version to 3.3.1
>sudo ln -s /Users/carl/tool/rabbitmq_server-3.3.1 /opt/rabbitmq-3.3.1
>sudo ln -s /opt/rabbitmq-3.3.1 /opt/rabbitmq

Start the Server
>sudo sbin/rabbitmq-server
Check and Stop the Server
>sudo sbin/rabbitmqctl status
>sudo sbin/rabbitmqctl stop

2. Start the Cluster of RabbitMQ and Using HA-Proxy
http://flyingdutchman.iteye.com/blog/1912690
http://sillycat.iteye.com/blog/2037218

I already have the .erlang.cookie set up.
>chmod 777 ~/.erlang.cookie
>chmod 400 ~/.erlang.cookie
>sudo chown -R carl ~/.erlang.cookie
>sudo chgrp -R staff ~/.erlang.cookie

>enable rabbitmq_management
The following plugins have been enabled:  mochiweb  webmachine  rabbitmq_web_dispatch  amqp_client  rabbitmq_management_agent  rabbitmq_management Plugin configuration has changed. Restart RabbitMQ for changes to take effect.

Start the Nodes
>sudo RABBITMQ_NODE_PORT=5672 RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15672}]" RABBITMQ_NODENAME=rabbit1 sbin/rabbitmq-server -detached

>sudo RABBITMQ_NODE_PORT=5673 RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15673}]" RABBITMQ_NODENAME=rabbit2 sbin/rabbitmq-server -detached

Check status
>sbin/rabbitmqctl -n rabbit2 cluster_status
Cluster status of node rabbit2@sparkworker1 ... [{nodes,[{disc,[rabbit2@sparkworker1]}]}, {running_nodes,[rabbit2@sparkworker1]}, {cluster_name,<<"rabbit2@sparkworker1">>}, {partitions,[]}] ...done.

>sbin/rabbitmqctl -n rabbit1 cluster_status
Cluster status of node rabbit1@sparkworker1 ... [{nodes,[{disc,[rabbit1@sparkworker1]}]}, {running_nodes,[rabbit1@sparkworker1]}, {cluster_name,<<"rabbit1@sparkworker1">>}, {partitions,[]}] ...done.

We can visit the UI Admin Page
http://localhost:15672/#/
http://localhost:15673/#/
Default username and password is guest/guest

Stop and Make the Second Node join Cluster
>sudo sbin/rabbitmqctl -n rabbit2 stop_app
>sbin/rabbitmqctl -n rabbit2 join_cluster rabbit1@sparkworker1
>sudo sbin/rabbitmqctl -n rabbit2 start_app

>sbin/rabbitmqctl -n rabbit1 cluster_status
Cluster status of node rabbit1@sparkworker1 ... [{nodes,[{disc,[rabbit1@sparkworker1,rabbit2@sparkworker1]}]}, {running_nodes,[rabbit2@sparkworker1,rabbit1@sparkworker1]}, {cluster_name,<<"rabbit1@sparkworker1">>}, {partitions,[]}] ...done.

The should be running on 127.0.0.1:5672, 127.0.0.1:5673

I will be working on to put a ha-proxy in front of rabbitmq.

References:
RabbitMQ 1 ~ 9
http://sillycat.iteye.com/blog/1565771 Installation from sources on redhat
http://sillycat.iteye.com/blog/1567052 Installation on ubuntu and redhat
http://sillycat.iteye.com/blog/1575002 Installation on CentOS
http://sillycat.iteye.com/blog/1575314 Java Client - Work Queue
http://sillycat.iteye.com/blog/1575816 Java Client - Publish/Subscribe
http://sillycat.iteye.com/blog/1578635 Java Client - Routing
http://sillycat.iteye.com/blog/1579464 Java Client - Topics
http://sillycat.iteye.com/blog/1582971 Java Client - RPC
http://sillycat.iteye.com/blog/2037218 MAC with Scala and Cluster

http://www.rabbitmq.com/install-generic-unix.html
http://flyingdutchman.iteye.com/blog/1912690

分享到:
评论

相关推荐

    麒麟v10系统Rabbitmq3.6.10安装包

    麒麟v10内核版本为4.19.90-17.ky10.x86_64,这个内核版本应该能够支持RabbitMQ的运行。但在此之前,我们需要安装Erlang编程语言环境,因为RabbitMQ是用Erlang编写的。可以通过以下命令在麒麟v10上安装Erlang: ```...

    RabbitMQ Cluster.docx

    新节点加入时,通常需要使用`rabbitmq-cluster join`命令来指定现有的集群节点,而移除节点则需要使用`rabbitmqctl`工具,这可能涉及数据迁移和状态更新。如果节点出现故障并需要重新加入集群,它必须先被正确地停止...

    docker-rabbitmq-cluster集群搭建

    docker-rabbitmq-cluster集群搭建docker-rabbitmq-cluster集群搭建

    k8s部署rabbitmq-cluster集群配置文件和docker镜像文件

    k8s部署rabbitmq-cluster集群配置文件和docker镜像文件,配合文章学习用,有需要可以下载,无需修改直接部署即可

    rabbitmq-server-windows-3.6.12.zip

    RabbitMQ 3.6.12 is a maintenance release. Upgrades and Compatibility See the "Upgrading clusters" section of the ...To upgrade a RabbitMQ cluster, follow the instructions in RabbitMQ documentation.

    chef-rabbitmq-cluster:厨师食谱,用于配置rabbitmq-cluster。 (Opscode Rabbitmq食谱的包装食谱。)

    ubuntu / trusty64 ubuntu / precise64 厨师/centos-6.5 主厨/debian-7.7属性钥匙类型描述默认['rabbitmq'] ['cluster'] 布尔型['rabbitmq'] ['cluster'] = true,并且需要['rabbitmq'] ['erlang_cookie']来配置...

    rabbitMq window10安装包

    rabbitMq window10安装包

    rabbitmq集群环境搭建

    rabbitmqctl join_cluster --ram rabbit@vm10-10-0-14 rabbitmqctl start_app ``` - **查看集群状态**:通过`rabbitmqctl cluster_status`命令来查看当前集群的状态。 ```bash rabbitmqctl cluster_status `...

    RabbitMq安装包及超详细安装教程

    RabbitMQ是一个强大的开源消息代理和队列服务器,它基于开放标准Advanced Message Queuing Protocol (AMQP)。这款工具主要用于在分布式系统中处理异步任务和消息传递,从而提高应用程序的可扩展性和可靠性。RabbitMQ...

    rabbitmq_cluster.zip

    使用ansible安装rabbitmq集群 需要预先实现控制节点的免密操作 参数说明 #rabbitmq rabbitmq安装目录 work_home: /data/test erlang_rpm安装文件名(放在files文件夹内) erlang_rpm: erlang-20.3.7-1.el7.centos....

    rabbitmq-server-3.9.10.rar

    《深入理解RabbitMQ 3.9.10:服务器详解与实战应用》 RabbitMQ,作为一款广泛应用的消息中间件,是企业级系统中实现异步处理、解耦架构和高并发场景的重要工具。本篇文章将围绕RabbitMQ 3.9.10这一版本,深入探讨其...

    Mastering RabbitMQ(PACKT,2016)

    You’ll begin your journey with the installation and configuration of the RabbitMQ server, while also being given specific details pertaining to the subject. Next, you’ll study the major problems ...

    win10安装rabbitmq的安装包.rar

    在Windows 10上安装RabbitMQ,主要涉及以下步骤: 1. **下载RabbitMQ**: 首先,你需要从RabbitMQ官方网站(https://www.rabbitmq.com/)获取适用于Windows的RabbitMQ Server。这个“mq安装包”可能就是RabbitMQ的...

    kubernetes-rabbitmq-cluster:适用于kubernetes的可部署的Rabbitmq集群

    总结来说,"kubernetes-rabbitmq-cluster"项目提供了一个在Kubernetes中部署和管理RabbitMQ集群的有效方法,利用了Kubernetes的强大力量,实现了RabbitMQ服务的高可用性和可扩展性。通过学习和实践这个项目,开发者...

    离线安装rabbitmq全过程,包含python环境和er环境以及安装包的安装过程

    在IT行业中,RabbitMQ是一种广泛应用的消息队列服务器,它基于AMQP(Advanced Message Queuing Protocol)协议,用于处理应用程序之间的异步通信。在没有网络连接或者网络环境不稳定的情况下,离线安装RabbitMQ就...

    rabbitmq配置文件 rabbitmq.config

    rabbitmq配置文件,用于rabbitmq管理

    rabbitmq3.9.10.zip

    《RabbitMQ 3.9.10源码安装详解》 RabbitMQ,作为一款广泛应用的消息中间件,被广泛用于构建分布式系统中的异步任务处理和数据交换。本文将详细解析RabbitMQ 3.9.10的源码安装过程,包括依赖的Erlang 24.1.7和...

    RabbitMQ3.7 WIN10

    在WIN10 中的RabbitMQ,版本为3.7。

Global site tag (gtag.js) - Google Analytics