Puppet Class: profile::mariadb::core::multiinstance

Defined in:
modules/profile/manifests/mariadb/core/multiinstance.pp

Overview

TODO: use a data structure for the shards

Parameters:

  • num_instances (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::num_instances', 2))
  • s1 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s1', false))
  • s2 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s2', false))
  • s3 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s3', false))
  • s4 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s4', false))
  • s5 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s5', false))
  • s6 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s6', false))
  • s7 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s7', false))
  • s8 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::s8', false))
  • x1 (Any) (defaults to: hiera('profile::mariadb::core::multiinstance::x1', false))


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'modules/profile/manifests/mariadb/core/multiinstance.pp', line 2

class profile::mariadb::core::multiinstance(
    $num_instances = hiera('profile::mariadb::core::multiinstance::num_instances', 2),
    $s1 = hiera('profile::mariadb::core::multiinstance::s1', false),
    $s2 = hiera('profile::mariadb::core::multiinstance::s2', false),
    $s3 = hiera('profile::mariadb::core::multiinstance::s3', false),
    $s4 = hiera('profile::mariadb::core::multiinstance::s4', false),
    $s5 = hiera('profile::mariadb::core::multiinstance::s5', false),
    $s6 = hiera('profile::mariadb::core::multiinstance::s6', false),
    $s7 = hiera('profile::mariadb::core::multiinstance::s7', false),
    $s8 = hiera('profile::mariadb::core::multiinstance::s8', false),
    $x1 = hiera('profile::mariadb::core::multiinstance::x1', false),
) {
    class { 'mariadb::packages_wmf': }
    class { 'mariadb::service':
        override => "[Service]\nExecStartPre=/bin/sh -c \"echo 'mariadb main service is \
disabled, use mariadb@<instance_name> instead'; exit 1\"",
    }

    $is_critical = ($::site == mediawiki::state('primary_dc'))
    $contact_group = $is_critical ? {
        true  => 'dba',
        false => 'admins',
    }
    $basedir = '/opt/wmf-mariadb101'
    # Read only forced on also for the masters of the primary datacenter
    class { 'mariadb::config':
        datadir       => false,
        basedir       => $basedir,
        config        => 'profile/mariadb/mysqld_config/core_multiinstance.my.cnf.erb',
        p_s           => 'on',
        ssl           => 'puppet-cert',
        binlog_format => 'ROW',
    }

    file { '/etc/mysql/mysqld.conf.d':
        ensure => directory,
        owner  => root,
        group  => root,
        mode   => '0755',
    }


    if $s1 {
        mariadb::instance { 's1':
            port                    => 3311,
            innodb_buffer_pool_size => $s1,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's1': port => 3311, }
        profile::prometheus::mysqld_exporter_instance {'s1': port => 13311, }
    }

    if $s2 {
        mariadb::instance { 's2':
            port                    => 3312,
            innodb_buffer_pool_size => $s2,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's2': port => 3312, }
        profile::prometheus::mysqld_exporter_instance { 's2': port => 13312, }
    }

    if $s3 {
        mariadb::instance { 's3':
            port                    => 3313,
            innodb_buffer_pool_size => $s3,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's3': port => 3313, }
        profile::prometheus::mysqld_exporter_instance {'s3': port => 13313, }
    }

    if $s4 {
        mariadb::instance { 's4':
            port                    => 3314,
            innodb_buffer_pool_size => $s4,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's4': port => 3314, }
        profile::prometheus::mysqld_exporter_instance { 's4': port => 13314, }
    }

    if $s5 {
        mariadb::instance { 's5':
            port                    => 3315,
            innodb_buffer_pool_size => $s5,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's5': port => 3315, }
        profile::prometheus::mysqld_exporter_instance { 's5': port => 13315, }
    }

    if $s6 {
        mariadb::instance { 's6':
            port                    => 3316,
            innodb_buffer_pool_size => $s6,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's6': port => 3316, }
        profile::prometheus::mysqld_exporter_instance { 's6': port => 13316, }
    }

    if $s7 {
        mariadb::instance { 's7':
            port                    => 3317,
            innodb_buffer_pool_size => $s7,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's7': port => 3317, }
        profile::prometheus::mysqld_exporter_instance { 's7': port => 13317, }
    }

    if $s8 {
        mariadb::instance { 's8':
            port                    => 3318,
            innodb_buffer_pool_size => $s8,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 's8': port => 3318, }
        profile::prometheus::mysqld_exporter_instance { 's8': port => 13318, }
    }

    if $x1 {
        mariadb::instance { 'x1':
            port                    => 3320,
            innodb_buffer_pool_size => $x1,
            is_critical             => $is_critical,
        }
        profile::mariadb::ferm { 'x1': port => 3320, }
        profile::prometheus::mysqld_exporter_instance { 'x1': port => 13320, }
    }

    class { 'mariadb::monitor_disk':
        is_critical   => $is_critical,
        contact_group => $contact_group,
    }

    class { 'mariadb::monitor_process':
        process_count => $num_instances,
        is_critical   => $is_critical,
        contact_group => $contact_group,
    }

}