Adds mariadb element
This element is very similar to the mysql element but installs MariaDB instead of Percona XtraDB Cluster. Change-Id: I2f978293a95910035a4f18ca748ec7028fd39540
This commit is contained in:
parent
195ad9d595
commit
6b7e923307
5
elements/mariadb/README.md
Normal file
5
elements/mariadb/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Installs MariaDB with galera
|
||||||
|
|
||||||
|
Mysql and mariadb elements are very similar so both depend on mysql-common
|
||||||
|
element which contains shared logic. See mysql-common for more details about
|
||||||
|
mysql setup.
|
2
elements/mariadb/element-deps
Normal file
2
elements/mariadb/element-deps
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
mariadb-dev
|
||||||
|
mysql-common
|
1
elements/mariadb/element-provides
Normal file
1
elements/mariadb/element-provides
Normal file
@ -0,0 +1 @@
|
|||||||
|
mysql
|
36
elements/mariadb/install.d/10-mariadb
Executable file
36
elements/mariadb/install.d/10-mariadb
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install controller base requiered packages
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
if [ "$(dib-init-system)" = "upstart" ] ; then
|
||||||
|
install $(dirname $0)/mysql-set-server-id.upstart /etc/init/mysql-set-server-id.conf
|
||||||
|
else
|
||||||
|
echo WARNING: server-id will not be set on systems that boot this image!
|
||||||
|
fi
|
||||||
|
|
||||||
|
install-packages sysstat mytop python-mysqldb mariadb-galera-server mariadb-client galera
|
||||||
|
|
||||||
|
# Templates write the configs into /mnt/state. However, MySQL makes it very
|
||||||
|
# difficult not to use this as the directory for configs.
|
||||||
|
rm -rf /etc/mysql
|
||||||
|
ln -s /mnt/state/etc/mysql /etc/mysql
|
||||||
|
if [ -e /etc/apparmor.d/usr.sbin.mysqld ] ; then
|
||||||
|
sed -i -e 's,/var/lib/mysql/,/mnt/state/var/lib/mysql/,g' /etc/apparmor.d/usr.sbin.mysqld
|
||||||
|
sed -i -e 's,/var/log/mysql/,/mnt/state/var/log/mysql/,g' /etc/apparmor.d/usr.sbin.mysqld
|
||||||
|
sed -i -e 's,/etc/mysql/,/mnt/state/etc/mysql/,g' /etc/apparmor.d/usr.sbin.mysqld
|
||||||
|
fi
|
||||||
|
if [ -e /etc/init/mysql.conf ]; then
|
||||||
|
sed -i -e 's,/var/lib/mysql/,/mnt/state/var/lib/mysql/,g' /etc/init/mysql.conf
|
||||||
|
fi
|
||||||
|
# Fedora/RHEL install /etc/my.cnf but we do not want any unmanaged configs
|
||||||
|
rm -f /etc/my.cnf
|
||||||
|
# On openSUSE /var/lib/mysql is not part of the mariadb packages.
|
||||||
|
[ -d /var/lib/mysql ] || install -d -o mysql -g root -m 0700 /var/lib/mysql
|
||||||
|
register-state-path /var/lib/mysql
|
||||||
|
# We need to setup the directory with appropriate permissions and then
|
||||||
|
# the first time we boot a particular state partition we rsync this in.
|
||||||
|
[ -d /var/log/mysql ] || install -d -o root -g mysql -m 0775 /var/log/mysql
|
||||||
|
register-state-path /var/log/mysql
|
4
elements/mariadb/os-refresh-config/post-configure.d/40-mariadb
Executable file
4
elements/mariadb/os-refresh-config/post-configure.d/40-mariadb
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
os-svc-restart -n mysql
|
10
elements/mariadb/os-refresh-config/pre-configure.d/50-mariadb-socket
Executable file
10
elements/mariadb/os-refresh-config/pre-configure.d/50-mariadb-socket
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# mariadb clients (from mariadb.org) expect the socket at
|
||||||
|
# /var/lib/mysql/mysql.sock
|
||||||
|
#
|
||||||
|
# mysql server is started from 51-init-openstack (reset-db script) - we need to
|
||||||
|
# create symlink to make sure reset-db will not fail
|
||||||
|
[ -d /var/lib/mysql ] || mkdir -p /var/lib/mysql
|
||||||
|
ln -sf /var/run/mysqld/mysqld.sock /var/lib/mysql/mysql.sock
|
Loading…
Reference in New Issue
Block a user