<commit_before># puppet-galera

[![Build Status](https://travis-ci.org/fraenki/puppet-galera.png?branch=master)](https://travis-ci.org/fraenki/puppet-galera)

NOTE: The "master" branch on GitHub contains the development version, which may break anything at any time. Consider using one of the stable branches instead.

#### Table of Contents

1. [Overview](#overview)
2. [Requirements](#requirements)
3. [Usage](#usage)
    - [Beginning with galera](#beginning-with-galera)
    - [Custom repository configuration](#custom-repository-configuration)
4. [Reference](#reference)
    - [Public classes](#public-classes)
        - [galera](#class-galera)
        - [galera::firewall](#class-galerafirewall)
        - [galera::repo](#class-galerarepo)
    - [Private classes](#private-classes)
        - [galera::debian](#class-galeradebian)
        - [galera::mariadb](#class-galeramariadb)
        - [galera::status](#class-galerastatus)
        - [galera::validate](#class-galeravalidate)
5. [Limitations](#limitations)
6. [Development](#development)
    - [Contributing](#contributing)

## Overview

This module will massage puppetlabs-mysql into creating a MySQL or MariaDB galera cluster.

It will try to recover from failures by bootstrapping on a node designated as the master if no other nodes appear to be running mysql, but if the cluster goes down and the master is permanently taken out, another node will need to be specified as the 'master' that can bootstrap the cluster.

## Requirements

* Puppet 4.10 or higher
* puppetlabs-mysql

## Usage

### Beginning with galera

Basic usage requires only the FQDN of the master node, a list of IP addresses of other nodes and two passwords:

    class { 'galera':
        galera_servers  => ['10.0.99.101', '10.0.99.102'],
        galera_master   => 'node1.example.com',
        root_password   => '<PASSWORD>',
        status_password => '<PASSWORD>',
    }

This will install the default galera vendor and version. However, in a production environment you should definitely specify the vendor and version to avoid accidential updates:

    class { 'galera':
        vendor_type     => 'percona',
        vendor_version  => '5.7',
        ...

On Debian/Ubuntu systems the user `debian-sys-maint@localhost` is required for updates and will be created automatically, but you should set a proper password:

    class { 'galera':
        deb_sysmaint_password => '<PASSWORD>',
        ...

Furthermore, a number of simple options are available:

    class { 'galera':
        galera_servers  => ['10.0.99.101', '10.0.99.102'],
        galera_master   => 'node1.example.com',
        root_password   => '<PASSWORD>',
        status_password => '<PASSWORD>',

        # Default is 'percona'
        vendor_type     => 'codership',

        # This will be used to populate my.cnf values that
        # control where wsrep binds, advertises, and listens
        local_ip => $facts['networking']['ip'],

        # This will be set when the cluster is bootstrapped
        root_password => '<PASSWORD>',

        # Disable this if you don't want firewall rules to be set
        configure_firewall => true,

        # These options are only used for the firewall - 
        # to change the my.cnf settings, use the override options
        # described below
        $mysql_port = 3306, 
        $wsrep_state_transfer_port = 4444,
        $wsrep_inc_state_transfer_port = 4568,

        # This is used for the firewall + for status checks
        # when deciding whether to bootstrap
        $wsrep_group_comm_port = 4567,
    }

A catch-all parameter can be used to populate my.cnf in the same way as the puppetlabs-mysql module:

    class { 'galera':
        override_options = {
            'mysqld' => {
                'bind_address' => '0.0.0.0',
            }
        }
        ...

### Custom repository configuration

Disable repo management if you are managing your own repos and mirrors:

    class { 'galera':
        configure_repo => disable,
        ...

Or if you just want to switch to using a local mirror:

    # RHEL-based systems
    class { 'galera::repo':
        yum_baseurl => "http://repo.example.com/release/${facts['os']['release']['major']}/RPMS/${facts['os']['architecture']}/",
        ...

    # Debian-based systems
    class { 'galera::repo':
        apt_location => "http://repo.example.com/apt/${facts['os']['distro']['codename']}/",
        ...

## Reference

### Public Classes
<commit_msg>Fix README typos<commit_after># puppet-galera

[![Build Status](https://travis-ci.org/fraenki/puppet-galera.png?branch=master)](https://travis-ci.org/fraenki/puppet-galera)

NOTE: The "master" branch on GitHub contains the development version, which may break anything at any time. Consider using one of the stable branches instead.

#### Table of Contents

1. [Overview](#overview)
2. [Requirements](#requirements)
3. [Usage](#usage)
    - [Beginning with galera](#beginning-with-galera)
    - [Custom repository configuration](#custom-repository-configuration)
4. [Reference](#reference)
    - [Public classes](#public-classes)
        - [galera](#class-galera)
        - [galera::firewall](#class-galerafirewall)
        - [galera::repo](#class-galerarepo)
    - [Private classes](#private-classes)
        - [galera::debian](#class-galeradebian)
        - [galera::mariadb](#class-galeramariadb)
        - [galera::status](#class-galerastatus)
        - [galera::validate](#class-galeravalidate)
5. [Limitations](#limitations)
6. [Development](#development)
    - [Contributing](#contributing)

## Overview

This module will massage puppetlabs-mysql into creating a MySQL or MariaDB galera cluster.

It will try to recover from failures by bootstrapping on a node designated as the master if no other nodes appear to be running mysql, but if the cluster goes down and the master is permanently taken out, another node will need to be specified as the 'master' that can bootstrap the cluster.

## Requirements

* Puppet 5 or higher
* puppetlabs-mysql

## Usage

### Beginning with galera

Basic usage requires only the FQDN of the master node, a list of IP addresses of other nodes and two passwords:

```puppet
class { 'galera':
  galera_servers  => ['10.0.99.101', '10.0.99.102'],
  galera_master   => 'node1.example.com',
  root_password   => '<PASSWORD>',
  status_password => '<PASSWORD>',
}
```

This will install the default galera vendor and version. However, in a production environment you should definitely specify the vendor and version to avoid accidential updates:

```puppet
class { 'galera':
  vendor_type    => 'percona',
  vendor_version => '5.7',
  ...
```

On Debian/Ubuntu systems the user `debian-sys-maint@localhost` is required for updates and will be created automatically, but you should set a proper password:

```puppet
class { 'galera':
  deb_sysmaint_password => '<PASSWORD>',
  ...
```

Furthermore, a number of simple options are available:

```puppet
class { 'galera':
  galera_servers  => ['10.0.99.101', '10.0.99.102'],
  galera_master   => 'node1.example.com',
  root_password   => '<PASSWORD>',
  status_password => '<PASSWORD>',

  # Default is 'percona'
  vendor_type     => 'codership',

  # This will be used to populate my.cnf values that
  # control where wsrep binds, advertises, and listens
  local_ip => $facts['networking']['ip'],

  # This will be set when the cluster is bootstrapped
  root_password => '<PASSWORD>',

  # Disable this if you don't want firewall rules to be set
  configure_firewall => true,

  # These options are only used for the firewall -
  # to change the my.cnf settings, use the override options
  # described below
  mysql_port => 3306,
  wsrep_state_transfer_port => 4444,
  wsrep_inc_state_transfer_port => 4568,

  # This is used for the firewall + for status checks
  # when deciding whether to bootstrap
  wsrep_group_comm_port => 4567,
}
```

A catch-all parameter can be used to populate my.cnf in the same way as the puppetlabs-mysql module:

```puppet
class { 'galera':
  override_options => {
    'mysqld' => {
      'bind_address' => '0.0.0.0',
    }
  }
  ...
}
```

### Custom repository configuration

Disable repo management if you are managing your own repos and mirrors:

```puppet
class { 'galera':
  configure_repo => false,
  ...
}
```

Or if you just want to switch to using a local mirror:

    # RHEL-based systems
```puppet
class { 'galera::repo':
  yum_baseurl => "http://repo.example.com/release/${facts['os']['release']['major']}/RPMS/${facts['os']['architecture']}/",
  ...
```
    # Debian-based systems
```puppet
class { 'galera::repo':
  apt_location => "http://repo.example.com/apt/${facts['os']['distro']['codename']}/",
  ...
```

## Reference

### Public Classes

{'fraction_non_alphanumeric': 0.12622913331808827, 'fraction_numerical': 0.014635261833981249, 'mean_word_length': 3.371314342828586, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 60, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 10, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '37363', 'n_tokens_mistral': 2810, 'n_tokens_neox': 2591, 'n_words': 820}