Refactor mysql element to do less in first-boot.d
We didn't need to do most of this anyway, we just needed to configure mysql before we installed the packages in the image. Some of the other things were half-baked ideas which will come in later changes to add os-refresh-config and os-config-applier support to the element. Change-Id: Ib1b66a8b3b70fac10f3f826b1efd414c67f9bfc6
This commit is contained in:
parent
a28a1be2c3
commit
72534d6eba
4 changed files with 5 additions and 46 deletions
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -uex
|
|
||||||
|
|
||||||
CNF=/etc/mysql/my.cnf
|
|
||||||
cp -f $(dirname $0)/my.cnf $CNF
|
|
||||||
sed -i "s/^bind-address=.*/bind-address=0.0.0.0/" $CNF
|
|
||||||
|
|
||||||
D_SYS_MAINT="--defaults-file=/etc/mysql/debian.cnf"
|
|
||||||
|
|
||||||
# Since we will be clearing out ib_*, make sure there aren't any innodb tables.
|
|
||||||
if mysqladmin $D_SYS_MAINT ping ; then
|
|
||||||
innodb_tables=$(mysql $D_SYS_MAINT -N -e "SELECT count(*) FROM information_schema.TABLES WHERE ENGINE LIKE 'InnoDB'")
|
|
||||||
if [ -n "$innodb_tables" -a $innodb_tables -gt 0 ] ; then
|
|
||||||
echo Found $innodb_tables InnoDB tables. Any existing data may be lost. ABORT!
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
service mysql stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# The new my.cnf may not jive with default innodb sizes, so just backup and clear out ib files
|
|
||||||
if [ -n "$(ls /var/lib/mysql/ib_*)" ] ; then
|
|
||||||
BACKUP_DIR=/var/backups/mysql-$(date +%Y%m%d%H%M%S)
|
|
||||||
mkdir -p $BACKUP_DIR
|
|
||||||
chmod 700 $BACKUP_DIR
|
|
||||||
mv -f /var/lib/mysql/ib_* $BACKUP_DIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
service mysql start
|
|
|
@ -1,15 +0,0 @@
|
||||||
set -e
|
|
||||||
|
|
||||||
MYSQL_PASS=${MYSQL_PASS:-password}
|
|
||||||
|
|
||||||
# HOST_IP
|
|
||||||
# Find the interface used for the default route
|
|
||||||
HOST_IP_IFACE=${HOST_IP_IFACE:-$(ip route | sed -n '/^default/{ s/.*dev \(\w\+\)\s\+.*/\1/; p; }')}
|
|
||||||
# Search for an IP unless an explicit is set by ``HOST_IP`` environment variable
|
|
||||||
HOST_IP=`LC_ALL=C ip -f inet addr show ${HOST_IP_IFACE} | awk '/inet/ {split($2,parts,"/"); print parts[1]}'`
|
|
||||||
|
|
||||||
|
|
||||||
# XXX: get all these from metadata service eventually
|
|
||||||
IB_BUF_POOL=100M
|
|
||||||
IB_LOG_FILE_SIZE=10M
|
|
||||||
|
|
|
@ -5,5 +5,6 @@
|
||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
#install-packages sysstat mytop percona-toolkit percona-server-server-5.5 percona-server-client-5.5
|
install -D -m 0644 -o root -g root $(dirname $0)/my.cnf /etc/mysql/my.cnf
|
||||||
|
|
||||||
install-packages sysstat mytop percona-toolkit mysql-server-5.5 mysql-client-5.5
|
install-packages sysstat mytop percona-toolkit mysql-server-5.5 mysql-client-5.5
|
||||||
|
|
|
@ -56,8 +56,10 @@ log_queries_not_using_indexes = 1
|
||||||
slow_query_log = 1
|
slow_query_log = 1
|
||||||
slow_query_log_file = /var/log/mysql/mysql-slow.log
|
slow_query_log_file = /var/log/mysql/mysql-slow.log
|
||||||
|
|
||||||
server_id = 1
|
# server_id set in /etc/mysql/conf.d/server_id.cnf
|
||||||
|
# server_id = 1
|
||||||
log_bin = /var/lib/mysql/mysql-bin
|
log_bin = /var/lib/mysql/mysql-bin
|
||||||
expire_logs_days = 7
|
expire_logs_days = 7
|
||||||
max_binlog_size = 100M
|
max_binlog_size = 100M
|
||||||
binlog_format = ROW
|
binlog_format = ROW
|
||||||
|
!includedir /etc/mysql/conf.d/
|
Loading…
Reference in a new issue