RabbitMq

class playback.rabbitmq.RabbitMq(user='ubuntu', hosts=None, key_filename=None, password=None, parallel=True, *args, **kwargs)

Bases: playback.common.Common

RabbitMQ HA Installation

Parameters:
  • user(str) – the user for remote server to login
  • hosts(list) – this is a second param
  • key_filename(str) – the ssh private key to used, default None
  • password(str) – the password for remote server
  • parallel(bool) – paralleler execute on remote server, default True
Returns:

None

Examples:
# create a rabbit instance
rabbit = RabbitMq(
    user='ubuntu',
    hosts=['controller1', 'controller2']
)

# install rabbit on controller1 and controller2
rabbit.install(
    erlang_cookie='changemechangeme',
    rabbit_user='openstack',
    rabbit_pass='changeme'
)

# create cluster, ensure controller2 can access controller1 via hostname
rabbit_controller2 = RabbitMq(
    user='ubuntu',
    hosts=['controller2']
)
rabbit_controller2.join_cluster(name='rabbit@controller1')
install(*args, **kwargs)

Install rabbitmq

Parameters:
  • erlang_cookie – setup elang cookie
  • rabbit_user – set rabbit user name
  • rabbit_pass – set rabbit password of rabbit_user
Returns:

None

join_cluster(*args, **kwargs)

Join to the cluster

Parameters:name – the joined name, e.g. rabbit@CONTROLLER1, ensure the CONTROLLER1 can be accessed by target host
Returns:None