{"id":15517936,"url":"https://github.com/hfm/puppet-mha","last_synced_at":"2025-04-23T03:52:28.748Z","repository":{"id":24584125,"uuid":"27992144","full_name":"hfm/puppet-mha","owner":"hfm","description":"The MHA module handles installing, configuring, and running MHA for MySQL.","archived":false,"fork":false,"pushed_at":"2018-11-15T01:33:05.000Z","size":529,"stargazers_count":4,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T21:51:08.063Z","etag":null,"topics":["mha","mysql","puppet"],"latest_commit_sha":null,"homepage":"https://forge.puppetlabs.com/hfm/mha","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hfm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-14T11:26:12.000Z","updated_at":"2020-08-14T08:20:02.000Z","dependencies_parsed_at":"2022-08-23T02:21:41.930Z","dependency_job_id":null,"html_url":"https://github.com/hfm/puppet-mha","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfm%2Fpuppet-mha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfm%2Fpuppet-mha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfm%2Fpuppet-mha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfm%2Fpuppet-mha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hfm","download_url":"https://codeload.github.com/hfm/puppet-mha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250366687,"owners_count":21418768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mha","mysql","puppet"],"created_at":"2024-10-02T10:14:33.584Z","updated_at":"2025-04-23T03:52:28.732Z","avatar_url":"https://github.com/hfm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"puppet-mha\n===\n\n[![Build Status](https://img.shields.io/travis/hfm/puppet-mha/master.svg?style=flat-square)](https://travis-ci.org/hfm/puppet-mha)\n[![Puppet Forge](https://img.shields.io/puppetforge/v/hfm/mha.svg?style=flat-square)](https://forge.puppetlabs.com/hfm/mha)\n\n#### Table of Contents\n\n1. [Description](#description)\n1. [Setup - The basics of getting started with MHA](#setup)\n    - [Setup requirements](#setup-requirements)\n    - [Beginning with MHA](#beginning-with-mha)\n1. [Usage - Configuration options and additional functionality](#usage)\n    - [Configuring mha::manager](#configuring-mhamanager)\n    - [Configuring mha::node](#configuring-mhanode)\n    - [Configuring modules from Hiera](#configuring-modules-from-hiera)\n1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)\n    - [Public Classes](#public-classes)\n    - [Private Classes](#private-classes)\n    - [Defined Types](#defined-types)\n1. [Limitations - OS compatibility, etc.](#limitations)\n1. [Development - Guide for contributing to the module](#development)\n    - [Running tests](#running-tests)\n    - [Testing quickstart](#testing-quickstart)\n    - [Smoke tests](#smoke-tests)\n\n## Description\n\nThe MHA module handles installing, configuring, and running [MHA for MySQL](https://code.google.com/p/mysql-master-ha/).\n\n## Setup\n\n### Setup Requirements\n\nThe MHA module requires the following puppet modules:\n\n- [puppetlabs-stdlib](https://forge.puppet.com/puppetlabs/stdlib): version 3.0.0 or newer.\n- [puppetlabs-mysql](https://forge.puppet.com/puppetlabs/mysql): version 3.5.0 or newer.\n- [proletaryo-supervisor](https://forge.puppet.com/provision/supervisor): version 0.5.0 - 0.6.0.\n- [stahnma-epel](https://forge.puppet.com/stahnma/epel): version 1.0.0 or newer.\n\n### Beginning with MHA\n\nTo install the mha4mysql-manager with default parameters, declare the `mha::manager` class.\n\n```puppet\ninclude '::mha::manager'\n```\n\nTo install the mha4mysql-node with default parameters, declare the `mha::node` class.\n\n```puppet\ninclude '::mha::node'\n```\n\n## Usage\n\n### Configuring mha::manager\n\n```puppet\nclass { '::mha::manager':\n  version       =\u003e '0.57-0',\n  node_version  =\u003e '0.57-0',\n  script_ensure =\u003e present,\n}\n```\n\n### Configuring mha::node\n\n```puppet\nclass { '::mha::node':\n  user            =\u003e 'mha',\n  password        =\u003e 'mysq1m@$terh@',\n  repl_user       =\u003e 'replicator',\n  repl_password   =\u003e 'rep1ic@t1r',\n  manager         =\u003e 'master-ha.example.com',\n  nodes           =\u003e [\n    {\n      'hostname'         =\u003e 'node001.example.com',\n      'candidate_master' =\u003e 1,\n    },\n    {\n      'hostname'         =\u003e 'node002.example.com',\n      'candidate_master' =\u003e 1,\n    },\n    {\n      'hostname'         =\u003e 'node003.example.com',\n    },\n  ],\n  ssh_private_key =\u003e '-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----',\n  ssh_key_type    =\u003e 'ssh-rsa',\n  ssh_public_key  =\u003e 'AAAAB3NzaC1yc2EAAAADAQABAAABAQCtnFFI/ICCBmr4LY0gIgyF3Jex20KwTFT67aoNGxAvjRSsg9d+c0/sxq0oBZSdgLoRrlnSu226mvv89E6dnc61JFbJpWN6et8qTW75e2/cU/DIe2vS3nTBcBvgj23oF2c5Wv7Vy2FacdDXaLa7tKmAnetI7FT+0IwmR7FMCvREmOqn4eCTkoUNXdLHqkQ0f2SSYBUUyno68nUM1bXgc63bQU8T1tr8kZ2t3NHpAa8YEYraKbCltsBkyqr7FExe5o23RyML4NuKfa1UllJhZO3IrQgbiAXsIFZpEqbcL8tObQ55nQIrNzZEvHoDN7K7jZP4WdjfTF26xSqJ+LrlGsRV',\n}\n```\n\n### Configuring modules from Hiera\n\n```yaml\n---\nmha::manager::version: '0.57-0'\nmha::manager::node_version: '0.57-0'\n\nmha::node::user: 'mha'\nmha::node::password: 'mysq1m@$terh@'\nmha::node::repl_user: 'replicator'\nmha::node::repl_password: 'rep1ic@t0r'\nmha::node::manager: 'master-ha.example.com'\nmha::node::nodes:\n  - hostname: 'node001.example.com'\n    candidate_master: 1\n  - hostname: 'node002.example.com'\n    candidate_master: 1\n  - hostname: 'node003.example.com'\nmha::node::ssh_key_type: 'ssh-rsa'\nmha::node::ssh_public_key: 'AAAAB3NzaC1yc2EAAAADAQABAAABAQCtnFFI/ICCBmr4LY0gIgyF3Jex20KwTFT67aoNGxAvjRSsg9d+c0/sxq0oBZSdgLoRrlnSu226mvv89E6dnc61JFbJpWN6et8qTW75e2/cU/DIe2vS3nTBcBvgj23oF2c5Wv7Vy2FacdDXaLa7tKmAnetI7FT+0IwmR7FMCvREmOqn4eCTkoUNXdLHqkQ0f2SSYBUUyno68nUM1bXgc63bQU8T1tr8kZ2t3NHpAa8YEYraKbCltsBkyqr7FExe5o23RyML4NuKfa1UllJhZO3IrQgbiAXsIFZpEqbcL8tObQ55nQIrNzZEvHoDN7K7jZP4WdjfTF26xSqJ+LrlGsRV'\nmha::node::ssh_private_key: |\n-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n```\n\n## Reference\n\n### Public Classes\n\n#### `mha::manager`\n\nInstall and configure mha4mysql-manager, and install the mysql\\_online\\_switch script.\n\n- `version`: Specify a mha4mysql-manager version. Valid values is 'x.y-z' like '0.57-0'.\n- `node_version`: Specify a mha4mysql-node version. Valid values is 'x.y-z' like '0.57-0'.\n- `script_ensure`: Whether the mysql\\_online\\_switch script should exist. Default to present.\n\n#### `mha::node`\n\nInstall and configure mha4mysql-node, create grant permissions to access MySQL for administrator and replicator, configure the cron job to run purge\\_relay\\_logs script, and install a ssh key-pair.\n\n- `manager`: Specify the host for mha4mysql-manager. Default to undef.\n- `version`: Specify the mha4mysql-node version. Valid values is 'x.y-z' like '0.57-0'.\n- `nodes`: Specify The array of the target MySQL servers that include hostname or IP address, or candidate\\_master. Default to [].\n- `user`: The MySQL administrative database username ([ref](https://code.google.com/p/mysql-master-ha/wiki/Parameters#user)). Default: 'root'.\n- `password`: The MySQL password of the \"$user\" user ([ref](https://code.google.com/p/mysql-master-ha/wiki/Parameters#password)). Default to '' (empty).\n- `repl_user`: The MySQL replication username ([ref](https://code.google.com/p/mysql-master-ha/wiki/Parameters#repl_user)). Default to 'repl'.\n- `repl_password`: The MySQL password of the repl user ([ref](https://code.google.com/p/mysql-master-ha/wiki/Parameters#repl_password)). Default: '' (empty).\n- `ssh_user`: The user connecting to mha-node with ssh. Default to 'root'\n- `ssh_key_type`: The encryption type used ([ref](https://docs.puppet.com/puppet/latest/reference/types/ssh_authorized_key.html#ssh_authorized_key-attribute-type)).\n- `ssh_public_key`: The public key itself as the same as [Ssh_authorized_key key attributes](https://docs.puppet.com/puppet/latest/reference/types/ssh_authorized_key.html#ssh_authorized_key-attribute-key).\n- `ssh_key_path`: The path to the private key to manage. Default to '/root/.ssh/id\\_mha'.\n- `ssh_private_key`: The private key itself. See also [./manifests/params.pp](manifests/params.pp).\n- `cron_ensure`: Whether the cron job should be in. Default to present.\n- `cron_user`: The user who owns the cron job. This user must be allowed to run this job. Default to 'root'.\n- `cron_minute`: The minute at which to run the cron job. Default to '10'.\n- `cron_hour`: The hour at which to run the cron job. Default to '2-23/6'.\n\n### Private Classes\n\n- `mha::node::grants`: Create grant permissions to access MySQL for administrator and replicator.\n- `mha::node::install`: Install mha4mysql-node package.\n- `mha::node::purge_relay_logs`: Configure the cron job to run purge\\_relay\\_logs script.\n\n### Defined Types\n\n#### `mha::manager::app`\n\nSet up an application configuration file and configure mha4mysql-manager.\n\n- `nodes`: The array of the target MySQL servers that include hostname or IP address, or candidate\\_master. Default to [].\n- `user`: The MySQL administrative database username. See https://code.google.com/p/mysql-master-ha/wiki/Parameters#user. Default: 'root'.\n- `password`: The MySQL password of the \"$user\" user. See https://code.google.com/p/mysql-master-ha/wiki/Parameters#password. Default to '' (empty).\n- `repl_user`: The MySQL replication username. See https://code.google.com/p/mysql-master-ha/wiki/Parameters#repl_user. Default to 'repl'.\n- `repl_password`: The MySQL password of the repl user. See https://code.google.com/p/mysql-master-ha/wiki/Parameters#repl_password. Default: '' (empty).\n- `ping_interval`: See https://code.google.com/p/mysql-master-ha/wiki/Parameters#ping_interval. Default to '3'.\n- `ping_type`: See https://code.google.com/p/mysql-master-ha/wiki/Parameters#ping_type. Default to 'SELECT'.\n- `ssh_user`: See https://code.google.com/p/mysql-master-ha/wiki/Parameters#ssh_user. Default to 'root'.\n- `ssh_port`: See https://code.google.com/p/mysql-master-ha/wiki/Parameters#ssh_port. Default to '22'.\n- `ssh_key_path`: The path to the private key to manage. Default to '/root/.ssh/id\\_mha'.\n- `ssh_private_key`: The private key itself. See also [./manifests/params.pp](manifests/params.pp).\n- `default`: Other parameters for [server default] block. Default to {}.\n- `manage_daemon`: Whether the masterha\\_manager program should be managed by suporvisord. Default to false.\n\n#### `mha::node::grants::admin`\n\nCreate grant permissions to access MySQL for administrator.\n\n- `user`: The MySQL administrative database username. Default: undef.\n- `password`: The MySQL password of the \"$user\" user.  Default: undef.\n- `host`: The host to use as part of user@host for grants. Default is a resource name (`$name`).\n\n#### `mha::node::grants::repl`\n\nCreate grant permissions to access MySQL for replicator.\n\n- `user`: The MySQL replication username. Default: undef.\n- `password`: The MySQL password of the repl user. Default: undef.\n- `host`: The host to use as part of user@host for grants. Default is a resource name (`$name`).\n\n## Limitations\n\nThis module has been tested on:\n\n- RedHat Enterprise Linux 5, 6, 7\n- CentOS 5, 6, 7\n- Scientific Linux 5, 6, 7\n\n## Development\n\n### Running tests\n\nThe MHA puppet module contains tests for both [rspec-puppet](http://rspec-puppet.com/) (unit tests) and [beaker-rspec](https://github.com/puppetlabs/beaker-rspec) (acceptance tests) to verify functionality.\nFor detailed information on using these tools, please see their respective documentation.\n\n#### Testing quickstart\n\n- Unit tests:\n\n```console\n$ bundle install\n$ bundle exec rake\n```\n\n- Acceptance tests:\n\n```console\n# Set your DOCKER_HOST variable\n$ eval \"$(docker-machine env default)\"\n\n# List available beaker nodesets\n$ bundle exec rake beaker_nodes\ncentos6\ncentos7\n\n# Run beaker acceptance tests\n$ BEAKER_set=centos7 bundle exec rake beaker\n```\n\n#### Smoke tests\n\nYou can run smoke tests using [Vagrant](https://www.vagrantup.com/):\n\n```console\n$ vagrant up \u003cvm\u003e --provision\n```\n\n### Authors\n\n- [KURODA Ryo](https://github.com/lamanotrama)\n- [OKUMURA Takahiro](https://github.com/hfm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfm%2Fpuppet-mha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhfm%2Fpuppet-mha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfm%2Fpuppet-mha/lists"}