Puppet Class: profile::mariadb::misc::eventlogging::database

Defined in:
modules/profile/manifests/mariadb/misc/eventlogging/database.pp

Overview

Class profile::mariadb::misc::eventlogging::database

Configures the database settings for the Eventlogging master/replica.

shard

Database shard

master

Boolean value to establish if the host is acting as Master or Replica.

Parameters:

  • shard (String) (defaults to: lookup('profile::mariadb::misc::eventlogging::database::shard'))
  • master (Boolean) (defaults to: lookup('profile::mariadb::misc::eventlogging::database::master'))


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
# File 'modules/profile/manifests/mariadb/misc/eventlogging/database.pp', line 10

class profile::mariadb::misc::eventlogging::database (
    String  $shard  = lookup('profile::mariadb::misc::eventlogging::database::shard'),
    Boolean $master = lookup('profile::mariadb::misc::eventlogging::database::master'),
) {
    $mysql_role = $master ? {
        true  => 'master',
        false => 'slave',
    }

    class { 'passwords::misc::scripts': }

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

    class { 'mariadb::monitor_process':
        is_critical   => $master,
        contact_group => 'admins',
    }

    include profile::mariadb::monitor::prometheus

    mariadb::monitor_readonly { [ $shard ]:
        read_only     => true,
        is_critical   => false,
        contact_group => 'admins',
    }

    class { 'mariadb::packages_wmf': }
    require_package ('mydumper')

    class { 'mariadb::service': }

    if os_version('debian == buster') {
        $mariadb_basedir = '/opt/wmf-mariadb104/'
    }
    else {
        $mariadb_basedir = '/opt/wmf-mariadb101/'
    }
    $mariadb_socket = '/run/mysqld/mysqld.sock'

    # History context: there used to be two hosts with the 'log'
    # database, on representing the master and the other the replica.
    # After T159170 we keep only one instance as read-only replica
    # in case historical queries are needed (for data not yet in Hadoop).
    class { 'mariadb::config':
        basedir       => $mariadb_basedir,
        config        => 'profile/mariadb/misc/eventlogging/eventlogging.my.cnf.erb',
        datadir       => '/srv/sqldata',
        tmpdir        => '/srv/tmp',
        socket        => $mariadb_socket,
        port          => 3306,
        read_only     => 1,
        ssl           => 'puppet-cert',
        p_s           => 'off',
        binlog_format => 'MIXED',
    }

    # FIXME: instantiating a role in a profile is not
    # allowed by our coding standard, but it needs to be
    # refactored on a separate change since it is broadly used.
    class { 'profile::mariadb::grants::production':
        shard    => $shard,
        prompt   => "EVENTLOGGING ${shard}",
        password => $passwords::misc::scripts::mysql_root_pass,
    }
}