Skip to content

Repairs #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 81 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,82 @@
# puppet-orchestrator-for-mysql
Puppet Module used with Orchestrator

This module is to install the MySQL tool called Orchestrator via puppet. Orchestrator is used for managing replication topologies. See https://github.com/github/orchestrator for instructions on appopriate configuration and setup.

# Usage

```
$config_override = {
'Debug' => true,
'ReadOnly' => false,
'MySQLOrchestratorHost' => 'orchestrator.example.com',
'MySQLOrchestratorPort' => 3306,
'MySQLOrchestratorDatabase' => 'orchestrator',
'RemoveTextFromHostnameDisplay' => '.example.com:3306',
'SlaveLagQuery' => 'select lag from test.heartbeat_table',
'DiscoverByShowSlaveHosts' => false,
'DetectClusterAliasQuery' => 'select cluster_alias from test.cluster_info_table where 1=1',
'DetectClusterDomainQuery' => 'select cluster_domain from test.cluster_info_table where 1=1',
'DataCenterPattern' => '.*-(.*)-.*[.].*[.]example[.]com',
'PhysicalEnvironmentPattern' => '.*-.*-(.*)[.].*[.]example[.]com',
'PseudoGTIDPattern' => '`heartbeat` (ts, server_id, file, position, relay_master_log_file, exec_master_log_pos) VALUES',
'PseudoGTIDPatternIsFixedSubstring' => true,
'PseudoGTIDMonotonicHint' => 'heartbeat',
'DetectPseudoGTIDQuery' => 'select count(*)>0 as pseudo_gtid_exists from test.heartbeat_table where ts > NOW() - INTERVAL 2 DAY;',
'ProblemIgnoreHostnameFilters' => [
'test-server-mysql',
],
'PromotionIgnoreHostnameFilters' => [
'test-server-mysql',
],
'AuditLogFile' => '',
'AuthenticationMethod' => 'token',
'FailureDetectionPeriodBlockMinutes' => 60,
'RecoveryPollSeconds' => 5,
'RecoveryPeriodBlockSeconds' => 600,
'RecoveryIgnoreHostnameFilters' => [],
'RecoverMasterClusterFilters' => [
'mysqla',
'mysqlb',
],
'RecoverIntermediateMasterClusterFilters' => [
'mysqlb',
'mysqlc',
],
'OnFailureDetectionProcesses' => [
"sudo -i recovery-handler -t 'detection' -f '{failureType}' -h '{failedHost}' -C '{failureCluster}' -n '{countSlaves}'"
],
'PreFailoverProcesses' => [
"sudo -i recovery-handler -t 'pre-failover' -f '{failureType}' -h '{failedHost}' -C '{failureCluster}' -n '{countSlaves}'"
],
'PostFailoverProcesses' => [
"sudo -i recovery-handler -t 'post-failover' -f '{failureType}' -h '{failedHost}' -H '{successorHost}' -C '{failureCluster}' -n '{countSlaves}'"
],
'PostUnsuccessfulFailoverProcesses' => [],
'PostMasterFailoverProcesses' => [
"sudo setuidgid orc_user ssh {failedHost} 'sudo -i do_something_on_failed_host > /dev/null 2> /dev/null'",
"sudo setuidgid orc_user ssh {successorHost} 'sudo -i do_something_on_new_host > /dev/null 2> /dev/null'",
],
'PostIntermediateMasterFailoverProcesses' => [
],
'CoMasterRecoveryMustPromoteOtherCoMaster' => true,
'DetachLostSlavesAfterMasterFailover' => true,
'ApplyMySQLPromotionAfterMasterFailover' => false,
'MasterFailoverLostInstancesDowntimeMinutes' => 60,
'PostponeSlaveRecoveryOnLagMinutes' => 10,
'GraphitePollSeconds' => 60,
'GraphiteAddr' => 'graphite.example.com:2113',
'GraphitePath' => 'hosts.{hostname}.orchestrator',
'GraphiteConvertHostnameDotsToUnderscores' => true,
}

class { '::orchestrator':
config_override => $config_override,
package_ensure => 'latest',
package_manage => true,
}
```
# Assumptions

* Puppetlab's stdlib is used by this module.

* The orchestrator deb/rpm package is available to puppet if `orchestrator::params::package_manage` is `true`.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
validate_bool($service_manage)
validate_string($service_name)

# Concept pulled from: https://github.com/puppetlabs/puppetlabs-ntp/blob/master/manifests/init.pp#L98
# Based on https://github.com/puppetlabs/puppetlabs-ntp/blob/8db718ca76d05861b898e26764df1edb79bec989/manifests/init.pp#L65-L67
#
# Anchor this as per #8040 - this ensures that classes won't float off and
# mess everything up. You can read about this at:
Expand Down
7 changes: 4 additions & 3 deletions manifests/my_cnf.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#
class orchestrator::my_cnf inherits orchestrator {
$cnf_erb = 'orchestrator/orchestrator.cnf.erb'

file { $orchestrator::topology_cnf:
content => template("puppet-orchestrator-for-mysql/${orchestrator::topology_cnf}.erb"),
content => template($cnf_erb),
mode => '0644',
}
file { $orchestrator::srv_cnf:
content => template("puppet-orchestrator-for-mysql/${orchestrator::srv_cnf}.erb"),
mode => '0644',
content => template($cnf_erb),
mode => '0644',
}
}
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
$service_ensure = 'running'
$service_manage = true
$service_name = 'orchestrator'
$srv_cnf = '/etc/mysql/orchestrator_srv.cnf'
$topology_cnf = '/etc/mysql/orchestrator.cnf'
$srv_cnf = '/etc/orchestrator_srv.cnf'
$topology_cnf = '/etc/orchestrator.cnf'

$config_defaults = {
'Debug' => true,
Expand Down