diff --git a/packstack/plugins/ceilometer_800.py b/packstack/plugins/ceilometer_800.py index f35d6a87c..bf76dd43f 100644 --- a/packstack/plugins/ceilometer_800.py +++ b/packstack/plugins/ceilometer_800.py @@ -249,6 +249,21 @@ def create_manifest(config, messages): manifestdata = getManifestTemplate(get_mq(config, "ceilometer")) manifestdata += getManifestTemplate("ceilometer") + if config['CONFIG_CEILOMETER_COORDINATION_BACKEND'] == 'redis': + # Determine if we need to configure multiple sentinel hosts as + # fallbacks for use in coordination url. + sentinel_hosts = split_hosts(config['CONFIG_REDIS_SENTINEL_HOSTS']) + sentinel_port = config['CONFIG_REDIS_SENTINEL_PORT'] + sentinel_contact = config['CONFIG_REDIS_SENTINEL_CONTACT_HOST'] + if len(sentinel_hosts) > 1: + sentinel_fallbacks = '&'.join(['sentinel_fallback=%s:%s' % + (host, sentinel_port) + for host in sentinel_hosts + if host != sentinel_contact]) + else: + sentinel_fallbacks = '' + config['CONFIG_REDIS_SENTINEL_FALLBACKS'] = sentinel_fallbacks + fw_details = dict() key = "ceilometer_api" fw_details.setdefault(key, {}) diff --git a/packstack/puppet/templates/ceilometer.pp b/packstack/puppet/templates/ceilometer.pp index e6f05fcd9..9ab7ead5a 100644 --- a/packstack/puppet/templates/ceilometer.pp +++ b/packstack/puppet/templates/ceilometer.pp @@ -6,10 +6,16 @@ if $config_ceilometer_coordination_backend == 'redis' { $redis_host = hiera('CONFIG_REDIS_MASTER_HOST') $redis_port = hiera('CONFIG_REDIS_PORT') $sentinel_host = hiera('CONFIG_REDIS_SENTINEL_CONTACT_HOST') + $sentinel_fallbacks = hiera('CONFIG_REDIS_SENTINEL_FALLBACKS') if $sentinel_host != '' { $master_name = hiera('CONFIG_REDIS_MASTER_NAME') $sentinel_port = hiera('CONFIG_REDIS_SENTINEL_PORT') - $coordination_url = "redis://${sentinel_host}:${sentinel_port}?sentinel=${master_name}" + $base_coordination_url = "redis://${sentinel_host}:${sentinel_port}?sentinel=${master_name}" + if $sentinel_fallbacks != '' { + $coordination_url = "${base_coordination_url}&${sentinel_fallbacks}" + } else { + $coordination_url = $base_coordination_url + } } else { $coordination_url = "redis://${redis_host}:${redis_port}" } diff --git a/packstack/puppet/templates/redis_sentinel.pp b/packstack/puppet/templates/redis_sentinel.pp index b58406d5c..04512ef74 100644 --- a/packstack/puppet/templates/redis_sentinel.pp +++ b/packstack/puppet/templates/redis_sentinel.pp @@ -2,10 +2,13 @@ $redis_master_host = hiera('CONFIG_REDIS_MASTER_HOST') $redis_master_port = hiera('CONFIG_REDIS_PORT') $redis_master_name = hiera('CONFIG_REDIS_MASTER_NAME') $redis_sentinel_quorum = hiera('CONFIG_REDIS_SENTINEL_QUORUM') +$redis_sentinel_port = hiera('CONFIG_REDIS_SENTINEL_PORT') class { 'redis::sentinel': - master_name => "${redis_master_name}", - redis_host => $redis_master_host, - redis_port => $redis_master_port, - quorum => $redis_sentinel_quorum, + master_name => "${redis_master_name}", + redis_host => $redis_master_host, + redis_port => $redis_master_port, + quorum => $redis_sentinel_quorum, + sentinel_port => $redis_sentinel_port, + log_file => '/var/log/redis/sentinel.log', } diff --git a/packstack/puppet/templates/redis_slave.pp b/packstack/puppet/templates/redis_slave.pp index 7d26f3224..00be092e5 100644 --- a/packstack/puppet/templates/redis_slave.pp +++ b/packstack/puppet/templates/redis_slave.pp @@ -3,7 +3,7 @@ $redis_port = hiera('CONFIG_REDIS_PORT') $redis_master_host = hiera('CONFIG_REDIS_MASTER_HOST') class { 'redis': - bind => $redis_host, + bind => '0.0.0.0', port => $redis_port, appendonly => true, daemonize => false,