Contrail database puppet manifest added
This commit contains puppet code, files and templates to deploy the software packages and configuration for contrail database component. Change-Id: I45661087e0b0572930a3de68ff0ea722dde6172d
This commit is contained in:
parent
f04d2802e5
commit
3ec99afc91
|
@ -38,7 +38,5 @@ case $operatingsystem
|
|||
yumrepo {'mos': priority => 1, exclude => 'python-thrift,nodejs'} # Contrail requires newer python-thrift and nodejs from it's repo
|
||||
package {'yum-plugin-priorities': ensure => present }
|
||||
}
|
||||
Ubuntu:
|
||||
{
|
||||
}
|
||||
default: {}
|
||||
}
|
||||
|
|
|
@ -39,22 +39,19 @@ case $operatingsystem {
|
|||
class { 'contrail::package':
|
||||
install => ['contrail-openstack-vrouter','iproute','haproxy','patch'],
|
||||
remove => ['openvswitch','kmod-openvswitch','kmod-openvswitch-lt','openstack-neutron-openvswitch'],
|
||||
}
|
||||
->
|
||||
class { 'contrail::vrouter_module':}
|
||||
->
|
||||
} ->
|
||||
class { 'contrail::vrouter_module':} ->
|
||||
file { '/etc/supervisord.conf':
|
||||
ensure => 'link',
|
||||
target => '/etc/contrail/supervisord_vrouter.conf',
|
||||
force => 'yes',
|
||||
}
|
||||
->
|
||||
} ->
|
||||
file {'/etc/contrail/default_pmac':
|
||||
ensure => present,
|
||||
}
|
||||
->
|
||||
} ->
|
||||
service {'supervisor-vrouter': enable => true}
|
||||
}
|
||||
default: {}
|
||||
} ->
|
||||
|
||||
class { 'contrail::config':
|
||||
|
|
|
@ -25,8 +25,10 @@ if $contrail::node_name =~ /^contrail.\d+$/ {
|
|||
source => 'puppet:///modules/contrail/contrail-pin-100',
|
||||
before => Class['contrail::package'],
|
||||
}
|
||||
$pkgs = ['python-crypto','python-netaddr','python-paramiko','ifenslave-2.6','patch',
|
||||
'openjdk-7-jre-headless','contrail-fabric-utils','contrail-setup']
|
||||
$pkgs = ['python-crypto','python-netaddr','python-paramiko',
|
||||
'ifenslave-2.6','patch','openjdk-7-jre-headless',
|
||||
'python-contrail','contrail-setup','contrail-utils','contrail-nodemgr','supervisor',
|
||||
'contrail-fabric-utils']
|
||||
$pip_pkgs = ['Fabric-1.7.5']
|
||||
}
|
||||
CentOS:
|
||||
|
@ -35,6 +37,7 @@ if $contrail::node_name =~ /^contrail.\d+$/ {
|
|||
'java-1.7.0-openjdk','contrail-fabric-utils','contrail-setup']
|
||||
$pip_pkgs = ['Fabric-1.7.5']
|
||||
}
|
||||
default: {}
|
||||
}
|
||||
class { 'contrail::package':
|
||||
install => $pkgs,
|
||||
|
|
|
@ -16,10 +16,15 @@ include contrail
|
|||
|
||||
Exec { path => '/bin:/sbin:/usr/bin:/usr/sbin', refresh => 'echo NOOP_ON_REFRESH', timeout => 1800}
|
||||
|
||||
if $contrail::node_name =~ /^contrail.\d+$/ {
|
||||
class { 'contrail::database': }
|
||||
}
|
||||
|
||||
if $contrail::node_name == $contrail::deployment_node {
|
||||
class { 'contrail::testbed': }
|
||||
->
|
||||
class { 'contrail::setup':
|
||||
node_name => $contrail::node_name,
|
||||
require => Class['contrail::database'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,247 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
calculate_heap_sizes()
|
||||
{
|
||||
case "`uname`" in
|
||||
Linux)
|
||||
system_memory_in_mb=`free -m | awk '/Mem:/ {print $2}'`
|
||||
system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo`
|
||||
;;
|
||||
FreeBSD)
|
||||
system_memory_in_bytes=`sysctl hw.physmem | awk '{print $2}'`
|
||||
system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
|
||||
system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
|
||||
;;
|
||||
SunOS)
|
||||
system_memory_in_mb=`prtconf | awk '/Memory size:/ {print $3}'`
|
||||
system_cpu_cores=`psrinfo | wc -l`
|
||||
;;
|
||||
Darwin)
|
||||
system_memory_in_bytes=`sysctl hw.memsize | awk '{print $2}'`
|
||||
system_memory_in_mb=`expr $system_memory_in_bytes / 1024 / 1024`
|
||||
system_cpu_cores=`sysctl hw.ncpu | awk '{print $2}'`
|
||||
;;
|
||||
*)
|
||||
# assume reasonable defaults for e.g. a modern desktop or
|
||||
# cheap server
|
||||
system_memory_in_mb="2048"
|
||||
system_cpu_cores="2"
|
||||
;;
|
||||
esac
|
||||
|
||||
# some systems like the raspberry pi don't report cores, use at least 1
|
||||
if [ "$system_cpu_cores" -lt "1" ]
|
||||
then
|
||||
system_cpu_cores="1"
|
||||
fi
|
||||
|
||||
# set max heap size based on the following
|
||||
# max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
|
||||
# calculate 1/2 ram and cap to 1024MB
|
||||
# calculate 1/4 ram and cap to 8192MB
|
||||
# pick the max
|
||||
half_system_memory_in_mb=`expr $system_memory_in_mb / 2`
|
||||
quarter_system_memory_in_mb=`expr $half_system_memory_in_mb / 2`
|
||||
if [ "$half_system_memory_in_mb" -gt "1024" ]
|
||||
then
|
||||
half_system_memory_in_mb="1024"
|
||||
fi
|
||||
if [ "$quarter_system_memory_in_mb" -gt "8192" ]
|
||||
then
|
||||
quarter_system_memory_in_mb="8192"
|
||||
fi
|
||||
if [ "$half_system_memory_in_mb" -gt "$quarter_system_memory_in_mb" ]
|
||||
then
|
||||
max_heap_size_in_mb="$half_system_memory_in_mb"
|
||||
else
|
||||
max_heap_size_in_mb="$quarter_system_memory_in_mb"
|
||||
fi
|
||||
MAX_HEAP_SIZE="${max_heap_size_in_mb}M"
|
||||
|
||||
# Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4 * heap size)
|
||||
max_sensible_yg_per_core_in_mb="100"
|
||||
max_sensible_yg_in_mb=`expr $max_sensible_yg_per_core_in_mb "*" $system_cpu_cores`
|
||||
|
||||
desired_yg_in_mb=`expr $max_heap_size_in_mb / 4`
|
||||
|
||||
if [ "$desired_yg_in_mb" -gt "$max_sensible_yg_in_mb" ]
|
||||
then
|
||||
HEAP_NEWSIZE="${max_sensible_yg_in_mb}M"
|
||||
else
|
||||
HEAP_NEWSIZE="${desired_yg_in_mb}M"
|
||||
fi
|
||||
}
|
||||
|
||||
# Determine the sort of JVM we'll be running on.
|
||||
|
||||
java_ver_output=`"${JAVA:-java}" -version 2>&1`
|
||||
|
||||
jvmver=`echo "$java_ver_output" | awk -F'"' 'NR==1 {print $2}'`
|
||||
JVM_VERSION=${jvmver%_*}
|
||||
JVM_PATCH_VERSION=${jvmver#*_}
|
||||
|
||||
jvm=`echo "$java_ver_output" | awk 'NR==2 {print $1}'`
|
||||
case "$jvm" in
|
||||
OpenJDK)
|
||||
JVM_VENDOR=OpenJDK
|
||||
# this will be "64-Bit" or "32-Bit"
|
||||
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
|
||||
;;
|
||||
"Java(TM)")
|
||||
JVM_VENDOR=Oracle
|
||||
# this will be "64-Bit" or "32-Bit"
|
||||
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
|
||||
;;
|
||||
*)
|
||||
# Help fill in other JVM values
|
||||
JVM_VENDOR=other
|
||||
JVM_ARCH=unknown
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Override these to set the amount of memory to allocate to the JVM at
|
||||
# start-up. For production use you may wish to adjust this for your
|
||||
# environment. MAX_HEAP_SIZE is the total amount of memory dedicated
|
||||
# to the Java heap; HEAP_NEWSIZE refers to the size of the young
|
||||
# generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should be either set
|
||||
# or not (if you set one, set the other).
|
||||
#
|
||||
# The main trade-off for the young generation is that the larger it
|
||||
# is, the longer GC pause times will be. The shorter it is, the more
|
||||
# expensive GC will be (usually).
|
||||
#
|
||||
# The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause
|
||||
# times. If in doubt, and if you do not particularly want to tweak, go with
|
||||
# 100 MB per physical CPU core.
|
||||
|
||||
#MAX_HEAP_SIZE="4G"
|
||||
#HEAP_NEWSIZE="800M"
|
||||
|
||||
if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" ]; then
|
||||
calculate_heap_sizes
|
||||
else
|
||||
if [ "x$MAX_HEAP_SIZE" = "x" ] || [ "x$HEAP_NEWSIZE" = "x" ]; then
|
||||
echo "please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs (see cassandra-env.sh)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Specifies the default port over which Cassandra will be available for
|
||||
# JMX connections.
|
||||
JMX_PORT="7199"
|
||||
|
||||
|
||||
# Here we create the arguments that will get passed to the jvm when
|
||||
# starting cassandra.
|
||||
|
||||
# enable assertions. disabling this in production will give a modest
|
||||
# performance benefit (around 5%).
|
||||
JVM_OPTS="$JVM_OPTS -ea"
|
||||
|
||||
# add the jamm javaagent
|
||||
if [ "$JVM_VENDOR" != "OpenJDK" -o "$JVM_VERSION" \> "1.6.0" ] \
|
||||
|| [ "$JVM_VERSION" = "1.6.0" -a "$JVM_PATCH_VERSION" -ge 23 ]
|
||||
then
|
||||
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar"
|
||||
fi
|
||||
|
||||
# enable thread priorities, primarily so we can give periodic tasks
|
||||
# a lower priority to avoid interfering with client workload
|
||||
JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities"
|
||||
# allows lowering thread priority without being root. see
|
||||
# http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html
|
||||
JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42"
|
||||
|
||||
# min and max heap sizes should be set to the same value to avoid
|
||||
# stop-the-world GC pauses during resize, and so that we can lock the
|
||||
# heap in memory on startup to prevent any of it from being swapped
|
||||
# out.
|
||||
JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"
|
||||
JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}"
|
||||
JVM_OPTS="$JVM_OPTS -Xmn${HEAP_NEWSIZE}"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+HeapDumpOnOutOfMemoryError"
|
||||
|
||||
# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
|
||||
if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then
|
||||
JVM_OPTS="$JVM_OPTS -XX:HeapDumpPath=$CASSANDRA_HEAPDUMP_DIR/cassandra-`date +%s`-pid$$.hprof"
|
||||
fi
|
||||
|
||||
|
||||
startswith() { [ "${1#$2}" != "$1" ]; }
|
||||
|
||||
if [ "`uname`" = "Linux" ] ; then
|
||||
# reduce the per-thread stack size to minimize the impact of Thrift
|
||||
# thread-per-client. (Best practice is for client connections to
|
||||
# be pooled anyway.) Only do so on Linux where it is known to be
|
||||
# supported.
|
||||
# u34 and greater need 180k
|
||||
JVM_OPTS="$JVM_OPTS -Xss512k"
|
||||
fi
|
||||
echo "xss = $JVM_OPTS"
|
||||
|
||||
# GC tuning options
|
||||
JVM_OPTS="$JVM_OPTS -XX:+UseParNewGC"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+UseConcMarkSweepGC"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+CMSParallelRemarkEnabled"
|
||||
JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=8"
|
||||
JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=1"
|
||||
JVM_OPTS="$JVM_OPTS -XX:CMSInitiatingOccupancyFraction=75"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+UseTLAB"
|
||||
# note: bash evals '1.7.x' as > '1.7' so this is really a >= 1.7 jvm check
|
||||
if [ "$JVM_VERSION" \> "1.7" ] ; then
|
||||
JVM_OPTS="$JVM_OPTS -XX:+UseCondCardMark"
|
||||
fi
|
||||
|
||||
# GC logging options -- uncomment to enable
|
||||
JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+PrintGCDateStamps"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+PrintHeapAtGC"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime"
|
||||
JVM_OPTS="$JVM_OPTS -XX:+PrintPromotionFailure"
|
||||
JVM_OPTS="$JVM_OPTS -XX:PrintFLSStatistics=1"
|
||||
JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc-`date +%s`.log"
|
||||
# If you are using JDK 6u34 7u2 or later you can enable GC log rotation
|
||||
# don't stick the date in the log name if rotation is on.
|
||||
# JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/cassandra/gc.log"
|
||||
# JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation"
|
||||
# JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10"
|
||||
# JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M"
|
||||
|
||||
# uncomment to have Cassandra JVM listen for remote debuggers/profilers on port 1414
|
||||
# JVM_OPTS="$JVM_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1414"
|
||||
|
||||
# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
|
||||
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
|
||||
# comment out this entry to enable IPv6 support).
|
||||
JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
|
||||
|
||||
# jmx: metrics and administration interface
|
||||
#
|
||||
# add this if you're having trouble connecting:
|
||||
# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"
|
||||
#
|
||||
# see
|
||||
# https://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole
|
||||
# for more on configuring JMX through firewalls, etc. (Short version:
|
||||
# get it working with no firewall first.)
|
||||
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
|
||||
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
|
||||
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
|
||||
JVM_OPTS="$JVM_OPTS $JVM_EXTRA_OPTS"
|
|
@ -0,0 +1,101 @@
|
|||
; contrail database (cassandra) supervisor config file.
|
||||
;
|
||||
; For more example, check supervisord_analytics.conf
|
||||
|
||||
[unix_http_server]
|
||||
file=/tmp/supervisord_database.sock ; (the path to the socket file)
|
||||
chmod=0700 ; socket file mode (default 0700)
|
||||
;chown=nobody:nogroup ; socket file uid:gid owner
|
||||
;username=user ; (default is no username (open server))
|
||||
;password=123 ; (default is no password (open server))
|
||||
|
||||
;[inet_http_server] ; inet (TCP) server disabled by default
|
||||
;port=localhost:9007 ; (ip_address:port specifier, *:port for all i/f)
|
||||
;username=user ; (default is no username (open server))
|
||||
;password=123 ; (default is no password (open server))
|
||||
|
||||
[supervisord]
|
||||
logfile=/var/log/contrail/supervisord_contrail_database.log ; (main log file;default $CWD/supervisord.log)
|
||||
logfile_maxbytes=10MB ; (max main logfile bytes b4 rotation;default 50MB)
|
||||
logfile_backups=5 ; (num of main logfile rotation backups;default 10)
|
||||
loglevel=info ; (log level;default info; others: debug,warn,trace)
|
||||
pidfile=/var/run/supervisord_contrail_database.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
nodaemon=false ; (start in foreground if true;default false)
|
||||
minfds=60240 ; (min. avail startup file descriptors;default 1024)
|
||||
minprocs=200 ; (min. avail process descriptors;default 200)
|
||||
;umask=022 ; (process file creation umask;default 022)
|
||||
;user=chrism ; (default is current user, required if root)
|
||||
;identifier=supervisor ; (supervisord identifier, default is 'supervisor')
|
||||
;directory=/tmp ; (default is not to cd during start)
|
||||
nocleanup=true ; (don't clean up tempfiles at start;default false)
|
||||
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
;environment=KEY=value ; (key value pairs to add to environment)
|
||||
;strip_ansi=false ; (strip ansi escape codes in logs; def. false)
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///tmp/supervisord_database.sock ; use a unix:// URL for a unix socket
|
||||
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
|
||||
;username=chris ; should be same as http_username if set
|
||||
;password=123 ; should be same as http_password if set
|
||||
;prompt=mysupervisor ; cmd line prompt (default "supervisor")
|
||||
;history_file=~/.sc_history ; use readline history if available
|
||||
|
||||
; The below sample program section shows all possible program subsection values,
|
||||
; create one or more 'real' program: sections to be able to control them under
|
||||
; supervisor.
|
||||
|
||||
[program:contrail-database]
|
||||
command=cassandra -f
|
||||
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
|
||||
;numprocs=1 ; number of processes copies to start (def 1)
|
||||
;directory=/tmp ; directory to cwd to before exec (def no cwd)
|
||||
;umask=022 ; umask for process (default None)
|
||||
;priority=300 ; the relative start priority (default 999)
|
||||
autostart=true ; start at supervisord start (default: true)
|
||||
;autorestart=unexpected ; whether/when to restart (default: unexpected)
|
||||
;startsecs=1 ; number of secs prog must stay running (def. 1)
|
||||
;startretries=3 ; max # of serial start failures (default 3)
|
||||
;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
|
||||
stopsignal=KILL ; signal used to kill process (default TERM)
|
||||
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
|
||||
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
|
||||
killasgroup=false ; SIGKILL the UNIX process group (def false)
|
||||
;user=chrism ; setuid to this UNIX account to run the program
|
||||
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
|
||||
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
|
||||
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
|
||||
;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
|
||||
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
|
||||
;stdout_events_enabled=false ; emit events on stdout writes (default false)
|
||||
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
|
||||
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
|
||||
;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
|
||||
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
|
||||
;stderr_events_enabled=false ; emit events on stderr writes (default false)
|
||||
;environment=A=1,B=2 ; process environment additions (def no adds)
|
||||
;serverurl=AUTO ; override serverurl computation (childutils)
|
||||
|
||||
; The below sample group section shows all possible group values,
|
||||
; create one or more 'real' group: sections to create "heterogeneous"
|
||||
; process groups.
|
||||
|
||||
;[group:thegroupname]
|
||||
;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
|
||||
;priority=999 ; the relative start priority (default 999)
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/contrail/supervisord_database_files/*.ini
|
||||
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
class contrail::config ( $node_role ) {
|
||||
case $node_role {
|
||||
default: {}
|
||||
'controller','primary-controller': {
|
||||
nova_config {
|
||||
'DEFAULT/network_api_class': value=> 'nova.network.neutronv2.api.API';
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
# Copyright 2015 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
class contrail::database {
|
||||
|
||||
Package {
|
||||
ensure => installed,
|
||||
}
|
||||
File {
|
||||
ensure => present,
|
||||
mode => '0644',
|
||||
owner => root,
|
||||
group => root,
|
||||
}
|
||||
|
||||
# Packages
|
||||
package { 'contrail-openstack-database': } ->
|
||||
package { 'zookeeper': } ->
|
||||
package { 'cassandra': }
|
||||
|
||||
# Zookeeper
|
||||
file { '/etc/zookeeper/conf/myid':
|
||||
content => $contrail::uid,
|
||||
}
|
||||
file { '/etc/zookeeper/conf/zoo.cfg':
|
||||
content => template('contrail/zoo.cfg.erb');
|
||||
}
|
||||
service { 'zookeeper':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Package['zookeeper'],
|
||||
subscribe => [
|
||||
File['/etc/zookeeper/conf/zoo.cfg'],
|
||||
File['/etc/zookeeper/conf/myid'],
|
||||
],
|
||||
}
|
||||
|
||||
# Cassandra
|
||||
file { '/etc/cassandra/cassandra.yaml':
|
||||
content => template('contrail/cassandra.yaml.erb'),
|
||||
} ->
|
||||
file { '/etc/cassandra/cassandra-env.sh':
|
||||
source => 'puppet:///modules/contrail/cassandra-env.sh',
|
||||
} ->
|
||||
file { '/var/lib/cassandra':
|
||||
ensure => directory,
|
||||
mode => '0755',
|
||||
owner => root,
|
||||
group => root,
|
||||
require => Package['cassandra'],
|
||||
}
|
||||
|
||||
# Supervisor-database
|
||||
file { '/etc/contrail/contrail-database-nodemgr.conf':
|
||||
content => template('contrail/contrail-database-nodemgr.conf.erb'),
|
||||
}
|
||||
file { '/etc/contrail/supervisord_database.conf':
|
||||
source => 'puppet:///modules/contrail/supervisord_database.conf',
|
||||
}
|
||||
service { 'supervisor-database':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => File['/var/lib/cassandra'],
|
||||
subscribe => [
|
||||
File['/etc/cassandra/cassandra.yaml'],
|
||||
File['/etc/cassandra/cassandra-env.sh'],
|
||||
File['/etc/contrail/contrail-database-nodemgr.conf'],
|
||||
File['/etc/contrail/supervisord_database.conf'],
|
||||
],
|
||||
}
|
||||
|
||||
}
|
|
@ -77,6 +77,7 @@ class contrail::network (
|
|||
content => template('contrail/centos-ifcfg-vhost0.erb'),
|
||||
}
|
||||
}
|
||||
default: {}
|
||||
}
|
||||
}
|
||||
default: { notify { "Node role ${node_role} not supported": } }
|
||||
|
|
|
@ -38,6 +38,7 @@ class contrail::provision ( $node_role ) {
|
|||
creates => '/opt/contrail/provision-vrouter-DONE',
|
||||
}
|
||||
}
|
||||
default: {}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,15 +55,15 @@ class contrail::setup ($node_name)
|
|||
} ->
|
||||
|
||||
# Database installation
|
||||
run_fabric { 'install_database': } ->
|
||||
run_fabric { 'setup_database': } ->
|
||||
notify{"Waiting for cassandra nodes: ${contrail::contrail_node_num}":} ->
|
||||
exec {'wait_for_cassandra':
|
||||
provider => 'shell',
|
||||
command => "if [ `nodetool status|grep ^UN|wc -l` -lt ${contrail::contrail_node_num} ]; then exit 1; fi",
|
||||
tries => 10, # wait for whole cluster is up: 10 tries every 30 seconds = 5 min
|
||||
try_sleep => 30,
|
||||
} ->
|
||||
#run_fabric { 'install_database': } ->
|
||||
#run_fabric { 'setup_database': } ->
|
||||
notify{"Waiting for cassandra nodes: ${contrail::contrail_node_num}":} ->
|
||||
exec {'wait_for_cassandra':
|
||||
provider => 'shell',
|
||||
command => "if [ `nodetool status|grep ^UN|wc -l` -lt ${contrail::contrail_node_num} ]; then exit 1; fi",
|
||||
tries => 10, # wait for whole cluster is up: 10 tries every 30 seconds = 5 min
|
||||
try_sleep => 30,
|
||||
} ->
|
||||
# Installing components
|
||||
run_fabric { 'install_cfgm': } ->
|
||||
run_fabric { 'install_control': } ->
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
<%-
|
||||
nodes=scope.function_hiera(['nodes'])
|
||||
contrail_node_basename=scope.lookupvar('contrail::contrail_node_basename')
|
||||
priv_ip=Array.new
|
||||
nodes.each do |node|
|
||||
case node['role']
|
||||
when 'base-os'
|
||||
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
|
||||
priv_ip << node['private_address']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-%>
|
||||
cluster_name: 'Contrail'
|
||||
num_tokens: 256
|
||||
hinted_handoff_enabled: true
|
||||
max_hint_window_in_ms: 10800000 # 3 hours
|
||||
hinted_handoff_throttle_in_kb: 1024
|
||||
max_hints_delivery_threads: 2
|
||||
authenticator: AllowAllAuthenticator
|
||||
authorizer: AllowAllAuthorizer
|
||||
permissions_validity_in_ms: 2000
|
||||
partitioner: org.apache.cassandra.dht.Murmur3Partitioner
|
||||
data_file_directories:
|
||||
- /var/lib/cassandra/data
|
||||
commitlog_directory: /var/lib/cassandra/commitlog
|
||||
disk_failure_policy: stop
|
||||
key_cache_size_in_mb:
|
||||
key_cache_save_period: 14400
|
||||
row_cache_size_in_mb: 0
|
||||
row_cache_save_period: 0
|
||||
row_cache_provider: SerializingCacheProvider
|
||||
saved_caches_directory: /var/lib/cassandra/saved_caches
|
||||
commitlog_sync: periodic
|
||||
commitlog_sync_period_in_ms: 10000
|
||||
commitlog_segment_size_in_mb: 32
|
||||
seed_provider:
|
||||
# Addresses of hosts that are deemed contact points.
|
||||
# Cassandra nodes use this list of hosts to find each other and learn
|
||||
# the topology of the ring. You must change this if you are running
|
||||
# multiple nodes!
|
||||
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
|
||||
parameters:
|
||||
# seeds is actually a comma-delimited list of addresses.
|
||||
# Ex: "<ip1>,<ip2>,<ip3>"
|
||||
- seeds: "<%= priv_ip.join(',') %>"
|
||||
flush_largest_memtables_at: 0.75
|
||||
reduce_cache_sizes_at: 0.85
|
||||
reduce_cache_capacity_to: 0.6
|
||||
concurrent_reads: 192
|
||||
concurrent_writes: 256
|
||||
memtable_flush_queue_size: 4
|
||||
trickle_fsync: false
|
||||
trickle_fsync_interval_in_kb: 10240
|
||||
storage_port: 7000
|
||||
ssl_storage_port: 7001
|
||||
listen_address: <%= @local_ip %>
|
||||
start_native_transport: true
|
||||
native_transport_port: 9042
|
||||
start_rpc: true
|
||||
rpc_address: <%= @local_ip %>
|
||||
rpc_port: 9160
|
||||
rpc_keepalive: true
|
||||
rpc_server_type: sync
|
||||
thrift_framed_transport_size_in_mb: 15
|
||||
incremental_backups: false
|
||||
snapshot_before_compaction: false
|
||||
auto_snapshot: true
|
||||
tombstone_debug_threshold: 10000
|
||||
column_index_size_in_kb: 64
|
||||
in_memory_compaction_limit_in_mb: 512
|
||||
multithreaded_compaction: false
|
||||
compaction_throughput_mb_per_sec: 512
|
||||
compaction_preheat_key_cache: true
|
||||
read_request_timeout_in_ms: 10000
|
||||
range_request_timeout_in_ms: 10000
|
||||
write_request_timeout_in_ms: 10000
|
||||
truncate_request_timeout_in_ms: 60000
|
||||
request_timeout_in_ms: 10000
|
||||
cross_node_timeout: false
|
||||
endpoint_snitch: SimpleSnitch
|
||||
dynamic_snitch_update_interval_in_ms: 100
|
||||
dynamic_snitch_reset_interval_in_ms: 600000
|
||||
dynamic_snitch_badness_threshold: 0.1
|
||||
request_scheduler: org.apache.cassandra.scheduler.NoScheduler
|
||||
index_interval: 128
|
||||
server_encryption_options:
|
||||
internode_encryption: none
|
||||
keystore: conf/.keystore
|
||||
keystore_password: cassandra
|
||||
truststore: conf/.truststore
|
||||
truststore_password: cassandra
|
||||
# More advanced defaults below:
|
||||
# protocol: TLS
|
||||
# algorithm: SunX509
|
||||
# store_type: JKS
|
||||
# cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
|
||||
# require_client_auth: false
|
||||
client_encryption_options:
|
||||
enabled: false
|
||||
keystore: conf/.keystore
|
||||
keystore_password: cassandra
|
||||
# require_client_auth: false
|
||||
# Set trustore and truststore_password if require_client_auth is true
|
||||
# truststore: conf/.truststore
|
||||
# truststore_password: cassandra
|
||||
# More advanced defaults below:
|
||||
# protocol: TLS
|
||||
# algorithm: SunX509
|
||||
# store_type: JKS
|
||||
# cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA]
|
||||
internode_compression: all
|
||||
inter_dc_tcp_nodelay: true
|
|
@ -0,0 +1,2 @@
|
|||
[DISCOVERY]
|
||||
server=<%= scope.lookupvar('contrail::contrail_private_vip') %>
|
|
@ -0,0 +1,19 @@
|
|||
tickTime=2000
|
||||
initLimit=10
|
||||
syncLimit=5
|
||||
dataDir=/var/lib/zookeeper
|
||||
clientPort=2181
|
||||
maxSessionTimeout=120000
|
||||
<%-
|
||||
nodes=scope.function_hiera(['nodes'])
|
||||
contrail_node_basename=scope.lookupvar('contrail::contrail_node_basename')
|
||||
nodes.each do |node|
|
||||
case node['role']
|
||||
when 'base-os'
|
||||
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
|
||||
-%>
|
||||
server.<%= node['uid'] %>=<%= node['private_address']%>:2888:3888
|
||||
<%- end
|
||||
end
|
||||
end
|
||||
-%>
|
Loading…
Reference in New Issue