Giter VIP home page Giter VIP logo

alpine-rabbitmq-autocluster's Introduction

alpine-rabbitmq-autocluster

Small RabbitMQ image (~42MB) with the autocluster plugin

RabbitMQ Version: 3.6.2 Autocluster Version: 0.6.1

Stars Pulls

Enabled plugins

  • Autocluster
  • Consistent Hash Exchange
  • Delayed Message Exchange
  • Federation
  • Federation Management
  • Management
  • Management Visualiser
  • Message Timestamp
  • MQTT
  • Recent History Exchange
  • Sharding
  • Shovel
  • Shovel Management
  • Stomp
  • Top
  • WebStomp

Configuration

All configuration of the auto-cluster plugin should be done via environment variables.

See the RabbitMQ AutoCluster plugin Wiki for configuration settings.

Example Usage

The following example configures the autocluster plugin for use in an AWS EC2 Autoscaling group:

docker run --name rabbitmq -d \
  -e AUTOCLUSTER_TYPE=aws \
  -e AUTOCLUSTER_CLEANUP=true \
  -e CLEANUP_WARN_ONLY=false \
  -e AWS_DEFAULT_REGION=us-east-1 \
  -p 4369:4369 \
  -p 5672:5672 \
  -p 15672:15672 \
  -p 25672:25672 \
  gavinmroy/alpine-rabbitmq-autocluster

To use the AWS autocluster features, you will need an IAM policy that allows the plugin to discover the node list. The following is an example of such a policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "autoscaling:DescribeAutoScalingInstances",
                "ec2:DescribeInstances"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

If you do not want to use the IAM role for the instances, you could create a role and specify the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY when starting the container.

I've included a CloudFormation template that should let you test the plugin. The template creates an IAM Policy and Role, Security Group, ELB, Launch Configuration, and Autoscaling group.

The following is the user data snippet that for the Ubuntu image that is used in the Launch Configuration:

#cloud-config
apt_update: true
apt_upgrade: true
apt_sources:
  - source: deb https://apt.dockerproject.org/repo ubuntu-trusty main
    keyid: 58118E89F3A912897C070ADBF76221572C52609D
    filename: docker.list
packages:
  - docker-engine
runcmd:
  - export AWS_DEFAULT_REGION=`ec2metadata --availability-zone | sed s'/.$//'`
  - docker run -d --name rabbitmq --net=host -p 4369:4369 -p 5672:5672 -p 15672:15672 -p 25672:25672 -e AUTOCLUSTER_TYPE=aws -e AWS_AUTOSCALING=true -e AUTOCLUSTER_CLEANUP=true -e CLEANUP_WARN_ONLY=false -e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION gavinmroy/alpine-rabbitmq-autocluster:3.6.2-0.6.0

alpine-rabbitmq-autocluster's People

Contributors

gmr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

alpine-rabbitmq-autocluster's Issues

RabbitMQ AutoCluster using Consul is not working

I tried using alpine-rabbitmq-autocluster to setup RabbitMQ AutoCluster using Consul but I am getting the below error. Please share your inputs in case I am missing anything in the configuration.

I am attaching the config and error details

  • rabbitmq.config
[
  {
    rabbit,
    [
      {loopback_users, []},
      {cluster_partition_handling, autoheal},
      {delegate_count, 64},
      {fhc_read_buffering, false},
      {fhc_write_buffering, false},
      {heartbeat, 60},
      {queue_index_embed_msgs_below, 0},
      {queue_index_max_journal_entries, 8192},
      {log_levels, [{autocluster, info},
                    {connection, error},
                    {channel, warning},
                    {federation, info},
                    {mirroring, info},
                    {shovel, info}]},
      {vm_memory_high_watermark, 0.8}
    ]
  }
].
  • consul.sh
docker run --rm -t -i --name=consul \
	-p 8500:8500 \
	gavinmroy/alpine-consul:0.5.2-0
  • startrabbit_1.sh
docker run -h 192.168.99.100 --link=consul --name=node1 -d \
--net=host \
-e AUTOCLUSTER_TYPE=consul \
-e CONSUL_SCHEME=http \
-e CONSUL_HOST=192.168.99.100 \
-e CONSUL_PORT=8500 \
-e CONSUL_SVC=rabbitmq \
-e CONSUL_SVC_ADDR=node1 \
-e CONSUL_SVC_TTL=60 \
-e RABBITMQ_USE_LONGNAME=true \
-e RABBITMQ_NODENAME=node1 \
-p 4369:4369 \
-p 5672:5672 \
-p 15672:15672 \
-p 25672:25672 \
tandv001/alpine-rabbitmq-autocluster:1.0
  • startrabbit_2.sh
docker run -h 192.168.99.100 --link=consul --name=node2 -d \
--net=host \
-e AUTOCLUSTER_TYPE=consul \
-e CONSUL_SCHEME=http \
-e CONSUL_HOST=192.168.99.100 \
-e CONSUL_PORT=8500 \
-e CONSUL_SVC=rabbitmq \
-e CONSUL_SVC_ADDR=node2 \
-e CONSUL_SVC_TTL=60 \
-e RABBITMQ_USE_LONGNAME=true \
-e RABBITMQ_NODENAME=node2 \
-p 4370:4369 \
-p 5673:5672 \
-p 15673:15672 \
-p 25673:25672 \
tandv001/alpine-rabbitmq-autocluster:1.0
[
{
"Node": "67593aa3ad38",
"Address": "172.17.0.2",
"ServiceID": "rabbitmq:node1",
"ServiceName": "rabbitmq",
"ServiceTags": null,
"ServiceAddress": "node1",
"ServicePort": 5672
},
{
"Node": "67593aa3ad38",
"Address": "172.17.0.2",
"ServiceID": "rabbitmq:node2",
"ServiceName": "rabbitmq",
"ServiceTags": null,
"ServiceAddress": "node2",
"ServicePort": 5672
}
]
  • Consul Health Check
[
{
"Node": {
"Node": "consul",
"Address": "172.17.0.2"
},
"Service": {
"ID": "rabbitmq:node1",
"Service": "rabbitmq",
"Tags": null,
"Address": "node1",
"Port": 5672
},
"Checks": [
{
"Node": "consul",
"CheckID": "service:rabbitmq:node1",
"Name": "Service 'rabbitmq' check",
"Status": "passing",
"Notes": "RabbitMQ Auto-Cluster Plugin TTL Check",
"Output": "",
"ServiceID": "rabbitmq:node1",
"ServiceName": "rabbitmq"
},
{
"Node": "consul",
"CheckID": "serfHealth",
"Name": "Serf Health Status",
"Status": "passing",
"Notes": "",
"Output": "Agent alive and reachable",
"ServiceID": "",
"ServiceName": ""
}
]
},
{
"Node": {
"Node": "consul",
"Address": "172.17.0.2"
},
"Service": {
"ID": "rabbitmq:node2",
"Service": "rabbitmq",
"Tags": null,
"Address": "node2",
"Port": 5672
},
"Checks": [
{
"Node": "consul",
"CheckID": "service:rabbitmq:node2",
"Name": "Service 'rabbitmq' check",
"Status": "critical",
"Notes": "RabbitMQ Auto-Cluster Plugin TTL Check",
"Output": "",
"ServiceID": "rabbitmq:node2",
"ServiceName": "rabbitmq"
},
{
"Node": "consul",
"CheckID": "serfHealth",
"Name": "Serf Health Status",
"Status": "passing",
"Notes": "",
"Output": "Agent alive and reachable",
"ServiceID": "",
"ServiceName": ""
}
]
}
]

Unable to start rabbitmq server

Hi,

I'm trying to start my rabbitmq server, while I can successfully build the docker image the server will always fail to boot and I get the following error description:

BOOT FAILED
===========

Error description:
   {error,{cannot_log_to_file,"-",{error,eacces}}}

Log files (may contain more information):
   -
   -

Stack trace:
   [{rabbit,ensure_working_log_handler,5,[]},
    {rabbit,ensure_working_log_handlers,0,[]},
    {rabbit,'-boot/0-fun-1-',0,[]},
    {rabbit,start_it,1,[]},
    {init,start_em,1,[]},
    {init,do_boot,3,[]}]

init terminating in do_boot ()
{"init terminating in do_boot",{rabbit,failure_during_boot,{error,{cannot_log_to_file,"-",{error,eacces}}}}}

I'm setting up the correct permissions as per the sample dockerfile

RUN chown -R rabbitmq /var/lib/rabbitmq/.erlang.cookie /var/lib/rabbitmq /usr/lib/rabbitmq

and setting the environmental variables in the same manner:

ENV RABBITMQ_LOGS=-
ENV RABBITMQ_SASL_LOGS=-

Unlike the original dockerfile I am required to use a previous version of [email protected]

Am I missing something that would stop the server from starting correctly?
I'm new to rabbitmq so any help would be greatly appreciated.

Thanks in advance!

Not able to add users

I have been trying to add users to rabbit, but i am not able to do it. Can you help me out to figure out if i am doing something wrong

Cluster does not accept connections?

Using the CloudFormation stack - as is but running in eu-west-1, I see the clustering mechanism working as expected but I cannot make a connection from my client code (the management interface is available). Looking at the logs I get the following messages:

`=CRASH REPORT==== 6-Jun-2016::12:38:56 ===
crasher:
initial call: gen:init_it/6
pid: <0.5973.3>
registered_name: []
exception exit: {amqp_error,internal_error,
"Interceptor: more than one module handles {set,1,16,16,8,80,48,\n {[],[],[],[],[],[],[],[],[],[],[],\n [],[],[],[],[]},\n {{[],[],[],[],[],[],[],[],\n ['basic.publish'],\n [],[],[],[],[],[],[]}}}\n",
none}
in function gen_server2:init_it/6 (src/gen_server2.erl, line 601)
ancestors: [<0.5970.3>,<0.5968.3>,<0.5962.3>,<0.5961.3>,<0.859.0>,
<0.858.0>,<0.857.0>,rabbit_sup,<0.82.0>]
messages: []
links: [<0.5970.3>]
dictionary: [{process_name,
{rabbit_channel,
{<<"80.255.245.230:39333 -> 172.31.3.42:5672">>,
1}}}]
trap_exit: true
status: running
heap_size: 1598
stack_size: 27
reductions: 2212
neighbours:

=CRASH REPORT==== 6-Jun-2016::12:38:56 ===
crasher:
initial call: rabbit_reader:init/4
pid: <0.5963.3>
registered_name: []
exception error: no match of right hand side value
{error,
{'EXIT',
{{badmatch,
{error,
{{amqp_error,internal_error,
"Interceptor: more than one module handles {set,1,16,16,8,80,48,\n {[],[],[],[],[],[],[],[],[],[],[],\n [],[],[],[],[]},\n {{[],[],[],[],[],[],[],[],\n ['basic.publish'],\n [],[],[],[],[],[],[]}}}\n",
none},
{child,undefined,channel,
{rabbit_channel,start_link,
[1,<0.5963.3>,<0.5971.3>,<0.5963.3>,
<<"80.255.245.230:39333 -> 172.31.3.42:5672">>,
rabbit_framing_amqp_0_9_1,
{user,<<"guest">>,
[administrator],
[{rabbit_auth_backend_internal,none}]},
<<"/">>,
[{<<"connection.blocked">>,bool,true},
{<<"authentication_failure_close">>,bool,true},
{<<"consumer_cancel_notify">>,bool,true},
{<<"publisher_confirms">>,bool,true},
{<<"basic.nack">>,bool,true}],
<0.5965.3>,<0.5972.3>]},
intrinsic,70000,worker,
[rabbit_channel]}}}},
[{rabbit_channel_sup,start_link,1,
[{file,"src/rabbit_channel_sup.erl"},{line,67}]},
{supervisor2,do_start_child_i,3,
[{file,"src/supervisor2.erl"},{line,437}]},
{supervisor2,handle_call,3,
[{file,"src/supervisor2.erl"},{line,463}]},
{gen_server,try_handle_call,4,
[{file,"gen_server.erl"},{line,629}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,661}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,240}]}]}}}
in function rabbit_reader:create_channel/2 (src/rabbit_reader.erl, line 916)
in call from rabbit_reader:process_frame/3 (src/rabbit_reader.erl, line 972)
in call from rabbit_reader:handle_input/3 (src/rabbit_reader.erl, line 1035)
in call from rabbit_reader:recvloop/4 (src/rabbit_reader.erl, line 446)
in call from rabbit_reader:run/1 (src/rabbit_reader.erl, line 428)
in call from rabbit_reader:start_connection/4 (src/rabbit_reader.erl, line 386)
ancestors: [<0.5961.3>,<0.859.0>,<0.858.0>,<0.857.0>,rabbit_sup,
<0.82.0>]
messages: [{'EXIT',#Port<0.41801>,normal}]
links: [<0.5961.3>]
dictionary: [{process_name,
{rabbit_reader,
<<"80.255.245.230:39333 -> 172.31.3.42:5672">>}}]
trap_exit: true
status: running
heap_size: 2586
stack_size: 27
reductions: 3992
neighbours:

=SUPERVISOR REPORT==== 6-Jun-2016::12:38:56 ===
Supervisor: {<0.5961.3>,rabbit_connection_sup}
Context: child_terminated
Reason: {badmatch,
{error,
{'EXIT',
{{badmatch,
{error,
{{amqp_error,internal_error,
"Interceptor: more than one module handles {set,1,16,16,8,80,48,\n {[],[],[],[],[],[],[],[],[],[],[],\n [],[],[],[],[]},\n {{[],[],[],[],[],[],[],[],\n ['basic.publish'],\n [],[],[],[],[],[],[]}}}\n",
none},
{child,undefined,channel,
{rabbit_channel,start_link,
[1,<0.5963.3>,<0.5971.3>,<0.5963.3>,
<<"80.255.245.230:39333 -> 172.31.3.42:5672">>,
rabbit_framing_amqp_0_9_1,
{user,<<"guest">>,
[administrator],
[{rabbit_auth_backend_internal,none}]},
<<"/">>,
[{<<"connection.blocked">>,bool,true},
{<<"authentication_failure_close">>,bool,true},
{<<"consumer_cancel_notify">>,bool,true},
{<<"publisher_confirms">>,bool,true},
{<<"basic.nack">>,bool,true}],
<0.5965.3>,<0.5972.3>]},
intrinsic,70000,worker,
[rabbit_channel]}}}},
[{rabbit_channel_sup,start_link,1,
[{file,"src/rabbit_channel_sup.erl"},{line,67}]},
{supervisor2,do_start_child_i,3,
[{file,"src/supervisor2.erl"},{line,437}]},
{supervisor2,handle_call,3,
[{file,"src/supervisor2.erl"},{line,463}]},
{gen_server,try_handle_call,4,
[{file,"gen_server.erl"},{line,629}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,661}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,240}]}]}}}}
Offender: [{pid,<0.5963.3>},
{name,reader},
{mfargs,
{rabbit_reader,start_link,
[<0.5962.3>,
{acceptor,{0,0,0,0,0,0,0,0},5672},
#Port<0.41801>]}},
{restart_type,intrinsic},
{shutdown,4294967295},
{child_type,worker}]

=SUPERVISOR REPORT==== 6-Jun-2016::12:38:56 ===
Supervisor: {<0.5961.3>,rabbit_connection_sup}
Context: shutdown
Reason: reached_max_restart_intensity
Offender: [{pid,<0.5963.3>},
{name,reader},
{mfargs,
{rabbit_reader,start_link,
[<0.5962.3>,
{acceptor,{0,0,0,0,0,0,0,0},5672},
#Port<0.41801>]}},
{restart_type,intrinsic},
{shutdown,4294967295},
{child_type,worker}]`

Any idea what could be causing this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.