Merge "Fix MariaDB for ubuntu"

This commit is contained in:
Jenkins 2015-08-21 20:18:44 +00:00 committed by Gerrit Code Review
commit f14b229b10
3 changed files with 14 additions and 53 deletions

View File

@ -1,3 +1,4 @@
{% set wsrep_driver = '/usr/lib/galera/libgalera_smm.so' if kolla_base_distro == 'ubuntu' else '/usr/lib64/galera/libgalera_smm.so' %}
[mysqld]
bind-address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
port={{ mariadb_port }}
@ -13,7 +14,7 @@ wsrep_provider_options="gmcast.listen_addr=tcp://{{ hostvars[inventory_hostname]
wsrep_node_address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_wsrep_port }}
wsrep_sst_receive_address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ mariadb_sst_port }}
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_provider={{ wsrep_driver }}
wsrep_cluster_name="{{ database_cluster_name }}"
wsrep_node_name={{ ansible_hostname }}
wsrep_sst_method=xtrabackup-v2

View File

@ -1,27 +1,5 @@
#!/bin/bash
function configure_files {
crudini --set $CFG mariadb bind-address "${DB_CLUSTER_BIND_ADDRESS}"
crudini --set $CFG mariadb binlog_format "ROW"
crudini --set $CFG mariadb character-set-server "utf8"
crudini --set $CFG mariadb collation-server "utf8_general_ci"
crudini --set $CFG mariadb datadir "/var/lib/mysql"
crudini --set $CFG mariadb default-storage-engine "innodb"
crudini --set $CFG mariadb init-connect "'SET NAMES utf8'"
crudini --set $CFG mariadb innodb_autoinc_lock_mode "2"
crudini --set $CFG mariadb innodb_file_per_table 1
crudini --set $CFG mariadb innodb_flush_log_at_trx_commit "2"
crudini --set $CFG mariadb innodb_locks_unsafe_for_binlog "1"
crudini --set $CFG mariadb innodb_log_file_size "100M"
crudini --set $CFG mariadb query_cache_size "0"
crudini --set $CFG mariadb query_cache_type "0"
crudini --set $CFG mariadb wsrep_cluster_address "gcomm://${DB_CLUSTER_NODES}"
crudini --set $CFG mariadb wsrep_cluster_name "${DB_CLUSTER_NAME}"
crudini --set $CFG mariadb wsrep_provider "/usr/lib64/galera/libgalera_smm.so"
crudini --set $CFG mariadb wsrep_sst_auth "'root:${DB_ROOT_PASSWORD}'"
crudini --set $CFG mariadb wsrep_sst_method "${DB_CLUSTER_WSREP_METHOD}"
}
function bootstrap_db {
mysqld_safe --wsrep-new-cluster &
@ -53,33 +31,7 @@ function bootstrap_db {
mysqladmin -p"${DB_ROOT_PASSWORD}" shutdown
}
function configure_db {
bootstrap_db
echo "GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '$DB_ROOT_PASSWORD' ;" > $DB_CLUSTER_INIT_SQL
if [ "$MARIADB_DATABASE" ]; then
echo "CREATE DATABASE IF NOT EXISTS $MARIADB_DATABASE ;" >> $DB_CLUSTER_INIT_SQL
fi
if [ "$MARIADB_USER" -a "$MARIADB_PASSWORD" ]; then
echo "CREATE USER '$MARIADB_USER'@'%' IDENTIFIED BY '$MARIADB_PASSWORD' ;" >> $DB_CLUSTER_INIT_SQL
if [ "$MARIADB_DATABASE" ]; then
echo "GRANT ALL ON $MARIADB_DATABASE.* TO '$MARIADB_USER'@'%' ;" >> $DB_CLUSTER_INIT_SQL
fi
fi
echo "FLUSH PRIVILEGES" >> $DB_CLUSTER_INIT_SQL
}
function populate_db {
mysql_install_db
chown -R mysql: /var/lib/mysql
}
function prepare_db {
populate_db
configure_db
configure_files
}

View File

@ -26,10 +26,18 @@ RUN yum install -y http://www.percona.com/redir/downloads/percona-release/redhat
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN ["/bin/false"]
# TODO(sdake) when ubuntu support is implemented we will need a line
# && rm -rf /var/lib/mysql/
# At the end of this run statement we symlink two folders to match the folder
# structure of the RPM family for mysql configs. This allows us to not change
# the config-external.sh code
# TODO(SamYaple): Remove that symlink once config-external is updated
RUN apt-get install -y --no-install-recommends \
mariadb-galera-server \
percona-xtrabackup \
socat \
expect \
&& apt-get clean \
&& rm -rf /var/lib/mysql/* \
&& ln -s /etc/mysql/conf.d/ /etc/my.cnf.d
{% endif %}