Merge "Updated MariaDB to the new release version (10.0)"
This commit is contained in:
@@ -13,60 +13,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Check galera cluster status
|
||||
- name: Galera container config
|
||||
hosts: galera_all
|
||||
max_fail_percentage: 0
|
||||
tasks:
|
||||
- name: Check if mysql is running
|
||||
command: /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping
|
||||
ignore_errors: true
|
||||
register: mysql_running
|
||||
|
||||
- fail:
|
||||
msg: "The cluster may be broken, mysql is not running but appears to be installed. Fix it before re-running the playbook or override with 'openstack-ansible -e galera_ignore_cluster_state=true galera-install.yml'."
|
||||
when:
|
||||
- not galera_ignore_cluster_state | bool
|
||||
- mysql_running.rc == 1
|
||||
- mysql_running.stderr | search("Check that mysqld is running and that the socket")
|
||||
|
||||
- name: Gather mysql facts
|
||||
mysql_status_facts:
|
||||
ignore_errors: true
|
||||
|
||||
- fail:
|
||||
msg: "The cluster may be broken, mysql is running but unable to gather mysql facts. Fix it before re-running the playbook or override with 'openstack-ansible -e galera_ignore_cluster_state=true galera-install.yml'."
|
||||
when:
|
||||
- not galera_ignore_cluster_state | bool
|
||||
- mysql_running.rc == 0
|
||||
- "{{ 'mysql_status' not in hostvars[inventory_hostname] }}"
|
||||
|
||||
- fail:
|
||||
msg: "wsrep_incoming_addresses does not match across the cluster. Please fix before re-running the playbooks or override with 'openstack-ansible -e galera_ignore_cluster_state=true galera-install.yml'."
|
||||
with_items: play_hosts
|
||||
when:
|
||||
- not galera_ignore_cluster_state | bool
|
||||
- mysql_running.rc == 0
|
||||
- hostvars[item]['mysql_running']['rc'] == 0
|
||||
- hostvars[inventory_hostname]['mysql_status']['wsrep_incoming_addresses'] != hostvars[item]['mysql_status']['wsrep_incoming_addresses']
|
||||
|
||||
- set_fact:
|
||||
galera_existing_cluster: false
|
||||
|
||||
- set_fact:
|
||||
galera_existing_cluster: true
|
||||
with_items: play_hosts
|
||||
when: hostvars[item].mysql_running.rc == 0
|
||||
vars:
|
||||
galera_ignore_cluster_state: false
|
||||
tags:
|
||||
- discover-galera-cluster-state
|
||||
|
||||
- name: Install galera server
|
||||
hosts: galera_all
|
||||
serial: 1
|
||||
max_fail_percentage: 20
|
||||
user: root
|
||||
pre_tasks:
|
||||
- name: Use the lxc-openstack aa profile
|
||||
lxc_container:
|
||||
name: "{{ container_name }}"
|
||||
@@ -96,6 +46,16 @@
|
||||
delegate_to: "{{ physical_host }}"
|
||||
tags:
|
||||
- galera-ssh-wait
|
||||
vars:
|
||||
is_metal: "{{ properties.is_metal|default(false) }}"
|
||||
tags:
|
||||
- galera-lxc-container-setup
|
||||
|
||||
- name: Install galera server
|
||||
hosts: galera_all
|
||||
serial: 1
|
||||
max_fail_percentage: 20
|
||||
user: root
|
||||
roles:
|
||||
- { role: "galera_server", tags: [ "galera-server" ] }
|
||||
- role: "rsyslog_client"
|
||||
@@ -112,6 +72,7 @@
|
||||
- "system-crontab-coordination"
|
||||
vars:
|
||||
galera_wsrep_node_name: "{{ container_name }}"
|
||||
galera_lb_address: "{{ internal_lb_vip_address }}"
|
||||
ansible_hostname: "{{ container_name }}"
|
||||
ansible_ssh_host: "{{ container_address }}"
|
||||
is_metal: "{{ properties.is_metal|default(false) }}"
|
||||
tags:
|
||||
- galera-install-cluster
|
||||
|
||||
@@ -23,17 +23,26 @@ galera_client_gpg_keys:
|
||||
keyserver: 'hkp://keyserver.ubuntu.com:80'
|
||||
fallback_keyserver: 'hkp://p80.pool.sks-keyservers.net:80'
|
||||
hash_id: '0xcbcb082a1bb943db'
|
||||
- key_name: 'percona-xtrabackup'
|
||||
keyserver: 'hkp://keyserver.ubuntu.com:80'
|
||||
fallback_keyserver: 'hkp://p80.pool.sks-keyservers.net:80'
|
||||
hash_id: '0x1c4cbdcdcd2efd2a'
|
||||
|
||||
# Repositories
|
||||
galera_client_apt_repo_url: "https://mirror.rackspace.com/mariadb/repo/5.5/ubuntu"
|
||||
galera_client_apt_repo_url: "https://mirror.rackspace.com/mariadb/repo/10.0/ubuntu"
|
||||
galera_client_apt_repo:
|
||||
repo: "deb {{ galera_client_apt_repo_url }} {{ ansible_distribution_release }} main"
|
||||
state: "present"
|
||||
|
||||
galera_client_apt_percona_xtrabackup_url: "https://repo.percona.com/apt"
|
||||
galera_client_apt_percona_xtrabackup_repo:
|
||||
repo: "deb {{ galera_client_apt_percona_xtrabackup_url }} {{ ansible_distribution_release }} main"
|
||||
state: "present"
|
||||
|
||||
galera_client_apt_packages:
|
||||
- libmariadbclient-dev
|
||||
- mariadb-client
|
||||
- xtrabackup
|
||||
- percona-xtrabackup
|
||||
|
||||
galera_client_pip_packages:
|
||||
- MySQL-python
|
||||
|
||||
@@ -52,11 +52,14 @@
|
||||
|
||||
- name: Add galera repo(s)
|
||||
apt_repository:
|
||||
repo: "{{ galera_client_apt_repo.repo }}"
|
||||
state: "{{ galera_client_apt_repo.state }}"
|
||||
repo: "{{ item.repo }}"
|
||||
state: "{{ item.state }}"
|
||||
register: add_repos
|
||||
until: add_repos|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items:
|
||||
- "{{ galera_client_apt_repo }}"
|
||||
- "{{ galera_client_apt_percona_xtrabackup_repo }}"
|
||||
tags:
|
||||
- galera-client-repos
|
||||
|
||||
@@ -13,12 +13,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Defines that the role will be deployed on a host machine
|
||||
is_metal: true
|
||||
galera_server_bootstrap_node: "{{ groups['galera_all'][0] }}"
|
||||
galera_ignore_cluster_state: false
|
||||
|
||||
galera_lb_address: 127.0.0.1
|
||||
|
||||
galera_cluster_name: openstack_galera_cluster
|
||||
|
||||
galera_existing_cluster: true
|
||||
galera_running_and_bootstrapped: false
|
||||
|
||||
galera_monitoring_user: monitoring
|
||||
galera_monitoring_user_password: ""
|
||||
@@ -46,11 +49,14 @@ galera_wsrep_node_incoming_address: "{{ galera_wsrep_address }}"
|
||||
galera_wsrep_slave_threads: "{{ ansible_processor_vcpus }}"
|
||||
galera_wsrep_retry_autocommit: 3
|
||||
galera_wsrep_debug: 0
|
||||
galera_wsrep_sst_method: xtrabackup-v2
|
||||
galera_wsrep_provider_options:
|
||||
- { option: "gcache.size", value: "{{ galera_gcache_size }}" }
|
||||
galera_wsrep_sst_auth_user: "root"
|
||||
galera_wsrep_sst_auth_password: "{{ galera_root_password }}"
|
||||
|
||||
## sst method
|
||||
galera_sst_method: xtrabackup-v2
|
||||
# xtrabackup parallel/compression/sync threads
|
||||
galera_xtrabackup_threads: 4
|
||||
|
||||
# Galera GPG Keys
|
||||
galera_gpg_keys:
|
||||
@@ -58,6 +64,10 @@ galera_gpg_keys:
|
||||
keyserver: 'hkp://keyserver.ubuntu.com:80'
|
||||
fallback_keyserver: 'hkp://p80.pool.sks-keyservers.net:80'
|
||||
hash_id: '0xcbcb082a1bb943db'
|
||||
- key_name: 'percona-xtrabackup'
|
||||
keyserver: 'hkp://keyserver.ubuntu.com:80'
|
||||
fallback_keyserver: 'hkp://p80.pool.sks-keyservers.net:80'
|
||||
hash_id: '0x1c4cbdcdcd2efd2a'
|
||||
|
||||
# Repositories
|
||||
galera_apt_repo_url: "https://mirror.rackspace.com/mariadb/repo/5.5/ubuntu"
|
||||
@@ -65,6 +75,11 @@ galera_apt_repo:
|
||||
repo: "deb {{ galera_apt_repo_url }} {{ ansible_distribution_release }} main"
|
||||
state: "present"
|
||||
|
||||
galera_apt_percona_xtrabackup_url: "https://repo.percona.com/apt"
|
||||
galera_apt_percona_xtrabackup_repo:
|
||||
repo: "deb {{ galera_apt_percona_xtrabackup_url }} {{ ansible_distribution_release }} main"
|
||||
state: "present"
|
||||
|
||||
galera_pip_packages:
|
||||
- MySQL-python
|
||||
- python-memcached
|
||||
@@ -78,7 +93,7 @@ galera_pre_apt_packages:
|
||||
# The package name for mariaDB is set as a variable
|
||||
# so that it can be used in debconf later in the
|
||||
# "galera_common" role.
|
||||
galera_mariadb_server_package: "mariadb-galera-server-5.5"
|
||||
galera_mariadb_server_package: "mariadb-galera-server-10.0"
|
||||
|
||||
# NB This is specifically galera_packages as these packages only get installed
|
||||
# during the galera play - this is because of the preseed task and the service
|
||||
@@ -87,8 +102,9 @@ galera_apt_packages:
|
||||
- mariadb-client
|
||||
- "{{ galera_mariadb_server_package }}"
|
||||
- galera-3
|
||||
- qpress
|
||||
- rsync
|
||||
- xtrabackup
|
||||
- percona-xtrabackup
|
||||
- socat
|
||||
|
||||
galera_debconf_items:
|
||||
@@ -109,3 +125,9 @@ galera_unindexed_query_logging: 0
|
||||
galera_my_cnf_overrides: {}
|
||||
galera_cluster_cnf_overrides: {}
|
||||
galera_debian_cnf_overrides: {}
|
||||
|
||||
# Set the max connections value for galera. Set this value to override the
|
||||
# computed value which is (100 x vCPUs). If computed, the lowest value throughout
|
||||
# the cluster will be used which is something to note if deploying galera on different
|
||||
# hardware.
|
||||
# galera_max_connections: 500
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mysql
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: $network $named $time
|
||||
# Should-Stop: $network $named $time
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start and stop the mysql database server daemon
|
||||
# Description: Controls the main MariaDB database server daemon "mysqld"
|
||||
# and its wrapper script "mysqld_safe".
|
||||
### END INIT INFO
|
||||
#
|
||||
set -e
|
||||
set -u
|
||||
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
|
||||
|
||||
test -x /usr/sbin/mysqld || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Load user defaults
|
||||
. /etc/default/mysql
|
||||
|
||||
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
|
||||
CONF=/etc/mysql/my.cnf
|
||||
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
|
||||
|
||||
# priority can be overriden and "-s" adds output to stderr
|
||||
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
|
||||
|
||||
# Safeguard (relative paths, core dumps..)
|
||||
cd /
|
||||
umask 077
|
||||
|
||||
# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
|
||||
# as many admins e.g. only store a password without a username there and
|
||||
# so break my scripts.
|
||||
export HOME=/etc/mysql/
|
||||
|
||||
## Fetch a particular option from mysql's invocation.
|
||||
#
|
||||
# Usage: void mysqld_get_param option
|
||||
mysqld_get_param() {
|
||||
/usr/sbin/mysqld --print-defaults \
|
||||
| tr " " "\n" \
|
||||
| grep -- "--$1" \
|
||||
| tail -n 1 \
|
||||
| cut -d= -f2
|
||||
}
|
||||
|
||||
## Do some sanity checks before even trying to start mysqld.
|
||||
sanity_checks() {
|
||||
# check for config file
|
||||
if [ ! -r /etc/mysql/my.cnf ]; then
|
||||
log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
|
||||
echo "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
|
||||
fi
|
||||
|
||||
# check for diskspace shortage
|
||||
datadir=`mysqld_get_param datadir`
|
||||
if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
|
||||
log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
|
||||
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
## Checks if there is a server running and if so if it is accessible.
|
||||
#
|
||||
# check_alive insists on a pingable server
|
||||
# check_dead also fails if there is a lost mysqld in the process list
|
||||
#
|
||||
# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
|
||||
mysqld_status () {
|
||||
ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
|
||||
|
||||
ps_alive=0
|
||||
pidfile=`mysqld_get_param pid-file`
|
||||
if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
|
||||
|
||||
if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
|
||||
[ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then
|
||||
return 0 # EXIT_SUCCESS
|
||||
else
|
||||
if [ "$2" = "warn" ]; then
|
||||
echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
|
||||
fi
|
||||
return 1 # EXIT_FAILURE
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# main()
|
||||
#
|
||||
|
||||
case "${1:-''}" in
|
||||
'start')
|
||||
sanity_checks;
|
||||
# Start daemon
|
||||
log_daemon_msg "Starting MariaDB database server" "mysqld"
|
||||
if mysqld_status check_alive nowarn; then
|
||||
log_progress_msg "already running"
|
||||
log_end_msg 0
|
||||
else
|
||||
# Could be removed during boot
|
||||
test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
|
||||
|
||||
# Start MariaDB!
|
||||
/usr/bin/mysqld_safe "${@:2}" > /dev/null 2>&1 &
|
||||
|
||||
# 6s was reported in #352070 to be too few when using ndbcluster
|
||||
for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do
|
||||
sleep 1
|
||||
if mysqld_status check_alive nowarn ; then break; fi
|
||||
log_progress_msg "."
|
||||
done
|
||||
if mysqld_status check_alive warn; then
|
||||
log_end_msg 0
|
||||
# Now start mysqlcheck or whatever the admin wants.
|
||||
output=$(/etc/mysql/debian-start)
|
||||
[ -n "$output" ] && log_action_msg "$output"
|
||||
else
|
||||
log_end_msg 1
|
||||
log_failure_msg "Please take a look at the syslog"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
'stop')
|
||||
# * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
|
||||
# at least for cron, we can rely on it here, too. (although we have
|
||||
# to specify it explicit as e.g. sudo environments points to the normal
|
||||
# users home and not /root)
|
||||
log_daemon_msg "Stopping MariaDB database server" "mysqld"
|
||||
if ! mysqld_status check_dead nowarn; then
|
||||
set +e
|
||||
shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
|
||||
set -e
|
||||
if [ "$r" -ne 0 ]; then
|
||||
log_end_msg 1
|
||||
[ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
|
||||
log_daemon_msg "Killing MariaDB database server by signal" "mysqld"
|
||||
killall -15 mysqld
|
||||
server_down=
|
||||
for i in `seq 1 600`; do
|
||||
sleep 1
|
||||
if mysqld_status check_dead nowarn; then server_down=1; break; fi
|
||||
done
|
||||
if test -z "$server_down"; then killall -9 mysqld; fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! mysqld_status check_dead warn; then
|
||||
log_end_msg 1
|
||||
log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-5.5/README.Debian.gz!"
|
||||
exit -1
|
||||
else
|
||||
log_end_msg 0
|
||||
fi
|
||||
;;
|
||||
|
||||
'restart')
|
||||
set +e; $SELF stop; set -e
|
||||
$SELF start
|
||||
;;
|
||||
|
||||
'reload'|'force-reload')
|
||||
log_daemon_msg "Reloading MariaDB database server" "mysqld"
|
||||
$MYADMIN reload
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
'status')
|
||||
if mysqld_status check_alive nowarn; then
|
||||
log_action_msg "$($MYADMIN version)"
|
||||
else
|
||||
log_action_msg "MariaDB is stopped."
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -17,4 +17,9 @@
|
||||
service:
|
||||
name: mysql
|
||||
state: restarted
|
||||
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == groups['galera_all'][0]) | ternary('--wsrep-new-cluster', '') }}"
|
||||
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) | ternary('--wsrep-new-cluster', '') }}"
|
||||
when: not galera_running_and_bootstrapped | bool
|
||||
register: galera_restart
|
||||
until: galera_restart|success
|
||||
retries: 3
|
||||
delay: 2
|
||||
|
||||
58
playbooks/roles/galera_server/tasks/galera_bootstrap.yml
Normal file
58
playbooks/roles/galera_server/tasks/galera_bootstrap.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Check if mysql is running
|
||||
command: /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping
|
||||
ignore_errors: true
|
||||
changed_when: mysql_running.rc != 0
|
||||
register: mysql_running
|
||||
notify: Restart mysql
|
||||
tags:
|
||||
- galera-cluster-state-check
|
||||
- galera-bootstrap
|
||||
|
||||
- name: Start cluster with wsrep
|
||||
service:
|
||||
name: mysql
|
||||
state: restarted
|
||||
args: "--wsrep-new-cluster"
|
||||
when:
|
||||
- inventory_hostname == galera_server_bootstrap_node
|
||||
- mysql_running.rc != 0
|
||||
tags:
|
||||
- galera-bootstrap
|
||||
|
||||
- name: Wait for operational state
|
||||
command: mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"'
|
||||
register: galera_check_wait
|
||||
until: galera_check_wait|success
|
||||
failed_when: not galera_check_wait.stdout | search("OPERATIONAL")
|
||||
retries: 6
|
||||
delay: 5
|
||||
when:
|
||||
- inventory_hostname == galera_server_bootstrap_node
|
||||
- mysql_running.rc != 0
|
||||
tags:
|
||||
- galera-operational
|
||||
- galera-bootstrap
|
||||
|
||||
- set_fact:
|
||||
galera_running_and_bootstrapped: true
|
||||
when:
|
||||
- inventory_hostname == galera_server_bootstrap_node
|
||||
- mysql_running.rc != 0
|
||||
tags:
|
||||
- galera-operational
|
||||
- galera-bootstrap
|
||||
75
playbooks/roles/galera_server/tasks/galera_cluster_state.yml
Normal file
75
playbooks/roles/galera_server/tasks/galera_cluster_state.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
# Copyright 2015, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Check if mysql is running
|
||||
command: /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping
|
||||
ignore_errors: true
|
||||
changed_when: mysql_running.rc != 0
|
||||
register: mysql_running
|
||||
notify: Restart mysql
|
||||
tags:
|
||||
- galera-cluster-state-check
|
||||
|
||||
- name: Check for cluster state failure
|
||||
fail:
|
||||
msg: |
|
||||
The cluster may be broken, mysql is not running but appears to be
|
||||
installed. Fix it before re-running the playbook or override with
|
||||
'openstack-ansible -e galera_ignore_cluster_state=true galera-install.yml'.
|
||||
when:
|
||||
- not galera_ignore_cluster_state | bool
|
||||
- mysql_running.rc == 1
|
||||
- mysql_running.stderr | search("Check that mysqld is running and that the socket")
|
||||
tags:
|
||||
- galera-cluster-state-check
|
||||
|
||||
- name: Gather mysql facts
|
||||
mysql_status_facts:
|
||||
ignore_errors: true
|
||||
tags:
|
||||
- galera-cluster-state-check
|
||||
|
||||
- name: Check for cluster state failure
|
||||
fail:
|
||||
msg: |
|
||||
The cluster may be broken, mysql is running but unable to gather mysql facts.
|
||||
Fix it before re-running the playbook or override with
|
||||
'openstack-ansible -e galera_ignore_cluster_state=true galera-install.yml'.
|
||||
when:
|
||||
- not galera_ignore_cluster_state | bool
|
||||
- mysql_running.rc == 0
|
||||
- mysql_status is not defined
|
||||
tags:
|
||||
- galera-cluster-state-check
|
||||
|
||||
- name: Check for cluster state failure
|
||||
fail:
|
||||
msg: |
|
||||
wsrep_incoming_addresses does not match across the cluster. Please fix before
|
||||
re-running the playbooks or override with
|
||||
'openstack-ansible -e galera_ignore_cluster_state=true galera-install.yml'.
|
||||
with_items: play_hosts
|
||||
when:
|
||||
- not galera_ignore_cluster_state | bool
|
||||
- mysql_running.rc == 0
|
||||
- mysql_status['wsrep_incoming_addresses'] != hostvars[item]['mysql_status']['wsrep_incoming_addresses']
|
||||
tags:
|
||||
- galera-cluster-state-check
|
||||
|
||||
- set_fact:
|
||||
galera_existing_cluster: true
|
||||
when: mysql_running.rc == 0
|
||||
tags:
|
||||
- galera-cluster-state-check
|
||||
@@ -58,10 +58,3 @@
|
||||
with_items: galera_pip_packages
|
||||
tags:
|
||||
- galera-pip-packages
|
||||
|
||||
- name: Check if mysql is running
|
||||
command: /usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping
|
||||
ignore_errors: true
|
||||
changed_when: mysql_started.rc != 0
|
||||
register: mysql_started
|
||||
notify: Restart mysql
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
mode: "{{ item.mode|default('0755') }}"
|
||||
recurse: "{{ item.recurse|default('false') }}"
|
||||
with_items:
|
||||
- { path: "/var/log/mysql/", owner: "mysql", recurse: "true" }
|
||||
- { path: "/var/lib/mysql", owner: "mysql", mode: "2755" }
|
||||
- { path: "/var/log/mysql", owner: "mysql", mode: "2755" }
|
||||
- { path: "/var/log/mysql_logs/", owner: "mysql", group: "syslog", mode: "2755" }
|
||||
- { path: "/etc/mysql/conf.d" }
|
||||
tags:
|
||||
@@ -50,6 +51,7 @@
|
||||
dest: /etc/mysql/debian.cnf
|
||||
config_overrides: "{{ galera_debian_cnf_overrides }}"
|
||||
config_type: "ini"
|
||||
notify: Restart mysql
|
||||
tags:
|
||||
- galera-client-user-config
|
||||
|
||||
@@ -64,17 +66,6 @@
|
||||
tags:
|
||||
- galera-config
|
||||
|
||||
- name: Drop mariadb script(s)
|
||||
copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: "{{ item.mode|default('0644') }}"
|
||||
with_items:
|
||||
- { src: mysql_init.sh, dest: /etc/init.d/mysql, mode: "0755" }
|
||||
notify: Restart mysql
|
||||
tags:
|
||||
- galera-config
|
||||
|
||||
- name: Remove policy-rc
|
||||
file:
|
||||
path: "/usr/sbin/policy-rc.d"
|
||||
|
||||
@@ -76,12 +76,15 @@
|
||||
|
||||
- name: Add galera repo(s)
|
||||
apt_repository:
|
||||
repo: "{{ galera_apt_repo.repo }}"
|
||||
state: "{{ galera_apt_repo.state }}"
|
||||
repo: "{{ item.repo }}"
|
||||
state: "{{ item.state }}"
|
||||
register: add_repos
|
||||
until: add_repos|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items:
|
||||
- "{{ galera_apt_repo }}"
|
||||
- "{{ galera_apt_percona_xtrabackup_repo }}"
|
||||
tags:
|
||||
- galera-repos
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: galera_cluster_state.yml
|
||||
- include: galera_pre_install.yml
|
||||
- include: galera_install.yml
|
||||
- include: galera_post_install.yml
|
||||
- include: galera_bootstrap.yml
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
||||
@@ -34,8 +34,8 @@ wsrep_node_name = {{ galera_wsrep_node_name }}
|
||||
wsrep_debug = {{ galera_wsrep_debug }}
|
||||
|
||||
# SST method
|
||||
wsrep_sst_method = {{ galera_sst_method }}
|
||||
wsrep_sst_auth = root:{{ galera_root_password }}
|
||||
wsrep_sst_method = {{ galera_wsrep_sst_method }}
|
||||
wsrep_sst_auth = {{ galera_wsrep_sst_auth_user }}:{{ galera_wsrep_sst_auth_password }}
|
||||
wsrep_slave_threads = {{ galera_wsrep_slave_threads }}
|
||||
|
||||
# Cluster name
|
||||
@@ -43,3 +43,10 @@ wsrep_cluster_name = "{{ galera_cluster_name }}"
|
||||
|
||||
# how many times to retry deadlocked autocommits
|
||||
wsrep_retry_autocommit = {{ galera_wsrep_retry_autocommit }}
|
||||
|
||||
[xtrabackup]
|
||||
compress
|
||||
compact
|
||||
parallel = {{ galera_xtrabackup_threads }}
|
||||
compress-threads = {{ galera_xtrabackup_threads }}
|
||||
rebuild-threads = {{ galera_xtrabackup_threads }}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{%- set all_calculated_max_connections = [] %}
|
||||
{%- for galera_node in groups['galera_all'] %}
|
||||
{%- set _ = all_calculated_max_connections.append(hostvars[galera_node]['ansible_processor_vcpus'] * 100) %}
|
||||
{%- endfor %}
|
||||
{%- set calculated_min_connections = all_calculated_max_connections | min %}
|
||||
{%- set calculated_max_connections = galera_max_connections | default(calculated_min_connections) %}
|
||||
|
||||
# How long to wait for successfull mysql startup
|
||||
# Startup can take a while if it requires a galera state transfer.
|
||||
MYSQLD_STARTUP_TIMEOUT=1800
|
||||
|
||||
ulimit -n {{ calculated_max_connections }}
|
||||
ulimit -Hn {{ calculated_max_connections }}
|
||||
|
||||
Reference in New Issue
Block a user