Merge pull request #652 from enovance/rabbit-haproxy
RabbitMQ load-balancing support
This commit is contained in:
@@ -160,6 +160,13 @@
|
|||||||
# If set to false, no binding will be configure
|
# If set to false, no binding will be configure
|
||||||
# Defaults to true
|
# Defaults to true
|
||||||
#
|
#
|
||||||
|
# [*rabbitmq*]
|
||||||
|
# (optional) Enable or not RabbitMQ binding.
|
||||||
|
# If true, both public and internal will attempt to be created except if vip_internal_ip is set to false (backward compatibility).
|
||||||
|
# If set to ['10.0.0.1'], only IP in the array (or in the string) will be configured in the pool. They must be part of keepalived_ip options.
|
||||||
|
# If set to false, no binding will be configure (default for backward compatibility)
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
# [*keystone_api_admin*]
|
# [*keystone_api_admin*]
|
||||||
# (optional) Enable or not Keystone admin binding.
|
# (optional) Enable or not Keystone admin binding.
|
||||||
# If true, both public and internal will attempt to be created except if vip_internal_ip is set to false (backward compatibility).
|
# If true, both public and internal will attempt to be created except if vip_internal_ip is set to false (backward compatibility).
|
||||||
@@ -194,6 +201,7 @@ class cloud::loadbalancer(
|
|||||||
$trove_api = true,
|
$trove_api = true,
|
||||||
$horizon = true,
|
$horizon = true,
|
||||||
$horizon_ssl = false,
|
$horizon_ssl = false,
|
||||||
|
$rabbitmq = false,
|
||||||
$spice = true,
|
$spice = true,
|
||||||
$haproxy_auth = 'admin:changeme',
|
$haproxy_auth = 'admin:changeme',
|
||||||
$keepalived_state = 'BACKUP',
|
$keepalived_state = 'BACKUP',
|
||||||
@@ -223,6 +231,7 @@ class cloud::loadbalancer(
|
|||||||
$spice_bind_options = [],
|
$spice_bind_options = [],
|
||||||
$horizon_bind_options = [],
|
$horizon_bind_options = [],
|
||||||
$horizon_ssl_bind_options = [],
|
$horizon_ssl_bind_options = [],
|
||||||
|
$rabbitmq_bind_options = [],
|
||||||
$galera_bind_options = [],
|
$galera_bind_options = [],
|
||||||
$ks_ceilometer_public_port = 8777,
|
$ks_ceilometer_public_port = 8777,
|
||||||
$ks_cinder_public_port = 8776,
|
$ks_cinder_public_port = 8776,
|
||||||
@@ -239,6 +248,7 @@ class cloud::loadbalancer(
|
|||||||
$ks_nova_public_port = 8774,
|
$ks_nova_public_port = 8774,
|
||||||
$ks_swift_public_port = 8080,
|
$ks_swift_public_port = 8080,
|
||||||
$ks_trove_public_port = 8779,
|
$ks_trove_public_port = 8779,
|
||||||
|
$rabbitmq_port = 5672,
|
||||||
$horizon_port = 80,
|
$horizon_port = 80,
|
||||||
$horizon_ssl_port = 443,
|
$horizon_ssl_port = 443,
|
||||||
$spice_port = 6082,
|
$spice_port = 6082,
|
||||||
@@ -386,6 +396,16 @@ class cloud::loadbalancer(
|
|||||||
},
|
},
|
||||||
bind_options => $spice_bind_options,
|
bind_options => $spice_bind_options,
|
||||||
}
|
}
|
||||||
|
cloud::loadbalancer::binding { 'rabbitmq_cluster':
|
||||||
|
ip => $rabbitmq,
|
||||||
|
port => $rabbitmq_port,
|
||||||
|
options => {
|
||||||
|
'mode' => 'tcp',
|
||||||
|
'option' => ['tcpka', 'tcplog', 'forwardfor'],
|
||||||
|
'balance' => 'roundrobin',
|
||||||
|
},
|
||||||
|
bind_options => $rabbitmq_bind_options,
|
||||||
|
}
|
||||||
cloud::loadbalancer::binding { 'trove_api_cluster':
|
cloud::loadbalancer::binding { 'trove_api_cluster':
|
||||||
ip => $trove_api,
|
ip => $trove_api,
|
||||||
port => $ks_trove_public_port,
|
port => $ks_trove_public_port,
|
||||||
|
@@ -28,14 +28,30 @@
|
|||||||
# Defaults to 'rabbitpassword'
|
# Defaults to 'rabbitpassword'
|
||||||
#
|
#
|
||||||
# [*cluster_node_type*]
|
# [*cluster_node_type*]
|
||||||
# (optionnal) Store the queues on the disc or in the RAM.
|
# (optional) Store the queues on the disc or in the RAM.
|
||||||
# Could be set to 'disk' or 'ram'.
|
# Could be set to 'disk' or 'ram'.
|
||||||
# Defaults to 'disc'
|
# Defaults to 'disc'
|
||||||
|
#
|
||||||
|
# [*haproxy_binding*]
|
||||||
|
# (optional) Enable or not HAproxy binding for load-balancing.
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
|
# [*rabbitmq_ip*]
|
||||||
|
# (optional) IP address of RabbitMQ interface.
|
||||||
|
# Required when using HAproxy binding.
|
||||||
|
# Defaults to $::ipaddress
|
||||||
|
#
|
||||||
|
# [*rabbitmq_port*]
|
||||||
|
# (optional) Port of RabbitMQ service.
|
||||||
|
# Defaults to '5672'
|
||||||
|
#
|
||||||
class cloud::messaging(
|
class cloud::messaging(
|
||||||
$cluster_node_type = 'disc',
|
$cluster_node_type = 'disc',
|
||||||
$rabbit_names = $::hostname,
|
$rabbit_names = $::hostname,
|
||||||
$rabbit_password = 'rabbitpassword'
|
$rabbit_password = 'rabbitpassword',
|
||||||
|
$haproxy_binding = false,
|
||||||
|
$rabbitmq_ip = $::ipaddress,
|
||||||
|
$rabbitmq_port = '5672',
|
||||||
){
|
){
|
||||||
|
|
||||||
# we ensure having an array
|
# we ensure having an array
|
||||||
@@ -63,7 +79,8 @@ class cloud::messaging(
|
|||||||
config_cluster => true,
|
config_cluster => true,
|
||||||
cluster_nodes => $array_rabbit_names,
|
cluster_nodes => $array_rabbit_names,
|
||||||
wipe_db_on_cookie_change => true,
|
wipe_db_on_cookie_change => true,
|
||||||
cluster_node_type => $cluster_node_type
|
cluster_node_type => $cluster_node_type,
|
||||||
|
port => $rabbitmq_port,
|
||||||
}
|
}
|
||||||
|
|
||||||
rabbitmq_vhost { '/':
|
rabbitmq_vhost { '/':
|
||||||
@@ -91,4 +108,14 @@ class cloud::messaging(
|
|||||||
provider => 'rabbitmqctl',
|
provider => 'rabbitmqctl',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $haproxy_binding {
|
||||||
|
@@haproxy::balancermember{"${::fqdn}-rabbitmq":
|
||||||
|
listening_service => 'rabbitmq_cluster',
|
||||||
|
server_names => $::hostname,
|
||||||
|
ipaddresses => $rabbitmq_ip,
|
||||||
|
ports => $rabbitmq_port,
|
||||||
|
options => 'check inter 5s rise 2 fall 3'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -477,6 +477,20 @@ describe 'cloud::loadbalancer' do
|
|||||||
:bind_options => ['ssl', 'crt']
|
:bind_options => ['ssl', 'crt']
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
context 'configure RabbitMQ binding' do
|
||||||
|
before do
|
||||||
|
params.merge!( :rabbitmq => true )
|
||||||
|
end
|
||||||
|
it { is_expected.to contain_haproxy__listen('rabbitmq_cluster').with(
|
||||||
|
:ipaddress => [params[:vip_public_ip]],
|
||||||
|
:ports => '5672',
|
||||||
|
:options => {
|
||||||
|
'mode' => 'tcp',
|
||||||
|
'balance' => 'roundrobin',
|
||||||
|
'option' => ['tcpka', 'tcplog', 'forwardfor'],
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
end
|
||||||
end # shared:: openstack loadbalancer
|
end # shared:: openstack loadbalancer
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
context 'on Debian platforms' do
|
||||||
|
@@ -36,7 +36,8 @@ describe 'cloud::messaging' do
|
|||||||
:config_cluster => true,
|
:config_cluster => true,
|
||||||
:cluster_nodes => params[:rabbit_names],
|
:cluster_nodes => params[:rabbit_names],
|
||||||
:wipe_db_on_cookie_change => true,
|
:wipe_db_on_cookie_change => true,
|
||||||
:cluster_node_type => 'disc'
|
:cluster_node_type => 'disc',
|
||||||
|
:port => '5672',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -38,6 +38,10 @@ monitor fail if metadata_api_dead
|
|||||||
acl spice_dead nbsrv(spice_cluster) lt 1
|
acl spice_dead nbsrv(spice_cluster) lt 1
|
||||||
monitor fail if spice_dead
|
monitor fail if spice_dead
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
<%- if @rabbitmq -%>
|
||||||
|
acl rabbitmq_dead nbsrv(rabbitmq_cluster) lt 1
|
||||||
|
monitor fail if rabbitmq_dead
|
||||||
|
<%- end -%>
|
||||||
<%- if @glance_api -%>
|
<%- if @glance_api -%>
|
||||||
acl glance_api_dead nbsrv(glance_api_cluster) lt 1
|
acl glance_api_dead nbsrv(glance_api_cluster) lt 1
|
||||||
monitor fail if glance_api_dead
|
monitor fail if glance_api_dead
|
||||||
|
Reference in New Issue
Block a user