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>
This commit is contained in:
Kevin Carter 2019-01-25 21:39:49 -06:00
parent 26d546fe8b
commit b78e58b1d7
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3
5 changed files with 46 additions and 23 deletions

View File

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

View File

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

View File

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

View File

@ -175,33 +175,42 @@
dest: "/usr/local/bin/galera_new_cluster" dest: "/usr/local/bin/galera_new_cluster"
mode: "0750" mode: "0750"
- name: Create clustercheck script
template:
src: "clustercheck.j2"
dest: "/usr/local/bin/clustercheck"
mode: "0755"
# TODO: (nicolasbock) This task can be removed in T but is necessary # TODO: (nicolasbock) This task can be removed in T but is necessary
# for S and earlier because deployments prior to this change will not # for S and earlier because deployments prior to this change will not
# have the xinetd service enabled because the handler task runs only # have the xinetd service enabled because the handler task runs only
# for new deployments. # for new deployments.
# NOTE(cloudnull): If `galera_monitoring_check_enabled` is set false
# the xinetd service will be disabled and stopped.
# using the handler.
- name: Enable xinetd service - name: Enable xinetd service
service: service:
name: xinetd name: xinetd
enabled: yes enabled: "{{ galera_monitoring_check_enabled | bool }}"
- name: Create mysqlchk config
template:
src: "mysqlchk.j2"
dest: "/etc/xinetd.d/mysqlchk"
mode: "0644"
notify: notify:
- Restart xinetd - Restart xinetd
- name: Add galera service check to services - name: Cluster check block
lineinfile: block:
dest: /etc/services - name: Create clustercheck script
state: present template:
regexp: '^mysqlchk' src: "clustercheck.j2"
line: 'mysqlchk 9200/tcp # MySQL check' dest: "/usr/local/bin/clustercheck"
backup: yes mode: "0755"
- name: Create mysqlchk config
template:
src: "mysqlchk.j2"
dest: "/etc/xinetd.d/mysqlchk"
mode: "0644"
notify:
- Restart xinetd
- name: Add galera service check to services
lineinfile:
dest: /etc/services
state: present
regexp: '^mysqlchk'
line: 'mysqlchk 9200/tcp # MySQL check'
backup: yes
when:
- galera_monitoring_check_enabled | bool

View File

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