sensu / sensu-transport

The Sensu transport abstraction library.
MIT License
14 stars 19 forks source link

Provide failover support using AMQP::Session: reconnect_to method #13

Closed warmfusion closed 7 years ago

warmfusion commented 9 years ago

I'd like to be able to give Sensu a list of RMQ servers for it to attempt to connect to, with failover supported such that if a connection drops, or cannot be established, sensu tries the next server on the list until it suceeds. An increasing retry delay is introduced to protect against hammering servers.

The AMQP gem used to establish the RMQ connection has support for an reconnect_to operation which is used in the event of a connection failure. This could be used to proactivly select which server to rebind the failing connection against.

portertech commented 9 years ago

@warmfusion this is already a feature :+1: Specify an array for RabbitMQ connection options, "rabbitmq": [{}, {}].

warmfusion commented 9 years ago

Hey, that's cheating. Citing undocumented behavior isn't fair. I'm not even sure I know how that functionality works either; I spent a decent amount of time looking at the sensu-transport code trying to work out how it integrates with the AMQP gem, which itself isn't documented very clearly. Boo.

portertech commented 9 years ago

@warmfusion you're right, I've reopened this issue and it will remain open until https://trello.com/c/jaQZropi/33-document-ha-rabbitmq-configuration has been shipped to the doc site.

portertech commented 9 years ago

@warmfusion we should also document the RabbitMQ transport code with Yardoc as I did for the new Redis transport. The RabbitMQ transport randomly sorts the connection options and iterates through them, attempting to create a connection.

portertech commented 9 years ago

https://github.com/sensu/sensu-transport/blob/master/lib/sensu/transport/rabbitmq.rb#L145 https://github.com/sensu/sensu-transport/blob/master/lib/sensu/transport/rabbitmq.rb#L106

cwjohnston commented 7 years ago

Closing this as configuring Sensu for use with a cluster of RabbitMQ nodes is documented at https://sensuapp.org/docs/latest/reference/rabbitmq.html#configure-sensu-to-use-the-rabbitmq-cluster