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,7 +47,7 @@ script:
- sudo wp --allow-root --info - sudo wp --allow-root --info
- sudo wo info - sudo wo info
- sudo tree -L 2 /etc/nginx - 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 --netdata --no-prompt
- sudo wo stack upgrade --phpmyadmin --no-prompt - sudo wo stack upgrade --phpmyadmin --no-prompt
- sudo wo stack upgrade --composer --no-prompt - sudo wo stack upgrade --composer --no-prompt

View File

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