Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix namespace clash between cmon and galera

  • Loading branch information...
commit 8e08eec492d4245cbd2c6bed4a8b55d086083931 1 parent 7c50592
alex-s9s authored
121 cmon/README.md
Source Rendered
@@ -17,7 +17,8 @@ Platform
17 17
18 18 Tested on:
19 19
20   -* Ubuntu 11.10 w/ chef-solo and chef-server v0.10.8 only.
  20 +* Ubuntu 12.04 w/ Chef-server v10.16.2.
  21 +* Ubuntu 11.10 w/ Chef-solo and Chef-server v0.10.8.
21 22
22 23 Cookbooks
23 24 ---------
@@ -29,37 +30,62 @@ N/A
29 30
30 31 Attributes
31 32 ==========
32   -The cmon controller recipe uses apt/yum packages and there should not be neccssary to change a lof of the attribtues besides specifying a 'root_password'.
33   -
34   -Use overrides for changing for example the MySQL root password to be different than for the cmon controller's.
35   -
36   -* ['mysql']['root_password'] - Monitored MySQL root password (password)
37   -* ['mysql']['mysql_bin'] = ['mysql']['bin_dir'] + "/mysql"
38   -
39   -* ['controller']['mysql_user'] - cmon controller MySQL user (cmon)
40   -* ['controller']['mysql_password'] - cmon controller MySQL user's password (cmon)
41   -* ['controller']['mysql_hostname'] - cmon controller MySQL hostname (nnn)
42   -* ['controller']['mysql_port'] - cmon controller MySQL port (3306)
43   -
44   -* ['cmon_password'] = cmon controller user's password (cmon)
45   -* ['mode']['agent'] = run as 'agent'
46   -* ['mode']['controller'] = run as 'controller'
47   -* ['mode']['dual'] = run in 'dual' mode, i.e., both as controller and agent
48   -
49   -* ['agent']['mysql_user'] - agent's MySQL user (cmon)
50   -* ['agent']['mysql_password'] - agent user's password (cmon)
51   -* ['agent']['mysql_hostname'] - monitored MySQL server hostname (127.0.0.1)
52   -* ['agent']['mysql_port'] - monitored MySQL port (3306)
53   -* ['mysql']['root_password'] - Monitored MySQL root password (password)
54   -
55   -* ['mysql']['data_dir'] = "/var/lib/mysql"
  33 +The cmon controller recipe uses apt/yum packages and it should not be neccssary to change a many of the attribtues besides specifying a 'root_password' and some MySQL settings like the InnoDB buffer pool etc.
  34 +
  35 +Use role overrides for changing for example the MySQL root password to be different than for the cmon controller's or the location of the MySQL installation for the agents.
  36 +
  37 + override_attributes({
  38 + "cmon_mysql" => {
  39 + "install_dir" => "/usr/local",
  40 + "mysql_bin" => "/usr/local/mysql/bin/mysql",
  41 + "root_password" => "password"}
  42 + }
  43 + )
  44 +
  45 +* node['cmon_mysql']['root_password'] - Monitored MySQL root password (password)
  46 +
  47 +* node['controller']['mysql_user'] - cmon controller MySQL user (cmon)
  48 +* node['controller']['mysql_password'] - cmon controller MySQL user's password (cmon)
  49 +* node['controller']['mysql_hostname'] - cmon controller MySQL hostname (nnn)
  50 +* node['controller']['mysql_port'] - cmon controller MySQL port (3306)
  51 +* node['cmon_password'] - cmon controller user's password (cmon)
  52 +
  53 +* node['agent']['mysql_user'] - agent's MySQL user (cmon)
  54 +* node['agent']['mysql_password'] - agent user's password (cmon)
  55 +* node['agent']['mysql_hostname'] - monitored MySQL server hostname (127.0.0.1)
  56 +* node['agent']['mysql_port'] - monitored MySQL port (3306)
  57 +* node['mysql']['root_password'] - Monitored MySQL root password (password)
  58 +
  59 +* node['install_dir_cmon'] = "/usr/local"
  60 +* node['cmon_mysql']['install_dir'] = "/"
  61 +* node['cmon_mysql']['basedir'] = "/usr"
  62 +* node['cmon_mysql']['datadir'] = "/var/lib/mysql"
  63 +
  64 +* node['cmon_mysql']['innodb']['buffer_pool_size'] = "256M"
  65 +* node['cmon_mysql']['innodb']['flush_log_at_trx_commit'] = 2
  66 +* node['cmon_mysql']['innodb']['file_per_table'] = 1
  67 +* node['cmon_mysql']['innodb']['doublewrite'] = 0
  68 +* node['cmon_mysql']['innodb']['log_file_size'] = "512M"
  69 +* node['cmon_mysql']['innodb']['log_files_in_group'] = 2
  70 +* node['cmon_mysql']['innodb']['buffer_pool_instances'] = 1
  71 +* node['cmon_mysql']['innodb']['max_dirty_pages_pct'] = 75
  72 +* node['cmon_mysql']['innodb']['thread_concurrency'] = 0
  73 +* node['cmon_mysql']['innodb']['concurrency_tickets'] = 5000
  74 +* node['cmon_mysql']['innodb']['thread_sleep_delay'] = 10000
  75 +* node['cmon_mysql']['innodb']['lock_wait_timeout'] = 50
  76 +* node['cmon_mysql']['innodb']['io_capacity'] = 200
  77 +* node['cmon_mysql']['innodb']['read_io_threads'] = 4
  78 +* node['cmon_mysql']['innodb']['write_io_threads'] = 4
  79 +
  80 +* node['cmon_mysql']['innodb']['file_format'] = "barracuda"
  81 +* node['cmon_mysql']['innodb']['flush_method'] = "O_DIRECT"
56 82
57 83 and others please see attributes/default.rb
58 84
59 85 Data Bags
60 86 =========
61 87
62   -Data items are used by the controller recipe to for example add agent hosts
  88 +Data items are used by the controller recipe to for example add agent hosts
63 89 to its grant table and the agent recipe uses the controller_host_ipaddress to
64 90 set a controller host.
65 91
@@ -69,10 +95,10 @@ s9s_controller / config.json
69 95 "id": "config",
70 96 "controller_host_ipaddress": "192.168.122.11",
71 97 "mode": "controller",
72   - "type": "replication",
73   - "cmon_tarball_x86_64": "cmon-1.1.27-64bit-glibc23-mc70.tar.gz",
74   - "cmon_tarball_i686": "cmon-1.1.27-32bit-glibc23-mc70.tar.gz",
75   - "cmon_tarball_i386": "cmon-1.1.27-32bit-glibc23-mc70.tar.gz",
  98 + "type": "galera",
  99 + "cmon_tarball_x86_64": "cmon-1.1.35c-64bit-glibc23-mc70.tar.gz",
  100 + "cmon_tarball_i686": "cmon-1.1.35c-32bit-glibc23-mc70.tar.gz",
  101 + "cmon_tarball_i386": "cmon-1.1.35c-32bit-glibc23-mc70.tar.gz",
76 102 "cmon_source": "http://www.severalnines.com/downloads/cmon",
77 103 "cc_pub_key": "",
78 104 "agent_hosts": [
@@ -81,10 +107,11 @@ s9s_controller / config.json
81 107 "192.168.122.16"
82 108 ]
83 109 }
84   -
85   -* **controller_host_ipaddress** The controller's IP address.
86   -* **agent_hosts** is a list of agents that is deployed. This list is used to setup grants for the agents.
87   -* **cc_pub_key** is a place holder for the public ssh key which is generated on the ClusterControl controller host. The agent hosts will have this key authorized to access its server. You would paste in the public key here before deploying agents.
  110 +
  111 +* **controller_host_ipaddress** The controller's IP address.
  112 +* **agent_hosts** is a list of agents that is deployed. This list is used to setup grants for the agents.
  113 +* **cc_pub_key** is a place holder for the public ssh key (/root/.ssh/id_rsa) which is generated on the ClusterControl controller host. During installation of the agents this key will be added to authorized_keys on the servers.
  114 +You need to paste in the public key here before deploying agents.
88 115
89 116 Usage
90 117 =====
@@ -92,37 +119,39 @@ Usage
92 119 Roles:
93 120 Controller Role: cc_controller
94 121 run_list [
95   - "recipe[cmon::controller_mysql]",
  122 + "recipe[cmon::controller_mysql]",
  123 + "recipe[cmon::controller_rrdtool]",
96 124 "recipe[cmon::controller]"
97 125 ]
98 126
99   -Installs the ClusterControl Controller and a MySQL server to store our monitoring data.
  127 +Installs the ClusterControl Controller, standard MySQL server to store cluster data and statistics and rrdtool to create graphs.
100 128 Instead of our MySQL recipe you could choose to try any other available MySQL recipe instead.
101 129
102   - Agent Role: cc_agent
  130 + Web App Role: cc_webapp
103 131 run_list [
104   - "recipe[cmon::agent_packages]",
105   - "recipe[cmon::agent]"
  132 + "recipe[cmon::webserver]",
  133 + "recipe[cmon::webapp]"
106 134 ]
107 135
108   -Installs the ClusterControl agent. It requires a MySQL root password in order to setup grants correctly on the monitored MySQL server.
  136 +Installs the ClusterControl web application and apache on the Controller node.
109 137
110   - Web App Role: cc_webapp
  138 + Agent Role: cc_agent
111 139 run_list [
112   - "recipe[cmon::webserver]",
113   - "recipe[cmon::webapp]"
  140 + "recipe[cmon::agent_packages]",
  141 + "recipe[cmon::agent]"
114 142 ]
115 143
116   -The ClusterControl web application and a webserver are usually installed on the controller node.
  144 +Installs the ClusterControl agent. It requires the MySQL root password in order to setup grants correctly on the monitored MySQL server.
117 145
118 146
119 147 Change History
120 148 ===============
121 149
122   -* v0.4 - Fixes for Chef 0.10.10 and working with galera cookbook
  150 +* v0.5 - Cleanup/fixes and tested with Chef 10.16.2, only tested with our galera cookbook
  151 +* v0.4 - Fixes for Chef 0.10.10 and working with our galera cookbook
123 152 * v0.3 - Code cleanup, better use of roles, data bags and more tests using Chef-Server 0.10.8.
124 153 * v0.2 - Bug fixes and making sure it worked on Chef-Solo.
125   -* v0.1 - Initial recipes based upon cmon v1.1.25.
  154 +* v0.1 - Initial recipes based upon cmon v1.1.25.
126 155
127 156 License and Author
128 157 ==================
151 cmon/attributes/default.rb
... ... @@ -1,38 +1,6 @@
1   -default['install_dir_cmon'] = "/usr/local"
2   -default['install_config_path'] = "/etc"
3   -
4   -default['cluster_id'] = 1
5   -default['cluster_name'] = "default_cluster_1"
6   -default['cluster_type'] = "replication"
7   -
8   -default['controller']['mysql_user'] = "cmon"
9   -default['controller']['mysql_hostname'] = "from-databag"
10   -default['controller']['mysql_password'] = "cmon"
11   -default['controller']['mysql_port'] = 3306
12   -default['controller']['ndb_connectstring'] = "from-databag"
13   -default['controller']['ssh_key'] = "/root/.ssh/id_rsa"
14   -
15   -default['cmon_password'] = "cmon"
16   -
17   -default['mode']['agent'] = "agent"
18   -default['mode']['controller'] = "controller"
19   -default['mode']['dual'] = "dual"
20   -
21   -default['agent']['mysql_user'] = "cmon"
22   -default['agent']['mysql_hostname'] = "127.0.0.1"
23   -default['agent']['mysql_password'] = "cmon"
24   -default['agent']['mysql_port'] = 3306
25   -default['agent']['hostname'] = node['ipaddress']
26   -
27 1 case node['platform']
28 2 when 'centos', 'redhat', 'fedora', 'suse', 'scientific', 'amazon'
29 3
30   - default['mysql']['install_dir'] = "/"
31   - default['mysql']['basedir'] = "/usr"
32   - default['mysql']['bindir'] = default['mysql']['basedir'] +"/bin"
33   -
34   - default['mysql']['ndb_bindir'] = default['mysql']['basedir'] +"/bin"
35   -
36 4 default['agent']['packages'] = %w(psmisc libaio sysstat)
37 5 default['controller']['packages'] = %w(rrdtool mysql mysql-server nc wget)
38 6
@@ -53,12 +21,6 @@
53 21
54 22 else
55 23
56   - default['mysql']['installdir'] = "/"
57   - default['mysql']['basedir'] = "/usr"
58   - default['mysql']['bindir'] = default['mysql']['basedir'] +"/bin"
59   -
60   - default['mysql']['ndb_bindir'] = default['mysql']['basedir'] +"/bin"
61   -
62 24 default['agent']['packages'] = %w(psmisc libaio1 sysstat)
63 25 default['controller']['packages'] = %w(rrdtool mysql-server nc wget)
64 26
@@ -79,50 +41,81 @@
79 41
80 42 end
81 43
  44 +default['install_dir_cmon'] = "/usr/local"
  45 +default['install_config_path'] = "/etc"
  46 +
  47 +default['cluster_id'] = 1
  48 +default['cluster_name'] = "default_cluster_1"
  49 +default['cluster_type'] = "replication"
  50 +
  51 +default['controller']['mysql_user'] = "cmon"
  52 +default['controller']['mysql_hostname'] = "from-databag"
  53 +default['controller']['mysql_password'] = "cmon"
  54 +default['controller']['mysql_port'] = 3306
  55 +default['controller']['ndb_connectstring'] = "from-databag"
  56 +default['controller']['ssh_key'] = "/root/.ssh/id_rsa"
  57 +
  58 +default['cmon_password'] = "cmon"
  59 +
  60 +default['mode']['agent'] = "agent"
  61 +default['mode']['controller'] = "controller"
  62 +default['mode']['dual'] = "dual"
  63 +
  64 +default['agent']['mysql_user'] = "cmon"
  65 +default['agent']['mysql_hostname'] = "127.0.0.1"
  66 +default['agent']['mysql_password'] = "cmon"
  67 +default['agent']['mysql_port'] = 3306
  68 +default['agent']['hostname'] = node['ipaddress']
  69 +
  70 +default['cmon_mysql']['install_dir'] = "/"
  71 +default['cmon_mysql']['basedir'] = "/usr"
  72 +default['cmon_mysql']['bindir'] = "#{cmon_mysql['basedir']}/bin"
  73 +default['cmon_mysql']['ndb_bindir'] = "#{cmon_mysql['basedir']}/bin"
  74 +
82 75 default['xtra']['sleep'] = 60
83   -default['mysql']['root_password'] = "password"
84   -default['mysql']['mysql_bin'] = default['mysql']['bindir'] + "/mysql"
85   -
86   -default['mysql']['datadir'] = "/var/lib/mysql"
87   -default['mysql']['rundir'] = "/var/run/mysqld"
88   -default['mysql']['pid_file'] = default['mysql']['datadir'] + "/mysqld.pid"
89   -default['mysql']['socket'] = default['mysql']['rundir'] + "/mysqld.sock"
90   -
91   -default['mysql']['port'] = 3306
92   -default['mysql']['tmpdir'] = "/tmp"
93   -
94   -default['mysql']['innodb']['buffer_pool_size'] = "256M"
95   -default['mysql']['innodb']['flush_log_at_trx_commit'] = 2
96   -default['mysql']['innodb']['file_per_table'] = 1
97   -default['mysql']['innodb']['doublewrite'] = 0
98   -default['mysql']['innodb']['log_file_size'] = "512M"
99   -default['mysql']['innodb']['log_files_in_group'] = 2
100   -default['mysql']['innodb']['buffer_pool_instances'] = 1
101   -default['mysql']['innodb']['max_dirty_pages_pct'] = 75
102   -default['mysql']['innodb']['thread_concurrency'] = 0
103   -default['mysql']['innodb']['concurrency_tickets'] = 5000
104   -default['mysql']['innodb']['thread_sleep_delay'] = 10000
105   -default['mysql']['innodb']['lock_wait_timeout'] = 50
106   -default['mysql']['innodb']['io_capacity'] = 200
107   -default['mysql']['innodb']['read_io_threads'] = 4
108   -default['mysql']['innodb']['write_io_threads'] = 4
109   -
110   -default['mysql']['innodb']['file_format'] = "barracuda"
111   -default['mysql']['innodb']['flush_method'] = "O_DIRECT"
  76 +default['cmon_mysql']['root_password'] = "password"
  77 +default['cmon_mysql']['mysql_bin'] = "#{cmon_mysql['bindir']}/mysql"
  78 +
  79 +default['cmon_mysql']['datadir'] = "/var/lib/mysql"
  80 +default['cmon_mysql']['rundir'] = "/var/run/mysqld"
  81 +default['cmon_mysql']['pid_file'] = "#{cmon_mysql['datadir']}/mysqld.pid"
  82 +default['cmon_mysql']['socket'] = "#{cmon_mysql['rundir']}/mysqld.sock"
  83 +
  84 +default['cmon_mysql']['port'] = 3306
  85 +default['cmon_mysql']['tmpdir'] = "/tmp"
  86 +
  87 +default['cmon_mysql']['innodb']['buffer_pool_size'] = "256M"
  88 +default['cmon_mysql']['innodb']['flush_log_at_trx_commit'] = 2
  89 +default['cmon_mysql']['innodb']['file_per_table'] = 1
  90 +default['cmon_mysql']['innodb']['doublewrite'] = 0
  91 +default['cmon_mysql']['innodb']['log_file_size'] = "512M"
  92 +default['cmon_mysql']['innodb']['log_files_in_group'] = 2
  93 +default['cmon_mysql']['innodb']['buffer_pool_instances'] = 1
  94 +default['cmon_mysql']['innodb']['max_dirty_pages_pct'] = 75
  95 +default['cmon_mysql']['innodb']['thread_concurrency'] = 0
  96 +default['cmon_mysql']['innodb']['concurrency_tickets'] = 5000
  97 +default['cmon_mysql']['innodb']['thread_sleep_delay'] = 10000
  98 +default['cmon_mysql']['innodb']['lock_wait_timeout'] = 50
  99 +default['cmon_mysql']['innodb']['io_capacity'] = 200
  100 +default['cmon_mysql']['innodb']['read_io_threads'] = 4
  101 +default['cmon_mysql']['innodb']['write_io_threads'] = 4
  102 +
  103 +default['cmon_mysql']['innodb']['file_format'] = "barracuda"
  104 +default['cmon_mysql']['innodb']['flush_method'] = "O_DIRECT"
112 105
113 106 #OTHER THINGS, BUFFERS ETC
114   -default['mysql']['misc']['max_connections'] = 200
115   -default['mysql']['misc']['thread_cache_size'] = 64
116   -default['mysql']['misc']['table_open_cache'] = 1024
  107 +default['cmon_mysql']['misc']['max_connections'] = 200
  108 +default['cmon_mysql']['misc']['thread_cache_size'] = 64
  109 +default['cmon_mysql']['misc']['table_open_cache'] = 1024
117 110
118   -default['mysql']['repl_user'] = "repl"
119   -default['mysql']['repl_password'] = "repl"
  111 +default['cmon_mysql']['repl_user'] = "repl"
  112 +default['cmon_mysql']['repl_password'] = "repl"
120 113
121   -default['sql']['cmon_schema'] = default['install_dir_cmon'] + "/cmon/sql/cmon_db.sql"
122   -default['sql']['cmon_data'] = default['install_dir_cmon'] + "/cmon/sql/cmon_data.sql"
123   -default['sql']['controller_grants'] = default['install_dir_cmon'] + "/cmon/sql/cmon_controller_grants.sql"
124   -default['sql']['controller_agent_grants'] = default['install_dir_cmon'] + "/cmon/sql/cmon_controller_agent_grants.sql"
125   -default['sql']['agent_grants'] = default['install_dir_cmon'] + "/cmon/sql/cmon_agent_grants.sql"
  114 +default['sql']['cmon_schema'] = "#{install_dir_cmon}/cmon/sql/cmon_db.sql"
  115 +default['sql']['cmon_data'] = "#{install_dir_cmon}/cmon/sql/cmon_data.sql"
  116 +default['sql']['controller_grants'] = "#{install_dir_cmon}/cmon/sql/cmon_controller_grants.sql"
  117 +default['sql']['controller_agent_grants'] = "#{install_dir_cmon}/cmon/sql/cmon_controller_agent_grants.sql"
  118 +default['sql']['agent_grants'] = "#{install_dir_cmon}/cmon/sql/cmon_agent_grants.sql"
126 119
127 120 default['rrd']['rrdtool'] = "/usr/bin/rrdtool"
128 121 default['rrd']['datadir'] = "/var/lib/cmon"
@@ -138,9 +131,9 @@
138 131 default['misc']['db_stats_collection_interval'] = 30
139 132 default['misc']['host_stats_collection_interval'] = 30
140 133
141   -default['mysql']['script_dir'] = "/usr/bin"
  134 +default['cmon_mysql']['script_dir'] = "/usr/bin"
142 135
143 136 #default['cmon']['misc']['cmon_core_dir'] = ""
144 137 default['misc']['ndb_binary'] = ""
145 138 default['misc']['BACKUPDIR'] = ""
146   -default['misc']['IDENTITY'] = default['controller']['ssh_key']
  139 +default['misc']['IDENTITY'] = "#{controller['ssh_key']}"
17 cmon/metadata.rb
... ... @@ -1,16 +1,15 @@
1 1 maintainer "Severalnines AB"
2 2 maintainer_email "support@severalnines.com"
3 3 license "Apache 2.0"
4   -description "Installs and configures cmon controller and agent"
  4 +description "Installs and configures ClusterControl controller and agents"
5 5 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6   -version "0.1"
7   -recipe "cmon", "Includes the cmon agent"
8   -recipe "cmon::agent", "Installs cmon agent"
9   -recipe "cmon::controller", "Installs cmon controller"
10   -recipe "cmon::web", "Installs cmon web application"
11   -recipe "cmon::agent_packages", "Installs cmon agent required packages (psmisc libaio)"
12   -recipe "cmon::controller_packages", "Installs cmon controller requried packages (rrdtool mysql mysql-server)"
13   -recipe "cmon::web_packages", "Installs cmon web application required packages (apache2 php5-mysql php5-gd libapache2-mod-php5)"
  6 +version "0.5"
  7 +recipe "cmon::agent", "Installs the ClusterControl agent"
  8 +recipe "cmon::controller", "Installs the ClusterControl controller"
  9 +recipe "cmon::controller_mysql", "Installs ClusterControl MySQL server"
  10 +recipe "cmon::controller_rrdtool", "Installs rrdtool to generate grapsh on the controller node"
  11 +recipe "cmon::webapp", "Installs the ClusterControl web application"
  12 +recipe "cmon::webserver", "Installs Apache2"
14 13
15 14 %w{ debian ubuntu centos fedora redhat }.each do |os|
16 15 supports os
11 cmon/recipes/agent.rb
@@ -20,8 +20,8 @@
20 20 install_flag = "/root/.s9s_agent_installed"
21 21
22 22 cmon_config = data_bag_item('s9s_controller', 'config')
23   -node['controller']['mysql_hostname'] = cmon_config['controller_host_ipaddress']
24   -node['cluster_type'] = cmon_config['type']
  23 +node.set['controller']['mysql_hostname'] = cmon_config['controller_host_ipaddress']
  24 +node.set['cluster_type'] = cmon_config['type']
25 25
26 26 cmon_tarball = cmon_config['cmon_tarball_' + node['kernel']['machine']]
27 27 # strip .tar.gz
@@ -67,7 +67,7 @@
67 67 end
68 68
69 69 execute "agent-install-privileges" do
70   - command "#{node['mysql']['mysql_bin']} -uroot -h127.0.0.1 -p#{node['mysql']['root_password']} < #{node['sql']['agent_grants']}"
  70 + command "#{node['cmon_mysql']['mysql_bin']} -uroot -h127.0.0.1 -p#{node['cmon_mysql']['root_password']} < #{node['sql']['agent_grants']}"
71 71 action :nothing
72 72 not_if { FileTest.exists?("#{install_flag}") }
73 73 end
@@ -95,7 +95,7 @@
95 95
96 96 service "cmon" do
97 97 action :nothing
98   -end
  98 +end
99 99
100 100 template "cmon.agent.cnf" do
101 101 path "#{node['install_config_path']}/cmon.cnf"
@@ -118,9 +118,10 @@
118 118 service "cmon" do
119 119 supports :restart => true, :start => true, :stop => true, :status => true
120 120 action [:enable, :start]
121   -end
  121 +end
122 122
123 123 execute "s9s-agent-installed" do
124 124 command "touch #{install_flag}"
125 125 action :run
  126 + not_if { FileTest.exists?("#{install_flag}") }
126 127 end
10 cmon/recipes/controller.rb
@@ -20,7 +20,6 @@
20 20 install_flag = "/root/.s9s_controller_installed"
21 21
22 22 cmon_config = data_bag_item('s9s_controller', 'config')
23   -#node['controller']['mysql_host name'] = node['ipaddress']
24 23 node.set['controller']['mysql_hostname'] = cmon_config['controller_host_ipaddress']
25 24 node.set['mode']['controller'] = cmon_config['mode']
26 25 node.set['cluster_type'] = cmon_config['type']
@@ -68,19 +67,19 @@
68 67 end
69 68
70 69 execute "controller-create-db-schema" do
71   - command "#{node['mysql']['mysql_bin']} -uroot -p#{node['mysql']['root_password']} < #{node['sql']['cmon_schema']}"
  70 + command "#{node['cmon_mysql']['mysql_bin']} -uroot -p#{node['cmon_mysql']['root_password']} < #{node['sql']['cmon_schema']}"
72 71 action :run
73 72 not_if { FileTest.exists?("#{install_flag}") }
74 73 end
75 74
76 75 execute "controller-import-tables" do
77   - command "#{node['mysql']['mysql_bin']} -uroot -p#{node['mysql']['root_password']} < #{node['sql']['cmon_data']}"
  76 + command "#{node['cmon_mysql']['mysql_bin']} -uroot -p#{node['cmon_mysql']['root_password']} < #{node['sql']['cmon_data']}"
78 77 action :run
79 78 not_if { FileTest.exists?("#{install_flag}") }
80 79 end
81 80
82 81 execute "controller-install-privileges" do
83   - command "#{node['mysql']['mysql_bin']} -uroot -p#{node['mysql']['root_password']} < #{node['sql']['controller_grants']}"
  82 + command "#{node['cmon_mysql']['mysql_bin']} -uroot -p#{node['cmon_mysql']['root_password']} < #{node['sql']['controller_grants']}"
84 83 action :nothing
85 84 not_if { FileTest.exists?("#{install_flag}") }
86 85 end
@@ -116,7 +115,7 @@
116 115 end
117 116
118 117 execute "controller-grant-agents" do
119   - command "#{node['mysql']['mysql_bin']} -uroot -p#{node['mysql']['root_password']} < #{node['sql']['controller_agent_grants']}"
  118 + command "#{node['cmon_mysql']['mysql_bin']} -uroot -p#{node['cmon_mysql']['root_password']} < #{node['sql']['controller_agent_grants']}"
120 119 action :run
121 120 not_if { FileTest.exists?("#{install_flag}") }
122 121 end
@@ -188,4 +187,5 @@
188 187 execute "s9s-controller-installed" do
189 188 command "touch #{install_flag}"
190 189 action :run
  190 + not_if { FileTest.exists?("#{install_flag}") }
191 191 end
20 cmon/recipes/controller_mysql.rb
@@ -43,15 +43,15 @@
43 43 end
44 44
45 45 # MySQL installed with no root password!
46   -# Let's secure it. Get root password from ['mysql']['root_password']
  46 +# Let's secure it. Get root password from ['cmon_mysql']['root_password']
47 47 # todo: maybe erb or tmp file
48 48 bash "secure-mysql" do
49 49 user "root"
50 50 code <<-EOH
51   - #{node['mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "UPDATE mysql.user SET Password=PASSWORD('#{node['mysql']['root_password']}') WHERE User='root'"
52   - #{node['mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "DELETE FROM mysql.user WHERE User='';DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')"
53   - #{node['mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "DROP DATABASE test; DELETE FROM mysql.db WHERE DB='test' OR Db='test\\_%;"
54   - #{node['mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "FLUSH PRIVILEGES"
  51 + #{node['cmon_mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "UPDATE mysql.user SET Password=PASSWORD('#{node['cmon_mysql']['root_password']}') WHERE User='root'"
  52 + #{node['cmon_mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "DELETE FROM mysql.user WHERE User='';DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')"
  53 + #{node['cmon_mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "DROP DATABASE test; DELETE FROM mysql.db WHERE DB='test' OR Db='test\\_%;"
  54 + #{node['cmon_mysql']['mysql_bin']} -uroot -h127.0.0.1 -e "FLUSH PRIVILEGES"
55 55 EOH
56 56 not_if { FileTest.exists?("#{install_flag}") }
57 57 end
@@ -84,7 +84,7 @@
84 84 end
85 85
86 86 execute "purge-innodb-logfiles" do
87   - command "rm #{node['mysql']['datadir']}/ib_logfile*"
  87 + command "rm #{node['cmon_mysql']['datadir']}/ib_logfile*"
88 88 action :run
89 89 not_if { FileTest.exists?("#{install_flag}") }
90 90 end
@@ -96,7 +96,15 @@
96 96 subscribes :restart, resources(:template => 'my.cnf')
97 97 end
98 98
  99 +service "reload-mysql-cnf" do
  100 + service_name node['mysql']['service_name']
  101 + supports :stop => true, :start => true, :restart => true, :reload => true
  102 + action :restart
  103 + not_if { FileTest.exists?("#{install_flag}") }
  104 +end
  105 +
99 106 execute "s9s-controller-mysql-installed" do
100 107 command "touch #{install_flag}"
101 108 action :run
  109 + not_if { FileTest.exists?("#{install_flag}") }
102 110 end
1  cmon/recipes/webapp.rb
@@ -23,7 +23,6 @@
23 23 cmon_package = cmon_tarball[0..-8]
24 24 cmon_source = cmon_config['cmon_source']
25 25
26   -Chef::Log.info "Downloading #{cmon_tarball}"
27 26 remote_file "#{Chef::Config[:file_cache_path]}/#{cmon_tarball}" do
28 27 source "#{cmon_source}/#{cmon_tarball}"
29 28 action :create_if_missing
1  cmon/recipes/webserver.rb
@@ -50,4 +50,5 @@
50 50 execute "s9s-webserver-installed" do
51 51 command "touch #{install_flag}"
52 52 action :run
  53 + not_if { FileTest.exists?("#{install_flag}") }
53 54 end
2  cmon/templates/default/cmon.agent.cnf.erb
@@ -29,7 +29,7 @@ os=debian
29 29 skip_name_resolve=1
30 30
31 31 ## CMON DB config - mysql_password is for the 'cmon' user
32   -#mysql_basedir=<%= node['mysql']['basedir'] %>
  32 +#mysql_basedir=<%= node['cmon_mysql']['basedir'] %>
33 33 mysql_port=<%= node['controller']['mysql_port'] %>
34 34 mysql_hostname=<%= node['controller']['mysql_hostname'] %>
35 35 mysql_password=<%= node['controller']['mysql_password'] %>
4 cmon/templates/default/cmon.controller.cnf.erb
@@ -29,7 +29,7 @@ os=debian
29 29 skip_name_resolve=1
30 30
31 31 ## CMON DB config - mysql_password is for the 'cmon' user
32   -#mysql_basedir=<%= node['mysql']['basedir'] %>
  32 +#mysql_basedir=<%= node['cmon_mysql']['basedir'] %>
33 33 mysql_port=<%= node['controller']['mysql_port'] %>
34 34 #mysql_hostname=<%= node['controller']['mysql_hostname'] %>
35 35 mysql_hostname=127.0.0.1
@@ -77,7 +77,7 @@ datanode_addresses=
77 77 mgmnode_addresses=
78 78
79 79 ###### LEGACY RRD SECTION - graphs ######
80   -mysql_bindir=<%= node['mysql']['bindir'] %>
  80 +mysql_bindir=<%= node['cmon_mysql']['bindir'] %>
81 81 imagedir=<%= node['rrd']['imagedir'] %>
82 82 rrdtool=<%= node['rrd']['rrdtool'] %>
83 83 rrd_datadir=<%= node['rrd']['datadir'] %>
12 cmon/templates/default/cmon.controller.grants.sql.erb
@@ -19,13 +19,13 @@ INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'STAGI
19 19 INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'PURGE','7');
20 20 INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'LOG_COLLECTION','30');
21 21 INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'MYSQL_PORT','<%= node['controller']['mysql_port'] %>');
22   -INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'BINDIR','<%= node['mysql']['bindir'] %>');
23   -INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'ROOT_PASSWORD','<%= node['mysql']['root_password'] %>');
24   -INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'REPL_PASSWORD','<%= node['mysql']['repl_password'] %>');
25   -INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'REPL_USER','<%= node['mysql']['repl_user'] %>');
  22 +INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'BINDIR','<%= node['cmon_mysql']['bindir'] %>');
  23 +INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'ROOT_PASSWORD','<%= node['cmon_mysql']['root_password'] %>');
  24 +INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'REPL_PASSWORD','<%= node['cmon_mysql']['repl_password'] %>');
  25 +INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'REPL_USER','<%= node['cmon_mysql']['repl_user'] %>');
26 26 INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'NDB_CONNECTSTRING','<%= node['controller']['ndb_connectstring'] %>');
27   -INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'NDB_BINARY','<%= node['mysql']['ndb_bin_dir'] %>');
28   -INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'SCRIPTDIR','<%= node['mysql']['script_dir'] %>');
  27 +INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'NDB_BINARY','<%= node['cmon_mysql']['ndb_bin_dir'] %>');
  28 +INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'SCRIPTDIR','<%= node['cmon_mysql']['script_dir'] %>');
29 29 INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'PRE_INSTALLED_IMAGE',0);
30 30 INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'INSTALL_METHOD','TGZ');
31 31 INSERT IGNORE INTO cmon.cmon_configuration (cid, param, value) VALUES (1, 'OS_USER_HOME','<%= ENV['HOME'] %>');
2  cmon/templates/default/cmon_rrd.cnf.erb
@@ -2,7 +2,7 @@
2 2 mysql_port=3306
3 3 mysql_hostname=127.0.0.1
4 4 mysql_password=<%= node['controller']['mysql_password'] %>
5   -mysql_bindir=<%= node['mysql']['bindir'] %>
  5 +mysql_bindir=<%= node['cmon_mysql']['bindir'] %>
6 6 imagedir=<%= node['rrd']['image_dir'] %>
7 7 rrdtool=<%= node['rrd']['rrdtool'] %>
8 8 rrd_datadir=<%= node['rrd']['datadir'] %>
60 cmon/templates/default/my.cmon.cnf.erb
@@ -8,34 +8,34 @@
8 8
9 9 [MYSQLD]
10 10 user=mysql
11   -basedir = <%= node['mysql']['basedir'] %>
12   -datadir = <%= node['mysql']['datadir'] %>
13   -pid_file = <%= node['mysql']['pid_file'] %>
14   -socket = <%= node['mysql']['socket'] %>
15   -port = <%= node['mysql']['port'] %>
  11 +basedir = <%= node['cmon_mysql']['basedir'] %>
  12 +datadir = <%= node['cmon_mysql']['datadir'] %>
  13 +pid_file = <%= node['cmon_mysql']['pid_file'] %>
  14 +socket = <%= node['cmon_mysql']['socket'] %>
  15 +port = <%= node['cmon_mysql']['port'] %>
16 16 log_error = error.log
17 17 #log
18 18 #log_slow_queries
19 19
20 20 ### INNODB
21   -innodb_buffer_pool_size = <%= node['mysql']['innodb']['buffer_pool_size'] %>
  21 +innodb_buffer_pool_size = <%= node['cmon_mysql']['innodb']['buffer_pool_size'] %>
22 22 # buffer pool size > 1GB if you want multiple instances
23   -innodb_buffer_pool_instances = <%= node['mysql']['innodb']['buffer_pool_instances'] %>
24   -innodb_flush_log_at_trx_commit = <%= node['mysql']['innodb']['flush_log_at_trx_commit'] %>
25   -innodb_file_per_table = <%= node['mysql']['innodb']['file_per_table'] %>
26   -innodb_doublewrite= <%= node['mysql']['innodb']['doublewrite'] %>
27   -innodb_log_file_size = <%= node['mysql']['innodb']['log_file_size'] %>
28   -innodb_log_files_in_group = <%= node['mysql']['innodb']['log_files_in_group'] %>
29   -innodb_max_dirty_pages_pct = <%= node['mysql']['innodb']['max_dirty_pages_pct'] %>
30   -innodb_io_capacity = <%= node['mysql']['innodb']['io_capacity'] %>
31   -innodb_thread_concurrency = <%= node['mysql']['innodb']['thread_concurrency'] %>
32   -innodb_concurrency_tickets = <%= node['mysql']['innodb']['concurrency_tickets'] %>
33   -innodb_thread_sleep_delay = <%= node['mysql']['innodb']['thread_sleep_delay'] %>
34   -innodb_lock_wait_timeout = <%= node['mysql']['innodb']['lock_wait_timeout'] %>
35   -innodb_read_io_threads = <%= node['mysql']['innodb']['read_io_threads'] %>
36   -innodb_write_io_threads = <%= node['mysql']['innodb']['write_io_threads'] %>
37   -innodb_file_format = <%= node['mysql']['innodb']['file_format'] %>
38   -innodb_flush_method = <%= node['mysql']['innodb']['flush_method'] %>
  23 +innodb_buffer_pool_instances = <%= node['cmon_mysql']['innodb']['buffer_pool_instances'] %>
  24 +innodb_flush_log_at_trx_commit = <%= node['cmon_mysql']['innodb']['flush_log_at_trx_commit'] %>
  25 +innodb_file_per_table = <%= node['cmon_mysql']['innodb']['file_per_table'] %>
  26 +innodb_doublewrite= <%= node['cmon_mysql']['innodb']['doublewrite'] %>
  27 +innodb_log_file_size = <%= node['cmon_mysql']['innodb']['log_file_size'] %>
  28 +innodb_log_files_in_group = <%= node['cmon_mysql']['innodb']['log_files_in_group'] %>
  29 +innodb_max_dirty_pages_pct = <%= node['cmon_mysql']['innodb']['max_dirty_pages_pct'] %>
  30 +innodb_io_capacity = <%= node['cmon_mysql']['innodb']['io_capacity'] %>
  31 +innodb_thread_concurrency = <%= node['cmon_mysql']['innodb']['thread_concurrency'] %>
  32 +innodb_concurrency_tickets = <%= node['cmon_mysql']['innodb']['concurrency_tickets'] %>
  33 +innodb_thread_sleep_delay = <%= node['cmon_mysql']['innodb']['thread_sleep_delay'] %>
  34 +innodb_lock_wait_timeout = <%= node['cmon_mysql']['innodb']['lock_wait_timeout'] %>
  35 +innodb_read_io_threads = <%= node['cmon_mysql']['innodb']['read_io_threads'] %>
  36 +innodb_write_io_threads = <%= node['cmon_mysql']['innodb']['write_io_threads'] %>
  37 +innodb_file_format = <%= node['cmon_mysql']['innodb']['file_format'] %>
  38 +innodb_flush_method = <%= node['cmon_mysql']['innodb']['flush_method'] %>
39 39
40 40 #OTHER THINGS, BUFFERS ETC
41 41 key_buffer_size = 8M
@@ -50,21 +50,21 @@ memlock = 0
50 50 sysdate_is_now = 1
51 51 query_cache_type = 1
52 52 query_cache_size = 32M
53   -max_connections = <%= node['mysql']['misc']['max_connections'] %>
54   -thread_cache_size = <%= node['mysql']['misc']['thread_cache_size'] %>
55   -table_open_cache = <%= node['mysql']['misc']['table_open_cache'] %>
  53 +max_connections = <%= node['cmon_mysql']['misc']['max_connections'] %>
  54 +thread_cache_size = <%= node['cmon_mysql']['misc']['thread_cache_size'] %>
  55 +table_open_cache = <%= node['cmon_mysql']['misc']['table_open_cache'] %>
56 56 lower_case_table_names = 0
57 57
58 58 [MYSQL]
59   -socket=<%= node['mysql']['socket'] %>
  59 +socket=<%= node['cmon_mysql']['socket'] %>
60 60
61 61 [client]
62 62 port = 3306
63   -socket=<%= node['mysql']['socket'] %>
  63 +socket=<%= node['cmon_mysql']['socket'] %>
64 64
65 65 [MYSQLD_SAFE]
66   -basedir = <%= node['mysql']['basedir'] %>
67   -datadir = <%= node['mysql']['datadir'] %>
68   -pid_file = <%= node['mysql']['pid_file'] %>
  66 +basedir = <%= node['cmon_mysql']['basedir'] %>
  67 +datadir = <%= node['cmon_mysql']['datadir'] %>
  68 +pid_file = <%= node['cmon_mysql']['pid_file'] %>
69 69 log_error = error.log
70 70 syslog
2  cmon/templates/default/mysql_secure_installation.sql.erb
... ... @@ -1,5 +1,5 @@
1 1 SET SQL_LOG_BIN=0;
2   -UPDATE mysql.user SET Password=PASSWORD('<%= node['mysql']['root_password'] %>') WHERE User='root';
  2 +UPDATE mysql.user SET Password=PASSWORD('<%= node['cmon_mysql']['root_password'] %>') WHERE User='root';
3 3 DELETE FROM mysql.user WHERE User='';
4 4 DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
5 5 DROP DATABASE test;
97 galera/README.md
Source Rendered
... ... @@ -1,15 +1,20 @@
1 1 Description
2 2 ===========
3   -Installs a Codership's MySQL Galera cluster node.
  3 +Installs Codership's MySQL Galera cluster (http://http://www.codership.com/).
  4 +Galera Cluster provides synchronous multi-master replication for MySQL (replication plugin).
4 5
5   -This cookbook should be used initially for development/tests and not in production.
  6 +* No master failover scripting (automatic failover and recovery)
  7 +* No slave lag
  8 +* Read and write to any node
  9 +* Write scalabilty
  10 +* WAN Clustering
6 11
7   -It currently does not handle a full cluster restart properly by itself, i.e., it does
8   -not select a node that has the most recent committed transactions as the donor.
9   -You might end up loosing data if the wrong node becomes the donor node.
  12 +This cookbook enables you to install a Galera cluster from scratch. At minimum you would probaly only need to change a few attributes like
10 13
11   -You can deploy ClusterControl which is able to select a correct node to use when doing a
12   -complete cluster restart.
  14 +* ['mysql']['root_password'] = "password"
  15 +* ['mysql']['innodb']['buffer_pool_size'] = "256M"
  16 +
  17 +You can also deploy our ClusterControl coookbook with the Galera Cluster which provide additional control and monitoring features.
13 18
14 19 Howto: Chef, MySQL Galera and ClusterControl
15 20 http://support.severalnines.com/entries/21453521-opscode-s-chef-mysql-galera-and-clustercontrol
@@ -24,28 +29,48 @@ Platform
24 29
25 30 Tested on:
26 31
27   -* Ubuntu 11.10/12.04 w/ Chef (Solo) 0.10.8/0.10.10
  32 +* Ubuntu 12.04 w/ Chef-server 10.16.2 and Galera Cluster v2.2
  33 +* Ubuntu 11.10/12.04 w/ Chef-solo 0.10.8/0.10.10 and Galera Cluster v2.1
28 34
29 35 Attributes
30 36 ==========
31 37
32   -* ['galera']['install_dir'] = "/usr/local"
33   -
34   -* ['mysql']['root_password'] = "password"
35   -* ['mysql']['datadir'] = "/var/lib/mysql"
36   -* ['mysql']['innodb']['buffer_pool_size'] = "128M"
37   -* ['mysql']['innodb']['log_file_size'] = "256M"
38   -
39   -* ['wsrep']['cluster_name'] = "my_galera_cluster"
40   -* ['wsrep']['slave_threads'] = 1
41   -* ['wsrep']['certify_nonPK'] = 1
42   -* ['wsrep']['max_ws_rows'] = 131072
43   -* ['wsrep']['max_ws_size'] = 1073741824
44   -* ['wsrep']['retry_autocommit'] = 1
45   -* ['wsrep']['auto_increment_control'] = 1
46   -* ['wsrep']['user'] = "wsrep_sst"
47   -* ['wsrep']['password'] = "wsrep"
48   -* ['wsrep']['sst_method'] = "mysqldump"
  38 +* node['galera']['install_dir'] = "/usr/local"
  39 +* node['mysql']['root_password'] = "password"
  40 +
  41 +* node['mysql']['basedir'] = "/usr/local"
  42 +* node['mysql']['datadir'] = "/var/lib/mysql"
  43 +* node['mysql']['rundir'] = "/var/run/mysqld"
  44 +* node['mysql']['pid_file'] = /var/lib/mysql/mysqld.pid"
  45 +* node['mysql']['socket'] = /var/run/mysqld/mysqld.sock"
  46 +* node['mysql']['port'] = 3306
  47 +* node['mysql']['tmpdir'] = "/tmp"
  48 +
  49 +* node['mysql']['innodb']['buffer_pool_size'] = "256M"
  50 +* node['mysql']['innodb']['flush_log_at_trx_commit'] = 2
  51 +* node['mysql']['innodb']['file_per_table'] = 1
  52 +* node['mysql']['innodb']['doublewrite'] = 0
  53 +* node['mysql']['innodb']['log_file_size'] = "512M"
  54 +* node['mysql']['innodb']['log_files_in_group'] = 2
  55 +* node['mysql']['innodb']['buffer_pool_instances'] = 1
  56 +* node['mysql']['innodb']['max_dirty_pages_pct'] = 75
  57 +* node['mysql']['innodb']['thread_concurrency'] = 0
  58 +* node['mysql']['innodb']['concurrency_tickets'] = 5000
  59 +* node['mysql']['innodb']['thread_sleep_delay'] = 10000
  60 +* node['mysql']['innodb']['lock_wait_timeout'] = 50
  61 +* node['mysql']['innodb']['io_capacity'] = 200
  62 +* node['mysql']['innodb']['read_io_threads'] = 4
  63 +* node['mysql']['innodb']['write_io_threads'] = 4
  64 +
  65 +* node['mysql']['innodb']['file_format'] = "barracuda"
  66 +* node['mysql']['innodb']['flush_method'] = "O_DIRECT"
  67 +
  68 +* node['wsrep']['cluster_name'] = "my_galera_cluster"
  69 +* node['wsrep']['slave_threads'] = 1
  70 +* node['wsrep']['certify_nonPK'] = 1
  71 +* node['wsrep']['max_ws_rows'] = 131072
  72 +* node['wsrep']['max_ws_size'] = 1073741824
  73 +* node['wsrep']['retry_autocommit'] = 1
49 74
50 75 and more in attributes/default.rb
51 76
@@ -72,30 +97,34 @@ s9s_galera / config.json
72 97 "mysql_wsrep_tarball_x86_64": "mysql-5.5.23_wsrep_23.6-linux-x86_64.tar.gz",
73 98 "mysql_wsrep_tarball_i686": "mysql-5.5.23_wsrep_23.6-linux-i686.tar.gz",
74 99 "galera_package_i386": {
75   - "deb": "galera-23.2.1-i386.deb",
76   - "rpm": "galera-23.2.1-1.rhel5.i386.rpm"},
  100 + "deb": "galera-23.2.2-i386.deb",
  101 + "rpm": "galera-23.2.2-1.rhel5.i386.rpm"},
77 102 "galera_package_x86_64": {
78   - "deb": "galera-23.2.1-amd64.deb",
79   - "rpm": "galera-23.2.1-1.rhel5.x86_64.rpm"
  103 + "deb": "galera-23.2.2-amd64.deb",
  104 + "rpm": "galera-23.2.2-1.rhel5.x86_64.rpm"
80 105 },
81 106 "mysql_wsrep_source": "https://launchpad.net/codership-mysql/5.5/5.5.23-23.6/+download",
82   - "galera_source": "https://launchpad.net/galera/2.x/23.2.1/+download",
83   - "sst_method": "mysqldump",
  107 + "galera_source": "https://launchpad.net/galera/2.x/23.2.2/+download",
  108 + "sst_method": "rsync",
  109 + "init_node": "192.168.122.12",
84 110 "galera_nodes": [
85 111 "192.168.122.12",
86 112 "192.168.122.14",
87 113 "192.168.122.16"
88   - ]
  114 + ],
  115 + "secure": "yes",
  116 + "update_wsrep_urls": "no"
89 117 }
90 118
91   -* **galera_nodes**
  119 +* **galera_nodes**
92 120 These are the IP addresses where you have MySQL Galera nodes running and a random host in this list will be used as the cluster URL for a galera node if the galera recipe is "reloaded".
93   -* **sst_method**
  121 +* **sst_method**
94 122 State Snapshot Transfer method, 'mysqldump', 'rsync' or 'rsync_wan'.
95 123
96 124 Change History
97 125 ===============
98 126
  127 +* v0.3 - Add init_node which specifies the intital donor node.
99 128 * v0.2 - Use wsrep_urls with mysqld_safe
100 129 * v0.1 - Initial recipe based upon MySQL Galera 5.5.23
101 130
21 galera/attributes/default.rb
... ... @@ -1,36 +1,33 @@
1   -default['galera']['install_dir'] = "/usr/local"
2   -
3 1 case node['platform']
4 2 when 'centos', 'redhat', 'fedora', 'suse', 'scientific', 'amazon'
5 3
6   - default['mysql']['basedir'] = default['galera']['install_dir'] + "/mysql"
7   - default['mysql']['bindir'] = default['mysql']['basedir'] + "/bin"
8 4 default['mysql']['servicename'] = "mysqld"
9   -
10 5 default['xtra']['packages'] = "openssl psmisc libaio wget rsync nc"
11 6
12 7 else
13 8
14   - default['mysql']['basedir'] = default['galera']['install_dir'] + "/mysql"
15   - default['mysql']['bindir'] = default['mysql']['basedir'] + "/bin"
16 9 default['mysql']['servicename'] = "mysql"
17   -
18 10 default['xtra']['packages'] = "libssl0.9.8 psmisc libaio1 wget rsync netcat"
19 11
20 12 end
21 13
  14 +default['galera']['install_dir'] = "/usr/local"
  15 +
  16 +default['mysql']['basedir'] = "#{galera['install_dir']}/mysql"
  17 +default['mysql']['bindir'] = "#{mysql['basedir']}/bin"
  18 +
22 19 default['xtra']['sleep'] = 60
23 20 default['mysql']['root_password'] = "password"
24   -default['mysql']['mysqlbin'] = default['mysql']['bindir'] + "/mysql"
  21 +default['mysql']['mysqlbin'] = "#{mysql['bindir']}/mysql"
25 22
26 23 default['mysql']['datadir'] = "/var/lib/mysql"
27 24 default['mysql']['rundir'] = "/var/run/mysqld"
28   -default['mysql']['pid_file'] = default['mysql']['datadir'] + "/mysqld.pid"
29   -default['mysql']['socket'] = default['mysql']['rundir'] + "/mysqld.sock"
  25 +default['mysql']['pid_file'] = "#{mysql['datadir']}/mysqld.pid"
  26 +default['mysql']['socket'] = "#{mysql['rundir']}/mysqld.sock"
30 27 default['mysql']['port'] = 3306
31 28 default['mysql']['tmpdir'] = "/tmp"
32 29
33   -default['mysql']['innodb']['buffer_pool_size'] = "128M"
  30 +default['mysql']['innodb']['buffer_pool_size'] = "256M"
34 31 default['mysql']['innodb']['flush_log_at_trx_commit'] = 2
35 32 default['mysql']['innodb']['file_per_table'] = 1
36 33 default['mysql']['innodb']['doublewrite'] = 0
10 galera/data_bags/s9s_galera/config.json
@@ -3,14 +3,14 @@
3 3 "mysql_wsrep_tarball_x86_64": "mysql-5.5.23_wsrep_23.6-linux-x86_64.tar.gz",
4 4 "mysql_wsrep_tarball_i686": "mysql-5.5.23_wsrep_23.6-linux-i686.tar.gz",
5 5 "galera_package_i386": {
6   - "deb": "galera-23.2.1-i386.deb",
7   - "rpm": "galera-23.2.1-1.rhel5.i386.rpm"},
  6 + "deb": "galera-23.2.2-i386.deb",
  7 + "rpm": "galera-23.2.2-1.rhel5.i386.rpm"},
8 8 "galera_package_x86_64": {
9   - "deb": "galera-23.2.1-amd64.deb",
10   - "rpm": "galera-23.2.1-1.rhel5.x86_64.rpm"
  9 + "deb": "galera-23.2.2-amd64.deb",
  10 + "rpm": "galera-23.2.2-1.rhel5.x86_64.rpm"
11 11 },
12 12 "mysql_wsrep_source": "https://launchpad.net/codership-mysql/5.5/5.5.23-23.6/+download",
13   - "galera_source": "https://launchpad.net/galera/2.x/23.2.1/+download",
  13 + "galera_source": "https://launchpad.net/galera/2.x/23.2.2/+download",
14 14 "sst_method": "rsync",
15 15 "init_node": "chef-2",
16 16 "galera_nodes": [
2  galera/metadata.rb
@@ -3,7 +3,7 @@
3 3 license "Apache 2.0"
4 4 description "Installs a MySQL Galera Node"
5 5 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6   -version "0.1.0"
  6 +version "0.3"
7 7 recipe "galera", "Installs a MySQL Galera node"
8 8
9 9 %w{ debian ubuntu centos fedora redhat }.each do |os|
5 galera/recipes/server.rb
@@ -167,8 +167,8 @@
167 167 mode "0644"
168 168 end
169 169
170   -my_ip = node['hostname'].downcase
171   -init_host = galera_config['init_node'].downcase
  170 +my_ip = node['ipaddress']
  171 +init_host = galera_config['init_node']
172 172 sync_host = init_host
173 173
174 174 Chef::Log.info "My host = #{my_ip}"
@@ -253,5 +253,6 @@
253 253 execute "s9s-galera-installed" do
254 254 command "touch #{install_flag}"
255 255 action :run
  256 + not_if { FileTest.exists?("#{install_flag}") }
256 257 end
257 258
14 roles/cc_agent.rb
... ... @@ -1,10 +1,10 @@
1 1 name "cc_agent"
2 2 description "ClusterControl Agent"
3 3 run_list ["recipe[cmon::agent_packages]", "recipe[cmon::agent]"]
4   -#override_attributes({
5   -# "mysql" => {
6   -# "install_dir" => "/usr/local",
7   -# "mysql_bin" => "/usr/local/mysql/bin/mysql",
8   -# "root_password" => "password"}
9   -# }
10   -#)
  4 +override_attributes({
  5 + "cmon_mysql" => {
  6 + "install_dir" => "/usr/local",
  7 + "mysql_bin" => "/usr/local/mysql/bin/mysql",
  8 + "root_password" => "password"}
  9 + }
  10 +)

0 comments on commit 8e08eec

Please sign in to comment.
Something went wrong with that request. Please try again.