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

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

Overview

Parameters:

  • instances (Hash[String, Stdlib::Datasize]) (defaults to: lookup('profile::mariadb::core::multiinstance::instances'))
  • section_ports (Hash[String, Stdlib::Port]) (defaults to: lookup('profile::mariadb::section_ports'))


1
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
# File 'modules/profile/manifests/mariadb/core/multiinstance.pp', line 1

class profile::mariadb::core::multiinstance(
    Hash[String, Stdlib::Datasize] $instances = lookup('profile::mariadb::core::multiinstance::instances'),
    Hash[String, Stdlib::Port] $section_ports = lookup('profile::mariadb::section_ports'),
) {
    require profile::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\"",
    }

    include ::profile::mariadb::mysql_role
    include profile::mariadb::wmfmariadbpy
    require passwords::misc::scripts

    # Read only forced on also for the masters of the primary datacenter
    class { 'mariadb::config':
        datadir       => false,
        basedir       => $profile::mariadb::packages_wmf::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',
    }

    $instances.each |$section, $buffer_pool| {
        $port = $section_ports[$section]
        if (!$port) {
            fail("'${section}' is not a valid section.")
        }
        $prom_port = Integer("1${port}")
        $is_critical = profile::mariadb::section_params::is_writeable_dc($section)
        mariadb::instance { $section:
            port                    => $port,
            innodb_buffer_pool_size => $buffer_pool,
            is_critical             => $is_critical,
            source_dc               => $::site,
        }
        profile::mariadb::section { $section: mention_alias => true }
        profile::mariadb::ferm { $section: port => $port }
        profile::prometheus::mysqld_exporter_instance { $section: port => $prom_port }
        profile::mariadb::replication_lag { $section: prom_port => $prom_port }
        profile::mariadb::grants::core { $section:
            wikiadmin_pass => $passwords::misc::scripts::wikiadmin_pass,
            wikiuser_pass  => $passwords::misc::scripts::wikiuser_pass,
        }

        # hack; remove after wikitech moves to a standard app server
        #  T282209
        if $section == 's6' {
            profile::mariadb::ferm_wikitech { $section: port => $port }
        }
    }

    $is_critical = $instances.any |$section, $buffer_pool| {
        profile::mariadb::section_params::is_writeable_dc($section)
    }

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

    class { 'mariadb::monitor_process':
        process_count => length($instances),
        is_critical   => $is_critical,
    }

    class { 'mariadb::monitor_memory': }
}