From e21bd8ea9696b2c50e4901de0839ec77b2329418 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 23 Mar 2018 05:56:53 +0100 Subject: Further parametrization --- .../mysql/pre-init/30-ands-tuning.sh | 27 ++++++++++++++++++++-- .../mysql/pre-init/ands-ro-modes.cnf.template | 3 +++ .../mysql/pre-init/ands-slave.cnf.template | 2 +- .../mysql/pre-init/ands-tuning.cnf.template | 8 +++++-- .../mysql/pre-init/ands-unsafe-fsync.cnf.template | 5 ++++ 5 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-ro-modes.cnf.template create mode 100644 mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-unsafe-fsync.cnf.template (limited to 'mysql') diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh index c717e9d..4c60495 100644 --- a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh +++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/30-ands-tuning.sh @@ -1,17 +1,40 @@ +export MYSQL_SUPER_READ_ONLY=${MYSQL_SUPER_READ_ONLY:-0} +export MYSQL_READ_ONLY=${MYSQL_READ_ONLY:-$MYSQL_SUPER_READ_ONLY} + export MYSQL_LOG_BIN=${MYSQL_LOG_BIN:-1} export MYSQL_SYNC_BINLOG=${MYSQL_SYNC_BINLOG:-0} +export MYSQL_BINLOG_ROW_IMAGE=${MYSQL_BINLOG_ROW_IMAGE:-full} export MYSQL_LOG_SLAVE_UPDATES=${MYSQL_LOG_SLAVE_UPDATES:-0} export MYSQL_BINLOG_SYNC_DELAY=${MYSQL_BINLOG_SYNC_DELAY:-0} export MYSQL_BINLOG_NODELAY_COUNT=${MYSQL_BINLOG_NODELAY_COUNT:-0} -export MYSQL_FLUSH_LOG_TYPE=${MYSQL_FLUSH_LOG_TYPE:-2} -export MYSQL_FLUSH_LOG_TIMEOUT=${MYSQL_FLUSH_LOG_TIMEOUT:-1} +export MYSQL_INNODB_FLUSH_METHOD=${MYSQL_INNODB_FLUSH_METHOD:-fsync} +export MYSQL_INNODB_FLUSH_LOG_TYPE=${MYSQL_INNODB_FLUSH_LOG_TYPE:-2} +export MYSQL_INNODB_FLUSH_LOG_TIMEOUT=${MYSQL_INNODB_FLUSH_LOG_TIMEOUT:-1} +export MYSQL_INNODB_THREAD_CONCURENCY=${MYSQL_INNODB_THREAD_CONCURENCY:-0} +export MYSQL_INNODB_BUFFER_POOL_INSTANCES=${MYSQL_INNODB_BUFFER_POOL_INSTANCES:-8} +export MYSQL_SLAVE_PARALLEL_TYPE=${MYSQL_SLAVE_PARALLEL_TYPE:-LOGICAL_CLOCK} export MYSQL_SLAVE_WORKERS=${MYSQL_SLAVE_WORKERS:-4} export MYSQL_SLAVE_SKIP_ERRORS=${MYSQL_SLAVE_SKIP_ERRORS:-ddl_exist_errors} +export MYSQL_UNSAFE_FSYNC_OPTIMIZATIONS=${MYSQL_UNSAFE_FSYNC_OPTIMIZATIONS:-0} + + log_info 'Processing basic Ands configuration files ...' envsubst < ${CONTAINER_SCRIPTS_PATH}/pre-init/ands-tuning.cnf.template > /etc/my.cnf.d/ands-tuning.cnf +if [ ${MYSQL_READ_ONLY} -eq 1 ]; then + envsubst < ${CONTAINER_SCRIPTS_PATH}/pre-init/ands-ro-modes.cnf.template > /etc/my.cnf.d/ands-ro-modes.cnf +else + rm -f /etc/my.cnf.d/ands-ro-modes.cnf || true +fi + +if [ ${MYSQL_UNSAFE_FSYNC_OPTIMIZATIONS} -eq 1 ]; then + envsubst < ${CONTAINER_SCRIPTS_PATH}/pre-init/ands-unsafe-fsync.cnf.template > /etc/my.cnf.d/ands-unsafe-fsync.cnf +else + rm -f /etc/my.cnf.d/ands-unsafe-fsync.cnf || true +fi + if [ -v MYSQL_RUNNING_AS_SLAVE ] ; then log_info 'Processing basic Ands configuration for replication (slave only) files ...' envsubst < ${CONTAINER_SCRIPTS_PATH}/pre-init/ands-slave.cnf.template > /etc/my.cnf.d/ands-slave.cnf diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-ro-modes.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-ro-modes.cnf.template new file mode 100644 index 0000000..51bb5cd --- /dev/null +++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-ro-modes.cnf.template @@ -0,0 +1,3 @@ +[mysqld] +read_only=${MYSQL_READ_ONLY} +super_read_only=${MYSQL_SUPER_READ_ONLY} diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template index eae1e6a..8ed8afb 100644 --- a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template +++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-slave.cnf.template @@ -1,5 +1,5 @@ [mysqld] -slave_parallel_type=LOGICAL_CLOCK +slave_parallel_type=${MYSQL_SLAVE_PARALLEL_TYPE} slave_parallel_workers=${MYSQL_SLAVE_WORKERS} log_slave_updates=${MYSQL_LOG_SLAVE_UPDATES} slave_skip_errors=${MYSQL_SLAVE_SKIP_ERRORS} diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template index c5991df..479258a 100644 --- a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template +++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-tuning.cnf.template @@ -1,6 +1,10 @@ [mysqld] sync_binlog=${MYSQL_SYNC_BINLOG} +binlog_row_image=${MYSQL_BINLOG_ROW_IMAGE} binlog_group_commit_sync_delay=${MYSQL_BINLOG_SYNC_DELAY} binlog_group_commit_sync_no_delay_count=${MYSQL_BINLOG_NODELAY_COUNT} -innodb_flush_log_at_trx_commit=${MYSQL_FLUSH_LOG_TYPE} -innodb_flush_log_at_timeout=${MYSQL_FLUSH_LOG_TIMEOUT} +innodb_flush_method=${MYSQL_INNODB_FLUSH_METHOD} +innodb_flush_log_at_trx_commit=${MYSQL_INNODB_FLUSH_LOG_TYPE} +innodb_flush_log_at_timeout=${MYSQL_INNODB_FLUSH_LOG_TIMEOUT} +innodb_thread_concurrency=${MYSQL_INNODB_THREAD_CONCURENCY} +innodb_buffer_pool_instances=${MYSQL_INNODB_BUFFER_POOL_INSTANCES} diff --git a/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-unsafe-fsync.cnf.template b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-unsafe-fsync.cnf.template new file mode 100644 index 0000000..2a3de2f --- /dev/null +++ b/mysql/root-galera/usr/share/container-scripts/mysql/pre-init/ands-unsafe-fsync.cnf.template @@ -0,0 +1,5 @@ +[mysqld] +innodb_doublewrite=0 +sync_master_info=0 +sync_relay_log=0 +sync_relay_log_info=0 -- cgit v1.2.3