Skip to content

Commit 7a9c4bf

Browse files
author
Tom Krouper
authored
Merge pull request #3 from github/repairs
Repairs
2 parents e478fa7 + 3a085f5 commit 7a9c4bf

File tree

6 files changed

+88
-7
lines changed

6 files changed

+88
-7
lines changed

README.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,82 @@
11
# puppet-orchestrator-for-mysql
2-
Puppet Module used with Orchestrator
2+
3+
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.
4+
5+
# Usage
6+
7+
```
8+
$config_override = {
9+
'Debug' => true,
10+
'ReadOnly' => false,
11+
'MySQLOrchestratorHost' => 'orchestrator.example.com',
12+
'MySQLOrchestratorPort' => 3306,
13+
'MySQLOrchestratorDatabase' => 'orchestrator',
14+
'RemoveTextFromHostnameDisplay' => '.example.com:3306',
15+
'SlaveLagQuery' => 'select lag from test.heartbeat_table',
16+
'DiscoverByShowSlaveHosts' => false,
17+
'DetectClusterAliasQuery' => 'select cluster_alias from test.cluster_info_table where 1=1',
18+
'DetectClusterDomainQuery' => 'select cluster_domain from test.cluster_info_table where 1=1',
19+
'DataCenterPattern' => '.*-(.*)-.*[.].*[.]example[.]com',
20+
'PhysicalEnvironmentPattern' => '.*-.*-(.*)[.].*[.]example[.]com',
21+
'PseudoGTIDPattern' => '`heartbeat` (ts, server_id, file, position, relay_master_log_file, exec_master_log_pos) VALUES',
22+
'PseudoGTIDPatternIsFixedSubstring' => true,
23+
'PseudoGTIDMonotonicHint' => 'heartbeat',
24+
'DetectPseudoGTIDQuery' => 'select count(*)>0 as pseudo_gtid_exists from test.heartbeat_table where ts > NOW() - INTERVAL 2 DAY;',
25+
'ProblemIgnoreHostnameFilters' => [
26+
'test-server-mysql',
27+
],
28+
'PromotionIgnoreHostnameFilters' => [
29+
'test-server-mysql',
30+
],
31+
'AuditLogFile' => '',
32+
'AuthenticationMethod' => 'token',
33+
'FailureDetectionPeriodBlockMinutes' => 60,
34+
'RecoveryPollSeconds' => 5,
35+
'RecoveryPeriodBlockSeconds' => 600,
36+
'RecoveryIgnoreHostnameFilters' => [],
37+
'RecoverMasterClusterFilters' => [
38+
'mysqla',
39+
'mysqlb',
40+
],
41+
'RecoverIntermediateMasterClusterFilters' => [
42+
'mysqlb',
43+
'mysqlc',
44+
],
45+
'OnFailureDetectionProcesses' => [
46+
"sudo -i recovery-handler -t 'detection' -f '{failureType}' -h '{failedHost}' -C '{failureCluster}' -n '{countSlaves}'"
47+
],
48+
'PreFailoverProcesses' => [
49+
"sudo -i recovery-handler -t 'pre-failover' -f '{failureType}' -h '{failedHost}' -C '{failureCluster}' -n '{countSlaves}'"
50+
],
51+
'PostFailoverProcesses' => [
52+
"sudo -i recovery-handler -t 'post-failover' -f '{failureType}' -h '{failedHost}' -H '{successorHost}' -C '{failureCluster}' -n '{countSlaves}'"
53+
],
54+
'PostUnsuccessfulFailoverProcesses' => [],
55+
'PostMasterFailoverProcesses' => [
56+
"sudo setuidgid orc_user ssh {failedHost} 'sudo -i do_something_on_failed_host > /dev/null 2> /dev/null'",
57+
"sudo setuidgid orc_user ssh {successorHost} 'sudo -i do_something_on_new_host > /dev/null 2> /dev/null'",
58+
],
59+
'PostIntermediateMasterFailoverProcesses' => [
60+
],
61+
'CoMasterRecoveryMustPromoteOtherCoMaster' => true,
62+
'DetachLostSlavesAfterMasterFailover' => true,
63+
'ApplyMySQLPromotionAfterMasterFailover' => false,
64+
'MasterFailoverLostInstancesDowntimeMinutes' => 60,
65+
'PostponeSlaveRecoveryOnLagMinutes' => 10,
66+
'GraphitePollSeconds' => 60,
67+
'GraphiteAddr' => 'graphite.example.com:2113',
68+
'GraphitePath' => 'hosts.{hostname}.orchestrator',
69+
'GraphiteConvertHostnameDotsToUnderscores' => true,
70+
}
71+
72+
class { '::orchestrator':
73+
config_override => $config_override,
74+
package_ensure => 'latest',
75+
package_manage => true,
76+
}
77+
```
78+
# Assumptions
79+
80+
* Puppetlab's stdlib is used by this module.
81+
82+
* The orchestrator deb/rpm package is available to puppet if `orchestrator::params::package_manage` is `true`.

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
validate_bool($service_manage)
2626
validate_string($service_name)
2727

28-
# Concept pulled from: https://github.com/puppetlabs/puppetlabs-ntp/blob/master/manifests/init.pp#L98
28+
# Based on https://github.com/puppetlabs/puppetlabs-ntp/blob/8db718ca76d05861b898e26764df1edb79bec989/manifests/init.pp#L65-L67
2929
#
3030
# Anchor this as per #8040 - this ensures that classes won't float off and
3131
# mess everything up. You can read about this at:

manifests/my_cnf.pp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#
22
class orchestrator::my_cnf inherits orchestrator {
3+
$cnf_erb = 'orchestrator/orchestrator.cnf.erb'
34

45
file { $orchestrator::topology_cnf:
5-
content => template("puppet-orchestrator-for-mysql/${orchestrator::topology_cnf}.erb"),
6+
content => template($cnf_erb),
67
mode => '0644',
78
}
89
file { $orchestrator::srv_cnf:
9-
content => template("puppet-orchestrator-for-mysql/${orchestrator::srv_cnf}.erb"),
10-
mode => '0644',
10+
content => template($cnf_erb),
11+
mode => '0644',
1112
}
1213
}

manifests/params.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
$service_ensure = 'running'
1111
$service_manage = true
1212
$service_name = 'orchestrator'
13-
$srv_cnf = '/etc/mysql/orchestrator_srv.cnf'
14-
$topology_cnf = '/etc/mysql/orchestrator.cnf'
13+
$srv_cnf = '/etc/orchestrator_srv.cnf'
14+
$topology_cnf = '/etc/orchestrator.cnf'
1515

1616
$config_defaults = {
1717
'Debug' => true,

0 commit comments

Comments
 (0)