Browse Source

Allow mysqlcheck to be enabled/disabled and tuned

The mysqlcheck allows deployers the ability to perform a cluster health
check from anywhere using simple http requests on a specific port. This
change makes it possible for deployers to enable or disable this check
capability. This also allows deployers to change the port used for the
mysqlcheck running within xinetd.

New options:
 + galera_monitoring_check_enabled - bool
 + galera_monitoring_check_port - int

The new options retains the hard-coded values as defaults, it will be
enabled and run on port 9200.

Change-Id: Ic966fbe5dfb39a35ecd10ece2901bb317c905c84
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
Kevin Carter 2 months ago
parent
commit
b78e58b1d7
No account linked to committer's email address

+ 6
- 0
defaults/main.yml View File

@@ -81,6 +81,12 @@ galera_monitoring_user_password: ""
81 81
 #
82 82
 #galera_monitoring_allowed_source: "0.0.0.0/0"
83 83
 
84
+# Enable or disable the galera monitoring check capability
85
+galera_monitoring_check_enabled: true
86
+
87
+# Set the monitoring port used with the galera monitoring check.
88
+galera_monitoring_check_port: 9200
89
+
84 90
 galera_root_user: root
85 91
 
86 92
 # WARNING: This option is deprecated and will be removed in v12.0

+ 2
- 2
handlers/main.yml View File

@@ -93,5 +93,5 @@
93 93
 - name: Restart xinetd
94 94
   service:
95 95
     name: xinetd
96
-    state: restarted
97
-    enabled: true
96
+    state: "{{ (galera_monitoring_check_enabled | bool) | ternary('restarted', 'stopped') }}"
97
+    enabled: "{{ galera_monitoring_check_enabled | bool }}"

+ 8
- 0
releasenotes/notes/mysqlcheck-options-60fae226d8d4f3ca.yaml View File

@@ -0,0 +1,8 @@
1
+---
2
+features:
3
+  - It is now possible for deployers to enable or disable the `mysqlcheck`
4
+    capability. The Boolean option `galera_monitoring_check_enabled` has
5
+    been added which has a default value of **true**.
6
+  - It is now possible to change the port used by `mysqlcheck`. The integer
7
+    option `galera_monitoring_check_port` has been added with the default
8
+    value of **9200**.

+ 29
- 20
tasks/galera_post_install.yml View File

@@ -175,33 +175,42 @@
175 175
     dest: "/usr/local/bin/galera_new_cluster"
176 176
     mode: "0750"
177 177
 
178
-- name: Create clustercheck script
179
-  template:
180
-    src: "clustercheck.j2"
181
-    dest: "/usr/local/bin/clustercheck"
182
-    mode: "0755"
183
-
184 178
 # TODO: (nicolasbock) This task can be removed in T but is necessary
185 179
 # for S and earlier because deployments prior to this change will not
186 180
 # have the xinetd service enabled because the handler task runs only
187 181
 # for new deployments.
182
+# NOTE(cloudnull): If `galera_monitoring_check_enabled` is set false
183
+#                  the xinetd service will be disabled and stopped.
184
+#                  using the handler.
188 185
 - name: Enable xinetd service
189 186
   service:
190 187
     name: xinetd
191
-    enabled: yes
192
-
193
-- name: Create mysqlchk config
194
-  template:
195
-    src: "mysqlchk.j2"
196
-    dest: "/etc/xinetd.d/mysqlchk"
197
-    mode: "0644"
188
+    enabled: "{{ galera_monitoring_check_enabled | bool }}"
198 189
   notify:
199 190
     - Restart xinetd
200 191
 
201
-- name: Add galera service check to services
202
-  lineinfile:
203
-    dest: /etc/services
204
-    state: present
205
-    regexp: '^mysqlchk'
206
-    line: 'mysqlchk    9200/tcp    # MySQL check'
207
-    backup: yes
192
+- name: Cluster check block
193
+  block:
194
+    - name: Create clustercheck script
195
+      template:
196
+        src: "clustercheck.j2"
197
+        dest: "/usr/local/bin/clustercheck"
198
+        mode: "0755"
199
+
200
+    - name: Create mysqlchk config
201
+      template:
202
+        src: "mysqlchk.j2"
203
+        dest: "/etc/xinetd.d/mysqlchk"
204
+        mode: "0644"
205
+      notify:
206
+        - Restart xinetd
207
+
208
+    - name: Add galera service check to services
209
+      lineinfile:
210
+        dest: /etc/services
211
+        state: present
212
+        regexp: '^mysqlchk'
213
+        line: 'mysqlchk    9200/tcp    # MySQL check'
214
+        backup: yes
215
+  when:
216
+    - galera_monitoring_check_enabled | bool

+ 1
- 1
templates/mysqlchk.j2 View File

@@ -6,7 +6,7 @@ service mysqlchk
6 6
         disable = no
7 7
         flags = REUSE
8 8
         socket_type = stream
9
-        port = 9200
9
+        port = {{ galera_monitoring_check_port }}
10 10
         wait = no
11 11
         user = nobody
12 12
         server = /usr/local/bin/clustercheck

Loading…
Cancel
Save