Fix identation and mariadb log size update

This commit is contained in:
VirtuBox
2019-07-25 11:48:43 +02:00
parent 773681bb52
commit bea1050ad2
2 changed files with 61 additions and 56 deletions

View File

@@ -47,10 +47,10 @@ script:
- sudo wp --allow-root --info
- sudo wo info
- sudo tree -L 2 /etc/nginx
- sudo cat /var/www/wp1.com/wp-config.php
- sudo cat /etc/mysql/my.cnf
- sudo wo stack upgrade --netdata --no-prompt
- sudo wo stack upgrade --phpmyadmin --no-prompt
- sudo wo stack upgrade --composer --no-prompt
- sudo wo update --travis
- sudo wo stack status
- sudo wo maintenance
- sudo wo maintenance

View File

@@ -1770,60 +1770,65 @@ class WOStackController(CementBaseController):
"allkeys-lru/' "
"/etc/redis/redis.conf")
WOService.restart_service(self, 'redis-server')
if 'mariadb-server' in apt_packages:
# setting innodb memory usage
wo_ram = psutil.virtual_memory().total / (1024 * 1024)
wo_ram_innodb = int(wo_ram*0.3)
wo_ram_log_buffer = int(wo_ram_innodb*0.25)
wo_ram_log_size = int(wo_ram_log_buffer*0.5)
# replacing default values
if os.path.isfile("/etc/mysql/my.cnf"):
Log.debug(self, "Tuning MySQL configuration")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"innodb_buffer_pool_size = 256M",
"innodb_buffer_pool_size = {0}M"
.format(wo_ram_innodb))
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"innodb_log_buffer_size = 8M",
"innodb_log_buffer_size = {0}M"
.format(wo_ram_log_buffer))
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"#innodb_log_file_size = 50M",
"innodb_log_file_size = {0}M"
.format(wo_ram_log_size))
WOFileUtils.searchreplace(self,
"/etc/mysql/my.cnf",
"wait_timeout "
" = 600",
"wait_timeout "
" = 120")
# disabling mariadb binlog
WOFileUtils.searchreplace(self,
"/etc/mysql/my.cnf",
"log_bin "
" = /var/log/"
"mysql/mariadb-bin",
"#log_bin "
" = /var/log/"
"mysql/mariadb-bin")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"log_bin_index "
"= /var/log/mysql/"
"mariadb-bin.index",
"#log_bin_index "
"= /var/log/mysql/"
"mariadb-bin.index")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"expire_logs_days "
"= 10",
"#expire_logs_days "
"= 10")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"max_binlog_size "
"= 100M",
"#max_binlog_size "
"= 100M")
WOService.restart_service(self, 'mysql')
if 'mariadb-server' in apt_packages:
# setting innodb memory usage
wo_ram = psutil.virtual_memory().total / (1024 * 1024)
wo_ram_innodb = int(wo_ram*0.3)
wo_ram_log_buffer = int(wo_ram_innodb*0.25)
wo_ram_log_size = int(wo_ram_log_buffer*0.5)
# replacing default values
if os.path.isfile("/etc/mysql/my.cnf"):
Log.debug(self, "Tuning MySQL configuration")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"innodb_buffer_pool_size = 256M",
"innodb_buffer_pool_size = {0}M"
.format(wo_ram_innodb))
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"innodb_log_buffer_size = 8M",
"innodb_log_buffer_size = {0}M"
.format(wo_ram_log_buffer))
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"#innodb_log_file_size = 50M",
"innodb_log_file_size = {0}M"
.format(wo_ram_log_size))
WOFileUtils.searchreplace(self,
"/etc/mysql/my.cnf",
"wait_timeout "
" = 600",
"wait_timeout "
" = 120")
# disabling mariadb binlog
WOFileUtils.searchreplace(self,
"/etc/mysql/my.cnf",
"log_bin "
" = /var/log/"
"mysql/mariadb-bin",
"#log_bin "
" = /var/log/"
"mysql/mariadb-bin")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"log_bin_index "
"= /var/log/mysql/"
"mariadb-bin.index",
"#log_bin_index "
"= /var/log/mysql/"
"mariadb-bin.index")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"expire_logs_days "
"= 10",
"#expire_logs_days "
"= 10")
WOFileUtils.searchreplace(self, "/etc/mysql/my.cnf",
"max_binlog_size "
"= 100M",
"#max_binlog_size "
"= 100M")
WOService.stop_service(self, 'mysql')
WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile0',
'/var/lib/mysql/ib_logfile0.bak')
WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile1',
'/var/lib/mysql/ib_logfile1.bak')
WOService.start_service(self, 'mysql')
if disp_msg:
if (self.msg):