set binlog config in mysql

keep max binlog file size to 100M. and rotate then in 10 days
This commit is contained in:
Girish Ramakrishnan
2021-02-23 14:24:40 -08:00
parent 013669e872
commit 9ccd82ce4e
4 changed files with 43 additions and 2 deletions

View File

@@ -178,7 +178,11 @@ systemctl start nginx
# restart mysql to make sure it has latest config
if [[ ! -f /etc/mysql/mysql.cnf ]] || ! diff -q "${script_dir}/start/mysql.cnf" /etc/mysql/mysql.cnf >/dev/null; then
# wait for all running mysql jobs
cp "${script_dir}/start/mysql.cnf" /etc/mysql/mysql.cnf
if [[ "${ubuntu_version}" == "20.04" ]]; then
cp "${script_dir}/start/mysql/8.0.cnf" /etc/mysql/mysql.cnf
else
cp "${script_dir}/start/mysql/5.7.cnf" /etc/mysql/mysql.cnf
fi
while true; do
if ! systemctl list-jobs | grep mysql; then break; fi
echo "Waiting for mysql jobs..."

View File

@@ -15,6 +15,10 @@ collation-server = utf8mb4_unicode_ci
# set timezone to UTC
default_time_zone='+00:00'
# keep mysql binlogs under check
expire_logs_days = 10
max_binlog_size = 100M
[mysqldump]
quick
quote-names

33
setup/start/mysql/8.0.cnf Normal file
View File

@@ -0,0 +1,33 @@
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
# http://bugs.mysql.com/bug.php?id=68514
[mysqld]
performance_schema=OFF
max_connections=50
# on ec2, without this we get a sporadic connection drop when doing the initial migration
max_allowed_packet=64M
# https://mathiasbynens.be/notes/mysql-utf8mb4
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
# set timezone to UTC
default_time_zone='+00:00'
# keep mysql binlogs under check
binlog_expire_logs_seconds = 864000
max_binlog_size = 100M
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[client]
default-character-set = utf8mb4