Merge "Clean up the MySQL element to make it suitable for generic use."
This commit is contained in:
commit
0d898acd7c
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -o xtrace
|
||||
sed -i -r 's/^\s*#(net\.ipv4\.ip_forward=1.*)/\1/' /etc/sysctl.conf
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
ntpfile=`mktemp`
|
||||
cat << EOF > $ntpfile
|
||||
server ntp.ubuntu.com iburst
|
||||
server 127.127.1.0
|
||||
fudge 127.127.1.0 stratum 10
|
||||
EOF
|
||||
|
||||
mv /etc/ntp.conf /etc/ntp.conf.orig
|
||||
mv $ntpfile /etc/ntp.conf
|
||||
service ntp restart
|
@ -1,24 +1,29 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
# get MYSQL_PASS and HOST_IP
|
||||
source $(dirname $0)/defaults
|
||||
|
||||
service mysql stop || true
|
||||
|
||||
MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables"
|
||||
|
||||
sqltfile=`mktemp`
|
||||
cat <<EOF > $sqltfile
|
||||
USE mysql;
|
||||
UPDATE user SET password=PASSWORD("$MYSQL_PASS") WHERE user='root';
|
||||
EOF
|
||||
$MYSQL_BOOTSTRAP < $sqltfile
|
||||
rm -f $sqltfile
|
||||
set -uex
|
||||
|
||||
CNF=/etc/mysql/my.cnf
|
||||
cp -f $(dirname $0)/my.cnf $CNF
|
||||
sed -i "s/^bind-address=.*/bind-address=$HOST_IP/" $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,14 +1,14 @@
|
||||
[mysql]
|
||||
port = 3306
|
||||
socket = /var/lib/mysql/data/mysql.sock
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
|
||||
[mysqld]
|
||||
|
||||
# GENERAL #
|
||||
user = mysql
|
||||
default_storage_engine = InnoDB
|
||||
socket = /var/lib/mysql/data/mysql.sock
|
||||
pid_file = /var/lib/mysql/data/mysql.pid
|
||||
socket = /var/run/mysqld/mysqld.sock
|
||||
pid_file = /var/lib/mysql/mysql.pid
|
||||
bind-address = 0.0.0.0
|
||||
|
||||
# MyISAM #
|
||||
@ -25,7 +25,7 @@ innodb = FORCE
|
||||
innodb_strict_mode = 1
|
||||
|
||||
# DATA STORAGE #
|
||||
datadir = /var/lib/mysql/data/
|
||||
datadir = /var/lib/mysql/
|
||||
|
||||
# CACHES AND LIMITS #
|
||||
tmp_table_size = 32M
|
||||
@ -51,13 +51,13 @@ innodb_buffer_pool_size = 592M
|
||||
|
||||
|
||||
# LOGGING #
|
||||
log_error = /var/lib/mysql/data/mysql-error.log
|
||||
log_error = /var/log/mysql/error.log
|
||||
log_queries_not_using_indexes = 1
|
||||
slow_query_log = 1
|
||||
slow_query_log_file = /var/lib/mysql/data/mysql-slow.log
|
||||
slow_query_log_file = /var/log/mysql/mysql-slow.log
|
||||
|
||||
server_id = 1
|
||||
log_bin = /var/lib/mysql/data/mysql-bin
|
||||
log_bin = /var/lib/mysql/mysql-bin
|
||||
expire_logs_days = 7
|
||||
max_binlog_size = 100M
|
||||
binlog_format = ROW
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Add the stack user we recommend folk use.
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
useradd -G admin -m stack -s /bin/bash
|
||||
passwd stack <<EOF
|
||||
stack
|
||||
stack
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user