mariadb: Remove wsrep-notify.sh

Closes-Bug: #1947534

Change-Id: I08be074c3633cc4fb0a0bc6c9cb8d03eb5226d89
This commit is contained in:
Michal Nasiadka 2021-10-18 12:09:03 +02:00
parent 4169290856
commit b6b7401c0d
7 changed files with 14 additions and 112 deletions

View File

@ -21,7 +21,7 @@ mariadb_services:
backend_tcp_extra: backend_tcp_extra:
- "option srvtcpka" - "option srvtcpka"
- "timeout server 3600s" - "timeout server 3600s"
- "option {% if enable_mariadb_clustercheck | bool %}httpchk{% else %}mysql-check user haproxy post-41{% endif %}" - "{% if enable_mariadb_clustercheck | bool %}option httpchk{% endif %}"
custom_member_list: "{{ internal_haproxy_members.split(';') }}" custom_member_list: "{{ internal_haproxy_members.split(';') }}"
mariadb_external_lb: mariadb_external_lb:
enabled: "{{ enable_external_mariadb_load_balancer|bool }}" enabled: "{{ enable_external_mariadb_load_balancer|bool }}"
@ -57,8 +57,8 @@ database_max_timeout: 120
#################### ####################
# HAProxy # HAProxy
#################### ####################
internal_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ hostvars[host].ansible_facts.hostname }} {{ 'api' | kolla_address(host) }}:{{ mariadb_port }} check {% if enable_mariadb_clustercheck | bool %}port {{ mariadb_clustercheck_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}" internal_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ hostvars[host].ansible_facts.hostname }} {{ 'api' | kolla_address(host) }}:{{ mariadb_port }} check port {% if enable_mariadb_clustercheck | bool %}{{ mariadb_clustercheck_port }}{% else %}{{ mariadb_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}"
external_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ host }} {{ host }}:{{ mariadb_port }} check {% if enable_mariadb_clustercheck | bool %}port {{ mariadb_clustercheck_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}" external_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ host }} {{ host }}:{{ mariadb_port }} check port {% if enable_mariadb_clustercheck | bool %}{{ mariadb_clustercheck_port }}{% else %}{{ mariadb_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}"
#################### ####################
# Docker # Docker

View File

@ -82,26 +82,6 @@
notify: notify:
- restart mariadb - restart mariadb
- name: Warn about deprecation
debug:
msg: >
wsrep-notify.sh script is deprecated and will be removed in Xena
when: not enable_mariadb_clustercheck | bool
- name: Copying over wsrep-notify.sh
template:
src: "{{ role_path }}/templates/wsrep-notify.sh.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/wsrep-notify.sh"
mode: "0770"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
- not enable_mariadb_clustercheck | bool
with_dict: "{{ mariadb_services }}"
notify:
- restart mariadb
- name: Copying over xinetd clustercheck.conf - name: Copying over xinetd clustercheck.conf
vars: vars:
service_name: "mariadb-clustercheck" service_name: "mariadb-clustercheck"

View File

@ -40,9 +40,6 @@ wsrep_node_name={{ ansible_facts.hostname }}
wsrep_sst_method={{ sst_method }} wsrep_sst_method={{ sst_method }}
wsrep_sst_auth={{ database_user }}:{{ database_password }} wsrep_sst_auth={{ database_user }}:{{ database_password }}
wsrep_slave_threads=4 wsrep_slave_threads=4
{% if not enable_mariadb_clustercheck | bool %}
wsrep_notify_cmd=/usr/local/bin/wsrep-notify.sh
{% endif %}
wsrep_on = ON wsrep_on = ON
max_connections=10000 max_connections=10000

View File

@ -7,13 +7,7 @@
"dest": "/etc/{{ mysql_dir }}/my.cnf", "dest": "/etc/{{ mysql_dir }}/my.cnf",
"owner": "mysql", "owner": "mysql",
"perm": "0600" "perm": "0600"
}{% if not enable_mariadb_clustercheck | bool %}, }
{
"source": "{{ container_config_directory }}/wsrep-notify.sh",
"dest": "/usr/local/bin/wsrep-notify.sh",
"owner": "mysql",
"perm": "0700"
}{% endif %}
], ],
"permissions": [ "permissions": [
{ {

View File

@ -1,79 +0,0 @@
#!/bin/bash -e
# Edit parameters below to specify the address and login to server.
USER={{ database_user }}
PSWD={{ database_password }}
HOST={{ api_interface_address }}
PORT={{ mariadb_port }}
LB_USER={{ mariadb_monitor_user }}
ENABLE_LB="UPDATE mysql.user SET User='${LB_USER}' WHERE User='${LB_USER}_blocked';"
DISABLE_LB="UPDATE mysql.user SET User='${LB_USER}_blocked' WHERE User='${LB_USER}';"
MYSQL_CMD="`type -p mysql` -B -u$USER -p$PSWD -h$HOST -P$PORT"
status_update()
{
echo "SET SESSION wsrep_on=off;"
echo "$@"
echo "FLUSH PRIVILEGES;"
}
get_sst_method()
{
$MYSQL_CMD -s -N -e "SHOW VARIABLES LIKE 'wsrep_sst_method';" | awk '{ print $2 }'
}
while [ $# -gt 0 ]
do
case $1 in
--status)
STATUS=$2
shift
;;
--uuid)
CLUSTER_UUID=$2
shift
;;
--primary)
[ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0"
shift
;;
--index)
INDEX=$2
shift
;;
--members)
MEMBERS=$2
shift
;;
esac
shift
done
case $STATUS in
Synced)
CMD=$ENABLE_LB
;;
Donor)
# enabling donor only if xtrabackup configured
SST_METHOD=`get_sst_method`
if [[ $SST_METHOD =~ (mariabackup|xtrabackup) ]]; then
CMD=$ENABLE_LB
else
CMD=$DISABLE_LB
fi
;;
Undefined)
# shutting down database: do nothing
;;
*)
CMD=$DISABLE_LB
;;
esac
if [ -n "$CMD" ]
then
status_update "$CMD" | $MYSQL_CMD
fi
exit 0

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes an issue with single node MariaDB deployments with HAProxy disabled.
See `bug 1947534 <https://launchpad.net/bugs/1947534>`__ for details.

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
The ``wsrep-notify.sh`` script has been removed (following deprecation
in Wallaby).