lamp: adjust mariadb parameters

This commit is contained in:
nachoparker 2019-02-22 13:45:15 -07:00
parent 160e295c68
commit e39c3abd5b
3 changed files with 68 additions and 8 deletions

View File

@ -1,5 +1,7 @@
[v1.7.0](https://github.com/nextcloud/nextcloudpi/commit/b0a83b0) (2019-02-17) add nc-restore-snapshot
[v1.7.1](https://github.com/nextcloud/nextcloudpi/commit/a077130) (2019-02-22) lamp: adjust mariadb parameters
[v1.7.0](https://github.com/nextcloud/nextcloudpi/commit/5e1ea77) (2019-02-17) add nc-restore-snapshot
[v1.6.7 ](https://github.com/nextcloud/nextcloudpi/commit/41a48c9) (2019-02-17) nc-backup-auto: notify failures

34
lamp.sh
View File

@ -127,10 +127,36 @@ EOF
$APTINSTALL ssl-cert # self signed snakeoil certs
# configure MariaDB (UTF8 4 byte support)
cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/mariadb.conf.d/90-ncp.cnf
sed -i '/\[mysqld\]/ainnodb_large_prefix=true' /etc/mysql/mariadb.conf.d/90-ncp.cnf
sed -i '/\[mysqld\]/ainnodb_file_per_table=1' /etc/mysql/mariadb.conf.d/90-ncp.cnf
sed -i '/\[mysqld\]/ainnodb_file_format=barracuda' /etc/mysql/mariadb.conf.d/90-ncp.cnf
cat > /etc/mysql/mariadb.conf.d/90-ncp.cnf <<EOF
[mysqld]
datadir = /var/lib/mysql
EOF
cat > /etc/mysql/mariadb.conf.d/91-ncp.cnf <<EOF
[mysqld]
transaction_isolation = READ-COMMITTED
innodb_large_prefix=true
innodb_file_per_table=1
innodb_file_format=barracuda
[server]
# innodb settings
skip-name-resolve
innodb_buffer_pool_size = 256M
innodb_buffer_pool_instances = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M
innodb_max_dirty_pages_pct = 90
innodb_log_file_size = 32M
# disable query cache
query_cache_type = 0
query_cache_size = 0
# other
tmp_table_size= 64M
max_heap_table_size= 64M
EOF
# launch mariadb if not already running
if ! pgrep -c mysqld &>/dev/null; then

View File

@ -309,6 +309,38 @@ EOF
bash -c "sleep 2 && service apache2 reload" &>/dev/null &
fi
# configure MariaDB (UTF8 4 byte support)
[[ -f /etc/mysql/mariadb.conf.d/91-ncp.cnf ]] || {
cat > /etc/mysql/mariadb.conf.d/91-ncp.cnf <<EOF
[mysqld]
transaction_isolation = READ-COMMITTED
innodb_large_prefix=true
innodb_file_per_table=1
innodb_file_format=barracuda
[server]
# innodb settings
skip-name-resolve
innodb_buffer_pool_size = 256M
innodb_buffer_pool_instances = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M
innodb_max_dirty_pages_pct = 90
innodb_log_file_size = 32M
# disable query cache
query_cache_type = 0
query_cache_size = 0
# other
tmp_table_size= 64M
max_heap_table_size= 64M
EOF
ncc maintenance:mode --on
service mysql restart
ncc maintenance:mode --off
}
# remove redundant opcache configuration. Leave until update bug is fixed -> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815968
# Bug #416 reappeared after we moved to php7.2 and debian buster packages. (keep last)
[[ "$( ls -l /etc/php/7.2/fpm/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/7.2/fpm/conf.d/*-opcache.ini | tail -1 )"