This howto is tested on:

  • Debian 10.0 Buster

Requirements

This howto requires:

This howto recommends:

Environment setup

Detect if sudo is available (“command” is used if not):

cmdProxy='command'
command type -f 'sudo' &>'/dev/null' && cmdProxy='sudo'

Configuration

Enable MySQL binary log to allow for replication and to ensure data recovery in case of crash, and make sure data is written to disk at commit:

${cmdProxy} tee '/etc/mysql/conf.d/binary-log.cnf' <<< "[mysqld]
# Enable binary log for point in time recovery.
# see : https://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html
# Note: set sync_binlog to 0 for better performances at the cost of perfect data integrity.
log_bin = /var/log/mysql/mysql-bin.log
sync_binlog=1

# Limit binary log size to prevent databases lock ups at binary log rotation.
# see : http://www.mysqlperformanceblog.com/2012/05/24/binary-log-file-size-matters/
max_binlog_size = 100M

# Write InnoDB data to disk at commit.
# Note: set to 2 for better performance at the cost of perfect data integrity.
# See https://serverfault.com/questions/363355/io-wait-causing-so-much-slowdown-ext4-jdb2-at-99-io-during-mysql-commit
innodb_flush_log_at_trx_commit = 1"

Reload the database server configuration:

${cmdProxy} systemctl 'restart' 'mariadb'

Thanks


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.