fix name for master of redis cluster
value of master name should be the same as in ceilometer redis backend url Co-Authored-By: alexey-mr <Alexey.Morlang@gmail.com> Change-Id: Ic9f6399950597db399718b4e607c6586db5647e3 Closes-Bug: #1553229
This commit is contained in:
parent
7aca0c5f1c
commit
39bd25c060
|
@ -26,9 +26,14 @@ $redis_primary_nodes = get_nodes_hash_by_roles(hiera('network_metadata'),
|
|||
$redis_primary_address_map = get_node_to_ipaddr_map_by_network_role($redis_primary_nodes, 'ceilometer/api')
|
||||
$primary_redis_node = values($redis_primary_address_map)
|
||||
|
||||
# TODO: get value from hiera
|
||||
$master_name = 'ceilometer_redis_master'
|
||||
|
||||
|
||||
class {'::redis::main':
|
||||
primary_redis_node => $primary_redis_node[0],
|
||||
redis_hosts => $redis_hosts,
|
||||
redis_bind_address => $redis_bind_address,
|
||||
primary_controller => hiera('primary_controller'),
|
||||
master_name => $master_name,
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
module Puppet::Parser::Functions
|
||||
newfunction(:redis_backend_url, :type => :rvalue) do |args|
|
||||
if args.length != 3
|
||||
if args.length != 4
|
||||
raise "Wrong number of arguments"
|
||||
end
|
||||
nodes = args[0]
|
||||
port = args[1]
|
||||
timeout = args[2]
|
||||
master_name = args[3]
|
||||
|
||||
backend_url="redis://" + nodes[0] + ":" + port + "?sentinel=" + nodes[0]
|
||||
backend_url="redis://" + nodes[0] + ":" + port + "?sentinel=" + master_name
|
||||
|
||||
nodes.each do |value|
|
||||
if value != nodes[0]
|
||||
|
|
|
@ -12,10 +12,13 @@ module Puppet::Parser::Functions
|
|||
hash = {}
|
||||
|
||||
nodes.each do |value|
|
||||
hash[value] = { 'monitor' => value + ' ' + port + ' ' + quorum,
|
||||
'down-after-milliseconds' => down_after_milliseconds,
|
||||
'failover-timeout' => failover_timeout,
|
||||
'parallel-syncs' => parallel_syncs }
|
||||
name = value['name']
|
||||
addr = value['addr']
|
||||
hash[name] = {
|
||||
'monitor' => addr + ' ' + port + ' ' + quorum,
|
||||
'down-after-milliseconds' => down_after_milliseconds,
|
||||
'failover-timeout' => failover_timeout,
|
||||
'parallel-syncs' => parallel_syncs }
|
||||
end
|
||||
|
||||
hash
|
||||
|
|
|
@ -54,6 +54,7 @@ class redis::main (
|
|||
$redis_bind_address = '0.0.0.0',
|
||||
$redis_port = '6379',
|
||||
$redis_sentinel_port = '26379',
|
||||
$master_name = 'mymaster',
|
||||
) {
|
||||
|
||||
include ceilometer::params
|
||||
|
@ -107,9 +108,14 @@ class redis::main (
|
|||
}
|
||||
|
||||
# Use custom function to generate sentinel configuration
|
||||
$sentinel_confs = sentinel_confs($redis_hosts, $redis_port, $quorum,
|
||||
$parallel_syncs, $down_after_milliseconds,
|
||||
$failover_timeout)
|
||||
$masters_to_monitor = [
|
||||
{ name => $master_name,
|
||||
addr => $primary_redis_node
|
||||
},
|
||||
]
|
||||
$sentinel_confs = sentinel_confs($masters_to_monitor, $redis_port, $quorum,
|
||||
$parallel_syncs, $down_after_milliseconds,
|
||||
$failover_timeout)
|
||||
|
||||
package {'python-redis':
|
||||
ensure => 'present',
|
||||
|
@ -127,10 +133,11 @@ class redis::main (
|
|||
conf_port => $redis_sentinel_port,
|
||||
sentinel_confs => $sentinel_confs,
|
||||
manage_upstart_scripts => $manage_upstart_scripts,
|
||||
master_name => $master_name
|
||||
}
|
||||
|
||||
ceilometer_config {
|
||||
'coordination/backend_url' : value => redis_backend_url($redis_hosts, $redis_sentinel_port, $timeout);
|
||||
'coordination/backend_url' : value => redis_backend_url($redis_hosts, $redis_sentinel_port, $timeout, $master_name);
|
||||
'coordination/heartbeat' : value => '1.0';
|
||||
'coordination/check_watchers' : value => $timeout;
|
||||
'notification/workload_partitioning': value => true
|
||||
|
|
|
@ -47,6 +47,7 @@ class redis::sentinel (
|
|||
$service_restart = true,
|
||||
$manage_upstart_scripts = true,
|
||||
$package_name = undef,
|
||||
$master_name = 'mymaster'
|
||||
) {
|
||||
|
||||
include redis::sentinel_params
|
||||
|
|
Loading…
Reference in New Issue