Dedicated role for Contrail Analytics DB added.

Change-Id: I73a79f4f9b3b4835f7105ed275d6418e9f93188d
This commit is contained in:
Oleksandr Martsyniuk 2016-08-16 18:54:18 +03:00 committed by Illia Polliul
parent a9bb035318
commit 09c1fc44f8
10 changed files with 139 additions and 51 deletions

View File

@ -44,7 +44,7 @@ class contrail::analytics {
contrail_analytics_api_config {
'DEFAULTS/api_server': value => "${::contrail::contrail_private_vip}:8082";
'DEFAULTS/host_ip': value => $contrail::address;
'DEFAULTS/cassandra_server_list': value => $contrail::cassandra_server_list;
'DEFAULTS/cassandra_server_list': value => $contrail::analytics_db_list;
'DEFAULTS/http_server_port': value => '8090';
'DEFAULTS/rest_api_port': value => '9081';
'DEFAULTS/rest_api_ip': value => '0.0.0.0';
@ -67,7 +67,7 @@ class contrail::analytics {
'DEFAULT/analytics_config_audit_ttl': value => '2160';
'DEFAULT/analytics_statistics_ttl': value => '24';
'DEFAULT/analytics_flow_ttl': value => '2';
'DEFAULT/cassandra_server_list': value => $contrail::cassandra_server_list;
'DEFAULT/cassandra_server_list': value => $contrail::analytics_db_list;
'DEFAULT/hostip': value => $contrail::address;
'DEFAULT/log_file': value => '/var/log/contrail/contrail-collector.log';
'DEFAULT/log_level': value => 'SYS_NOTICE';
@ -82,7 +82,7 @@ class contrail::analytics {
}
contrail_query_engine_config {
'DEFAULT/cassandra_server_list': value => $contrail::cassandra_server_list;
'DEFAULT/cassandra_server_list': value => $contrail::analytics_db_list;
'DEFAULT/collectors': value => '127.0.0.1:8086';
'DEFAULT/hostip': value => '$__contrail_host_ip__';
'DEFAULT/http_server_port': value => '8091';

View File

@ -90,7 +90,7 @@ class contrail::config {
'DEFAULTS/ifmap_server_port': value => '8443';
'DEFAULTS/ifmap_username': value => 'api-server';
'DEFAULTS/ifmap_password': value => 'api-server';
'DEFAULTS/cassandra_server_list': value => $contrail::cassandra_server_list_9160;
'DEFAULTS/cassandra_server_list': value => $contrail::contrail_db_list_9160;
'DEFAULTS/listen_ip_addr': value => '0.0.0.0';
'DEFAULTS/listen_port': value => '9100';
'DEFAULTS/aaa_mode': value => 'cloud-admin';
@ -137,7 +137,7 @@ class contrail::config {
'DEFAULTS/log_local': value => '1';
'DEFAULTS/log_file': value => '/var/log/contrail/discovery.log';
'DEFAULTS/log_level': value => 'SYS_NOTICE';
'DEFAULTS/cassandra_server_list': value => $contrail::cassandra_server_list_9160;
'DEFAULTS/cassandra_server_list': value => $contrail::contrail_db_list_9160;
'DEFAULTS/ttl_min': value => '300';
'DEFAULTS/ttl_max': value => '1800';
'DEFAULTS/hc_interval': value => '5';
@ -165,7 +165,7 @@ class contrail::config {
'DEFAULTS/api_server_port': value => '8082';
'DEFAULTS/zk_server_ip': value => $contrail::zk_server_ip;
'DEFAULTS/log_file': value => '/var/log/contrail/contrail-schema.log';
'DEFAULTS/cassandra_server_list': value => $contrail::cassandra_server_list_9160;
'DEFAULTS/cassandra_server_list': value => $contrail::contrail_db_list_9160;
'DEFAULTS/disc_server_ip': value => $contrail::contrail_private_vip;
'DEFAULTS/disc_server_port': value => '5998';
'DEFAULTS/log_local': value => '1';
@ -189,7 +189,7 @@ class contrail::config {
'DEFAULTS/api_server_port': value => '8082';
'DEFAULTS/zk_server_ip': value => $contrail::zk_server_ip;
'DEFAULTS/log_file': value => '/var/log/contrail/contrail-svc-monitor.log';
'DEFAULTS/cassandra_server_list': value => $contrail::cassandra_server_list_9160;
'DEFAULTS/cassandra_server_list': value => $contrail::contrail_db_list_9160;
'DEFAULTS/region': value => $contrail::region;
'DEFAULTS/disc_server_ip': value => $contrail::contrail_private_vip;
'DEFAULTS/disc_server_port': value => '5998';
@ -212,7 +212,7 @@ class contrail::config {
'DEFAULTS/api_server_port': value => '8082';
'DEFAULTS/zk_server_ip': value => $contrail::zk_server_ip;
'DEFAULTS/log_file': value => '/var/log/contrail/contrail-device-manager.log';
'DEFAULTS/cassandra_server_list': value => $contrail::cassandra_server_list_9160;
'DEFAULTS/cassandra_server_list': value => $contrail::contrail_db_list_9160;
'DEFAULTS/disc_server_ip': value => $contrail::contrail_private_vip;
'DEFAULTS/disc_server_port': value => '5998';
'DEFAULTS/log_local': value => '1';

View File

@ -24,33 +24,37 @@ class contrail::database {
group => root,
}
# Packages
package { 'zookeeper': } ->
package { 'kafka': } ->
package { 'cassandra': } ->
package { 'contrail-openstack-database': }
if roles_include($contrail::contrail_db_roles) {
$cassandra_seeds = $contrail::primary_contrail_db_ip
$cluster_name = 'Contrail'
# Zookeeper
file { '/etc/zookeeper/conf/myid':
content => $contrail::uid,
require => Package['zookeeper'],
}
# Zookeeper
package { 'zookeeper': } ->
file { '/etc/zookeeper/conf/myid':
content => $contrail::uid,
require => Package['zookeeper'],
}
file { '/etc/zookeeper/conf/zoo.cfg':
content => template('contrail/zoo.cfg.erb');
}
file { '/etc/zookeeper/conf/zoo.cfg':
content => template('contrail/zoo.cfg.erb');
}
service { 'zookeeper':
ensure => running,
enable => true,
require => [Package['zookeeper'],Package['contrail-openstack-database']],
subscribe => [
File['/etc/zookeeper/conf/zoo.cfg'],
File['/etc/zookeeper/conf/myid'],
],
service { 'zookeeper':
ensure => running,
enable => true,
require => Package['contrail-openstack-database'],
subscribe => [Package['zookeeper'],
File['/etc/zookeeper/conf/zoo.cfg'],
File['/etc/zookeeper/conf/myid'],
],
}
} elsif roles_include($contrail::analytics_db_roles) {
$cassandra_seeds = $contrail::primary_analytics_db_ip
$cluster_name = 'Analytics'
}
# Kafka
package { 'kafka': } ->
file { '/tmp/kafka-logs':
ensure => 'directory',
mode => '0755',
@ -79,6 +83,9 @@ class contrail::database {
}
# Cassandra
package { 'cassandra': } ->
package { 'contrail-openstack-database': }
file { $contrail::cassandra_path:
ensure => directory,
mode => '0755',
@ -122,10 +129,11 @@ class contrail::database {
subscribe => File['/etc/cassandra/cassandra.yaml']
}
$cassandra_seed = $cassandra_seeds[0]
notify{ 'Waiting for cassandra seed node': } ->
exec { 'wait_for_cassandra_seed':
provider => 'shell',
command => "nodetool status|grep ^UN|grep ${contrail::primary_contrail_db_ip}",
command => "nodetool status|grep ^UN|grep ${cassandra_seed}",
tries => 10, # wait for whole cluster is up: 10 tries every 30 seconds = 5 min
try_sleep => 30,
require => Service['supervisor-database'],

View File

@ -158,27 +158,47 @@ class contrail {
# Contrail DB nodes Private IP list
$primary_contrail_db_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['primary-contrail-db'])
$primary_contrail_db_ip = sort(values(get_node_to_ipaddr_map_by_network_role($primary_contrail_db_nodes_hash, 'neutron/mesh')))
$primary_contrail_db_ip = ipsort(values(get_node_to_ipaddr_map_by_network_role($primary_contrail_db_nodes_hash, 'neutron/mesh')))
$contrail_db_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['primary-contrail-db', 'contrail-db'])
$contrail_db_ips = sort(values(get_node_to_ipaddr_map_by_network_role($contrail_db_nodes_hash, 'neutron/mesh')))
$contrail_db_roles = hiera('contrail_db_roles', ['primary-contrail-db', 'contrail-db'])
$contrail_db_nodes_hash = get_nodes_hash_by_roles($network_metadata, $contrail_db_roles)
$contrail_db_ips = ipsort(values(get_node_to_ipaddr_map_by_network_role($contrail_db_nodes_hash, 'neutron/mesh')))
# Dedicated Analytics DB
$dedicated_analytics_db = pick($settings['dedicated_analytics_db'], false)
if $dedicated_analytics_db {
$primary_analytics_db_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['primary-contrail-analytics-db'])
$primary_analytics_db_ip = ipsort(values(get_node_to_ipaddr_map_by_network_role($primary_analytics_db_nodes_hash, 'neutron/mesh')))
$analytics_db_roles = hiera('contrail_analytics_db_roles', ['primary-contrail-analytics-db', 'contrail-analytics-db'])
$analytics_db_nodes_hash = get_nodes_hash_by_roles($network_metadata, $analytics_db_roles)
$analytics_db_ips = ipsort(values(get_node_to_ipaddr_map_by_network_role($analytics_db_nodes_hash, 'neutron/mesh')))
} else {
$analytics_db_ips = $contrail_db_ips
}
# Contrail Control nodes Private IP list
$contrail_control_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['primary-contrail-control', 'contrail-control'])
$contrail_control_ips = sort(values(get_node_to_ipaddr_map_by_network_role($contrail_control_nodes_hash, 'neutron/mesh')))
$contrail_control_roles = hiera('contrail_control_roles', ['primary-contrail-control', 'contrail-control'])
$contrail_control_nodes_hash = get_nodes_hash_by_roles($network_metadata, $contrail_control_roles)
$contrail_control_ips = ipsort(values(get_node_to_ipaddr_map_by_network_role($contrail_control_nodes_hash, 'neutron/mesh')))
# Contrail Config nodes Private IP list
$contrail_config_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['primary-contrail-config', 'contrail-config'])
$contrail_config_ips = sort(values(get_node_to_ipaddr_map_by_network_role($contrail_config_nodes_hash, 'neutron/mesh')))
$contrail_config_roles = hiera('contrail_config_roles', ['primary-contrail-config', 'contrail-config'])
$contrail_config_nodes_hash = get_nodes_hash_by_roles($network_metadata, $contrail_config_roles)
$contrail_config_ips = ipsort(values(get_node_to_ipaddr_map_by_network_role($contrail_config_nodes_hash, 'neutron/mesh')))
# Contrail Analytics nodes Private IP list
$contrail_analytics_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['primary-contrail-analytics', 'contrail-analytics'])
$contrail_analytics_ips = sort(values(get_node_to_ipaddr_map_by_network_role($contrail_analytics_nodes_hash, 'neutron/mesh')))
$contrail_config_ips_adm = sort(values(get_node_to_ipaddr_map_by_network_role($contrail_config_nodes_hash, 'fw-admin')))
$contrail_analytics_roles = hiera('contrail_analytics_roles', ['primary-contrail-analytics', 'contrail-analytics'])
$contrail_analytics_nodes_hash = get_nodes_hash_by_roles($network_metadata, $contrail_analytics_roles)
$contrail_analytics_ips = ipsort(values(get_node_to_ipaddr_map_by_network_role($contrail_analytics_nodes_hash, 'neutron/mesh')))
# Cassandra, Kafka & Zookeeper servers list
$cassandra_server_list = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:9042\" }.join(' ') %>")
$cassandra_server_list_9160 = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:9160\" }.join(' ') %>")
$kafka_broker_list = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:9092\" }.join(' ') %>")
$zk_server_ip = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:2181\" }.join(',') %>")
$contrail_db_list = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:9042\" }.join(' ') %>")
$contrail_db_list_9160 = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:9160\" }.join(' ') %>")
$analytics_db_list = inline_template("<%= scope.lookupvar('contrail::analytics_db_ips').map{ |ip| \"#{ip}:9042\" }.join(' ') %>")
$analytics_db_list_9160 = inline_template("<%= scope.lookupvar('contrail::analytics_db_ips').map{ |ip| \"#{ip}:9160\" }.join(' ') %>")
$kafka_broker_list = inline_template("<%= scope.lookupvar('contrail::analytics_db_ips').map{ |ip| \"#{ip}:9092\" }.join(' ') %>")
$zk_server_ip = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:2181\" }.join(' ') %>")
$zk_comma = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:2181\" }.join(',') %>")
}

View File

@ -7,7 +7,7 @@
# The name of the cluster. This is mainly used to prevent machines in
# one logical cluster from joining another.
cluster_name: 'Contrail'
cluster_name: '<%= @cluster_name %>'
# This defines the number of tokens randomly assigned to this node on the ring
# The more tokens, relative to other nodes, the larger the proportion of data
@ -270,7 +270,7 @@ seed_provider:
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "<%= scope.lookupvar('contrail::primary_contrail_db_ip').join(',') %>"
- seeds: "<%= @cassandra_seeds.join(',') %>"
# For workloads with more data than can fit in memory, Cassandra's
# bottleneck will be reads that need to fetch data from

View File

@ -40,6 +40,27 @@
parameters:
strategy:
type: parallel
# Contrail - Analytics DB
- id: primary-contrail-analytics-db
type: group
role: [primary-contrail-analytics-db]
tasks: [hiera, globals, setup_repositories, tools, logging, netconfig, hosts, deploy_start]
required_for: [deploy_end]
requires: [deploy_start]
parameters:
strategy:
type: one_by_one
- id: contrail-analytics-db
type: group
role: [contrail-analytics-db]
tasks: [hiera, globals, setup_repositories, tools, logging, netconfig, hosts, deploy_start]
required_for: [deploy_end]
requires: [deploy_start, primary-contrail-analytics-db]
parameters:
strategy:
type: one_by_one
#
# Contrail - Analytics
- id: primary-contrail-analytics
@ -164,7 +185,7 @@
- id: contrail-db-primary
type: puppet
version: 2.0.0
groups: [primary-contrail-db]
groups: [primary-contrail-db, primary-contrail-analytics-db]
required_for: [deploy_end]
requires: [contrail-utils]
parameters:
@ -189,7 +210,7 @@
- id: contrail-db-all
type: puppet
version: 2.0.0
groups: [contrail-db]
groups: [contrail-db, contrail-analytics-db]
required_for: [deploy_end]
requires: [contrail-utils]
cross-depends:
@ -387,7 +408,7 @@
- id: contrail-db-provision-all
type: puppet
version: 2.0.0
groups: [primary-contrail-db, contrail-db]
groups: [primary-contrail-db, contrail-db, primary-contrail-analytics-db, contrail-analytics-db]
required_for: [deploy_end]
requires: [contrail-utils]
cross-depends:

View File

@ -49,6 +49,12 @@ attributes:
regex:
source: '^(102[4-9]|10[3-9]\d|1[1-9]\d{2}|[2-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$'
error: "Invalid port"
dedicated_analytics_db:
value: false
type: "checkbox"
label: "Dedicated Analytics DB"
description: "Enable this option to enable deployment of dedicated Cassandra database for Contrail Analytics"
weight: 65
contrail_global_dpdk:
value: false
label: "Enable DPDK feature for this environment."

View File

@ -46,6 +46,27 @@ contrail-analytics:
- ceph-osd
- cinder
contrail-analytics-db:
name: Contrail - Analytics DB
description: >
Contrail analytics DB role. Provides dedicated Cassandra for Analytics component.
has_primary: true
limits:
recommended: 3
public_ip_required: false
weight: 100
conflicts:
- controller
- compute
- ceph-osd
- cinder
- contrail-db
- contrail-config
- contrail-control
restrictions:
- condition: "settings:contrail.dedicated_analytics_db.value == false"
message: "Dedicated Analytics DB should be enabled in plugin settings"
contrail-control:
name: Contrail - Control
description: >

View File

@ -40,7 +40,9 @@ get_nodes_list () {
if [ -z "$_role" ]; then
_nodes=$(fuel node 2>/dev/null | grep 'ready' | cut -d "|" -f 1,7 | awk '{printf $1 ","}' | sed -e 's|,$||')
elif [ "$_role" == "compute" ]; then
_nodes=$(fuel node 2>/dev/null | grep 'ready' | cut -d "|" -f 1,7 | grep "$_role" | grep -v vmware | awk '{printf $1 ","}' | sed -e 's|,$||')
_nodes=$(fuel node 2>/dev/null | grep 'ready' | cut -d "|" -f 1,7 | grep "$_role" | grep -v compute-vmware | awk '{printf $1 ","}' | sed -e 's|,$||')
elif [ "$_role" == "analytics" ]; then
_nodes=$(fuel node 2>/dev/null | grep 'ready' | cut -d "|" -f 1,7 | grep "$_role" | grep -v contrail-analytics-db | awk '{printf $1 ","}' | sed -e 's|,$||')
else
_nodes=$(fuel node 2>/dev/null | grep 'ready' | cut -d "|" -f 1,7 | grep "$_role" | awk '{printf $1 ","}' | sed -e 's|,$||')
fi
@ -124,6 +126,11 @@ controllers*)
start_task_on_node "$nodes" upgrade-contrail-config
wait_for_tasks
# Start the upgrade tasks on analytics database nodes
nodes=$(get_nodes_list contrail-analytics-db)
start_task_on_node "$nodes" upgrade-contrail-db
wait_for_tasks
# Start the upgrade tasks on collector nodes
nodes=$(get_nodes_list contrail-analytics)
if [ -n "$nodes" ]; then

View File

@ -17,7 +17,9 @@ volumes_roles_mapping:
contrail-db:
- {allocate_size: "min", id: "os"}
- {allocate_size: "min", id: "contrail-db"}
- {allocate_size: "all", id: "logs"}
contrail-analytics-db:
- {allocate_size: "min", id: "os"}
- {allocate_size: "all", id: "contrail-db"}
# NOTE(gomarivera): It might be needed to specify the partitions
# since the roles could be used in stand alone nodes.
@ -29,3 +31,6 @@ volumes_roles_mapping:
contrail-control:
- {allocate_size: "min", id: "os"}
- {allocate_size: "all", id: "logs"}
contrail-analytics:
- {allocate_size: "min", id: "os"}
- {allocate_size: "all", id: "logs"}