Skip to content

Instantly share code, notes, and snippets.

@Almad
Created January 27, 2011 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Almad/798431 to your computer and use it in GitHub Desktop.
Save Almad/798431 to your computer and use it in GitHub Desktop.
How to break RabbitMQ cluster
Scenarios created by Petr Svoboda, kudos to @centrumholdings Operations Department
#############
# Scenario no. 1
#
# @psvo-lenny32
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
# @psvo-lenny64
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl cluster rabbit@psvo-lenny{32,64}
rabbitmqctl start_app
# @psvo-lenny32
python <<EOF
import amqplib.client_0_8 as amqp
conn = amqp.Connection('psvo-lenny64')
ch = conn.channel()
ch.queue_declare('test')
ch.close()
conn.close()
EOF
# @psvo-lenny64
rabbitmqctl stop_app
rabbitmqctl start_app
# test queue now gone, as it's not persistent
# @psvo-lenny32
python <<EOF
import amqplib.client_0_8 as amqp
conn = amqp.Connection('psvo-lenny64')
ch = conn.channel()
ch.queue_declare('test')
ch.close()
conn.close()
EOF
# and we're hanging
#############
# Scenario no. 2
#
# @psvo-lenny32
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
# @psvo-lenny64
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl cluster rabbit@psvo-lenny{32,64}
rabbitmqctl start_app
# @psvo-lenny32
python <<EOF
import amqplib.client_0_8 as amqp
conn = amqp.Connection('psvo-lenny64')
ch = conn.channel()
ch.queue_declare('test', durable=True)
ch.close()
conn.close()
EOF
# @psvo-lenny64
rabbitmqctl stop_app
# @psvo-lenny32
rabbitmqctl list_queues
# and we're hanging, stopping with ctrl+c
# @psvo-lenny32
python <<EOF
import amqplib.client_0_8 as amqp
conn = amqp.Connection('psvo-lenny32')
ch = conn.channel()
ch.queue_declare('test', durable=True)
ch.close()
conn.close()
EOF
# @psvo-lenny64
rabbitmqctl start_app
# @psvo-lenny32
rabbitmqctl stop_app
# hanging, cannot restart, we have to kill...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment