rabbitmq / rabbitmq-autocluster

RabbitMQ peer discovery and cluster formation plugin, supports RabbitMQ 3.6.x
BSD 3-Clause "New" or "Revised" License
241 stars 54 forks source link

Consul: added startup locking support #22

Closed ValFadeev closed 7 years ago

ValFadeev commented 7 years ago

Further to https://github.com/rabbitmq/rabbitmq-autocluster/issues/20 submitting a working implementation of startup locking for Consul backend.

The following compose file was used for verification:

version: '2'
services:
  consul:
    image: consul
    container_name: consul
    networks:
      - rabbitmq_network
    ports:
      - "8500:8500"

  rabbit-node0:
    depends_on:
      - consul
    image: rabbitmq-autocluster
    container_name: node0
    networks:
      - rabbitmq_network
    environment:
      AUTOCLUSTER_TYPE: consul
      CONSUL_HOST: consul
      CONSUL_PORT: 8500
      CONSUL_SERVICE_TTL: 60
      AUTOCLUSTER_CLEANUP: 'true'
      CLEANUP_WARN_ONLY: 'false'
      CONSUL_SVC_ADDR_AUTO: 'true'
    ports:
      - "15672:15672"

  rabbit-node1:
    depends_on:
      - consul
    image: rabbitmq-autocluster
    container_name: node1
    networks:
      - rabbitmq_network
    environment:
      AUTOCLUSTER_TYPE: consul
      CONSUL_HOST: consul
      CONSUL_PORT: 8500
      CONSUL_SERVICE_TTL: 60
      AUTOCLUSTER_CLEANUP: 'true'
      CLEANUP_WARN_ONLY: 'false'
      CONSUL_SVC_ADDR_AUTO: 'true'

  rabbit-node2:
    depends_on:
      - consul
    image: rabbitmq-autocluster
    container_name: node2
    networks:
      - rabbitmq_network
    environment:
      AUTOCLUSTER_TYPE: consul
      CONSUL_HOST: consul
      CONSUL_PORT: 8500
      CONSUL_SERVICE_TTL: 60
      AUTOCLUSTER_CLEANUP: 'true'
      CLEANUP_WARN_ONLY: 'false'
      CONSUL_SVC_ADDR_AUTO: 'true'

networks:
  rabbitmq_network:
    driver: bridge
michaelklishin commented 7 years ago

@ValFadeev #6 is in, note that I renamed augmented_node to candidate_seed_node in the process.

Let me know when you think it's time for our team to QA this.

ValFadeev commented 7 years ago

@michaelklishin thank you, I have rebased onto the latest stable and updated the PR base accordingly. Should be ready for review now.

michaelklishin commented 7 years ago

@ValFadeev perfect, I should have a chance to test it in the next few days. Will be a good segway into the work on https://github.com/rabbitmq/rabbitmq-peer-discovery-consul I had planned next week.

michaelklishin commented 7 years ago

@ValFadeev thank you!

ValFadeev commented 7 years ago

@michaelklishin thank you for accepting! I will try to have a look soon how this could potentially integrate with the existing peer discovery.